Spawning of Actors in Multiplayer

Hi there, so im creating a multiplayer RTS and i need the players to be able to spawn in a set of user defined ships. The information is currently entered by the user in a widget and passes the ship information via a structure to the game instance where, when called, the event should create the ships and apply the information to them. The event on the game instance is replicated to server and the ship class is set to replicate.

Currently however, when the host calls the event, the ships spawn on both players screens and work just fine but this isnt true for the client. If the host calls the event first, when the client calls the event nothing happens at all. When the client calls the event first, the clients ships spawn only on the clients screen and the host spawns on both.

Ive tried pretty much all combinations of replication on both the event and the actor but i cant seem to get it to work.
Attached : Screen of the latter part of the custom ship building UI and event call and a screen of the game instance BP portion that should handle the spawning of ships.

Im unsure as to what to do here, any assistance is very much welcome.

Further info available if needed.

Thanks in advance.

Try with new live training made by unreal engine 4 staff Replication | Live Training | Unreal Engine - YouTube

No help, ive used the switch authority, set up parallel events and tried all combinations of replication.

Ok so on further investigation i’ve found that my issue is that the client is unable to transfer information from the widget to the game instance. Still working on this, as ever, assistance welcome.

Im close to giving up at this point. All i need is a damned tickbox generated as a bool in a widget on the client to be visible to the server. Ive tried saving to player controller and using a gamemode based list of connected players to access it, nothing. Ive tried saving to the in world character and using a get all of class, nothing. Ive tried to setup a player state and saving the bool in the player state but now a bunch of other stuff has broken.

Im at a loss and i cant find any one capable of assisting me. So far the closest ive gotten is a vague, non-answer from MK Studio…

Ive been using switches on authority, replicated events and variables and the closest i can get is a local client-only result where the server is unaware of the change done locally and thus cannot act upon the change. Ive been working on this for about 5 weeks, been following tutorials, asking for advice and i get nothing.

That would be a great help. Ive always found that direct assistance helps much more than videos or example projects as its more tailored to the specifics. Do you have a server to join?

Don’t really understand what you need, but I’d be happy to help you out on discord or something since problems like these are really tough to debug in answerhub comments

Sorry, was at work. You can join here and hopefully we’re on at the same time

I assume your US based then? Ive joined the server, @ me when youre on, lets hope we run into eachother sometime.

Server gone, Whats up?

Could you solved this?

Solved it:
Here’s what you need to do:
Make a special event that only runs on the server side for each thing you need to be replicated.
Then, when it’s time for the player to do it, call the event that runs on the server. From there, it will replicate to the other players (replication works from the server to the clients, not the other way around). If you want, I can show you how I have my blueprints.
FOR EXAMPLE: you need your character to spawn a box when you click. Your character calculates the transform of the box, then call the event that happens on the server side (costum event within your character blueprint with the “replicates” option in the details window set to “run on server”)

2 Likes

im having trouble in understanding this, so in my case from my widget player can spawn a specific item. when the clients spawn the item, the variables are set and the server can pick it up just fine. but when the server spawn the item, the variables unset and clients can’t pick it up.