Getting duplicates of replicated Actors on networked game start

Getting very confused here…

I have a simple game that I am trying to adapt so that it works over the network…

My game has 16 actors in it that are the “game pieces” that I want each networked player to be aware of (so I’ve set these actors to be replicated).

So I spin up a dedicated server (using some helpful command line params that I found somewhere). Whilst this is running, I am logging information about the number of actor “game pieces” in the world. It is 16 and never changes from this.

Then… I spin up 1 client, to join the game. The problem I have is that once the client starts, it is telling me that it has 32 “game pieces”, not 16 as I’m expecting.

So, if I turn off the “Replicates” flag on the game piece actor, I will end up with the correct number of actors in my client game, but then the actor is not replicated to other clients (which is the whole point of networking).

Why does the engine seem to be duplicating actors in this way?

Hope this makes sense.



I’m not sure if this is what you’re seeing, but you might be getting responses from the server version of the actors AND the client version of the actors. So for every game piece, the server has a copy and the client has a copy; both respond making it look like two. Try spawning a 2nd client and seeing if you have 48 actors. That was very confusing to me at first when I was doing “Print” functions and getting responses from each replicated version of the actor.

Just a general question, how are you placing these actors? Manually in the editor or are you spawning them yourself in some BeginPlay/Constructionscript/whatever?

I’m just placing them manually