Question about spawning mechanism

Hello all,

I am think of how do you properly spawn a object that spawns the other objects over the network?

Lets say M is a machine gun turret and spawns B the bullets to hit players, when a M is spawn over the internet, if I each of M all spawn B over the internet, I can image there will be a lots of unwanted Bs spawned in the scene.

So here are my solutions

  • Give player ownership to Ms, check Ms ownership, and only let it fire when it is owned.(Not so secure to me.)
  • Let all the Ms send command to the server, the server manage those command and determine fire interval, allow only one of them to fire for each interval.(Not so effective to me)
  • Combine 1 and 2, check ownership and send command.(Seems good, but can I do better?)

I am developer only develop for fun so I don’t have much pro-training about game networking, any advice will be appreciated!

Thanks

I am having the same situation, I adopt similar approach with your first method. But I do not care client hacks at my stage.

in a server authoritative model like the HLAPI, the turrets on the server (host) would fire the bullets, and all clients would be told about them. If this is automatic, run the turret logic on the server.

If this is the result of a player command, then have the owning player send a command to the server to fire.

The bullets themselves could be spawned from the server, or you could send “fire” ClientRpc calls that fire the bullets locally on each client.

Thank you! Thats the solution I should use.