Download

Replication doesn't work in cooked build

I’m trying to create a domination game mode where players need to hold certain points on the map to generate points for their teams, running it on a dedicated server. At these points a flag moves up and down, depending how many players from each team are in a certian radius. Initially the flag is not visible, once a player overlaps with the radius sphere, it becomes visible for everyone and the flag changes color appropriate for the team. Once the flag goes up to the top it starts generating score for the owning team. Simple right?
This all works fine in the editor, but not in the cooked build. Running it from the build the clients can’t see the flag initialisation on overlap, and the flag does not move anywhere. It works on the server, because it actually moves up and starts generating score, so it works , but the flag and the movement is not visible from the clients. Running it from the editor as dedicated server works fine, but i have just realised if i untick ‘Use single process’ in the Play/Advanced Settings/Multiplayer the result is the same as in the cooked build. Could anyone check my blueprints what i am doing wrong? I’m calling this from the flag blueprint, when the first player enters the area. Then i start moving the flag up on a timer. The flag actor itself is set to replicate.

Try with RepNotify. Change your variable “Current Owner” to RepNotify, in your OnRepCurrentOwner function use Switch Has Authority node and connect Remote with your Set Material and Visibility nodes.
Also, you need to check this when the player is spawned as well, because when some player connects later he also need to update this variable.

Yes that works, thanks. I don’t quite understand why though, isn’t this the intended use of multicasts? The server changes the state of actors, then asks the clients to change the state of their version of the actors, i think i’m missing something here :slight_smile:
I am also getting a bunch of warnings in the logs:


LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor FlagBase5_11. Function CheckForPlayers will not be processed.

The FlagBase is the actor that needs to be captured and CheckForPlayers runs on a timer checking how many players are in the area. These bases are placed in to the world from the editor, they are not tied to any player or or aicontrollers. The function runs fine, why does it say it will not be processed?

You need to check who fires that event. Use Switch has Authority before you call CheckForPlayers