My game is laggy

Options
Hi I'm making a top down 2d space game. It is a drop in, drop out game. I have five AI controlled ships on the map as well as up to 10 meteors, and as of right now two player controlled players. I would like to have about 20 player controlled players per room eventually. When I test it, it gets pretty laggy. The ships are all constantly shooting bullets, but they are not streamed over the network (I actually don't even know how other players are able to see the bullets, because they don't have photon views and I'm not sending a RPC for them, but they work anyway lol). The only thing I send over OnPhotonSerializeView is the player ships, AI ships, and asteroids position, rotation, and health. I have them all being sent unreliable. I upped the send rate to 100 and the sendRateOnSerialize to 75, but it's still laggy. I tried lerping their movements, and it got a little smoother, but the game wasn't very accurate anymore so I removed it. Also, every time a bullet hits a ship, or if two ships or asteroids collide with each other, I instantiate sparks (particles) on the network. I have a ping of around 90-110. What is the highest rate you should send messages at? The lag is less bad the higher I set it, but I have not tried anything higher than 100 and 75. Any ideas would be very helpful. Thanks! :smile:

Best Answer

Answers