Hello all,
As the title says, I’m having problems with client-side framerates dropping to unresponsive levels (like 1 frame every 2 - 3 seconds) after only a small number of objects are spawned.
I’m new to networking, so I’m keeping my project relatively simple.
I’m using the built in NetworkManager
and NetworkManagerHUD
.
The game is 2D and consists of each player flying a space ship (no backgrounds to sync). Then, they can fly around and shoot at each other. The ships and bullets each have a NetworkIdentity
and NetworkTransform
and are registered with the NetworkManager
.
The game spawns the players at a random location, and when a player shoots, it creates a bullet on the server and spawns them on the clients. The bullets then just continue in a straight line until they hit someone, or travel x amount of distance (in which case they’re destroyed). Very simple, basic setup.
However, after either player shoots more than 5 - 10 bullets, the game grinds to an unusable state on the client side (the host’s game is still a smooth 60fps). As the bullets are slowly Destroyed, the client’s framerate goes back up. Otherwise, I have it where both players can fly around and shoot at each other, as long as there aren’t any more than a handful of bullets spawned at a time.
I could see if this happened after hundreds of bullets were spawned, but 5 - 10? Surely Unity should be able to coordinate more than 10 objects between the host and client. What could I be doing wrong?
This is both when I test it locally on my machine (running two copies of the game and connecting through localhost
) as well as connecting to another PC over Unity’s cloud with the matchmaker.
Be sure to let me know if you need specifics/settings/code.
Thanks for any help, guidance, etc.