I want to have two players shooting a bunch of zombies together online. I can get the player movement working properly over the network. However, I’m not sure how to go about controlling the zombies over the network. I’m using photon for networking btw.
There will be up to 100 zombies at once, is this too much to sync over the network? How best should I handle this?
How should I handle bullets shot by the players? At the moment I’m trying to do it locally on the client, but it makes the gun stutter its shots on the other client for rapid fire guns.
conceivably this could help, make sure you are using RPC only and the correct way…
generally MP programming is hard. could perhaps do something like this;
for bullets send ONLY very limited information, eg “bullet starts here and goes in this direction” and then send results like “zombie blown to bits”
as you know in vid games bullets are done in many different ways. ie if it moves fairly slowly it could be a real physical object that moves along and perhaps hits a collider. Or , you could just “decide” well the bullet hits or not (using an angle, raycast or whatever) and then just draw maybe a “white line” or whatever for the tracer trail and do the resulting explosion. Etc etc etc there are many ways to do bullets. So your question depends on how you are doing the bullet. But in any event you have to get creative and send only conceptual information to the clients.
regarding the 100 zombies it should be possible but you’ll have to be good. send minimal information to the clients, eg
– “start a zombie here and make him walk this way”
– “make zombie N change direction to blah”
– “explode zombie N now”