Help with enemy desync when a huge lag spike happens

Hello, I’ve started a new tower defense project recently and I am currently experiencing an issue with the enemy spawning. All of my enemies are spawned on the server and if the player has unstable ping ( lets say, over 300 ) the enemies sometimes get randomly spaced out.

I was wondering if there could be any way to prevent that ( preferably without the use of remoteevents / moving the enemy spawning onto the client ).

( In the video i cause a fake ping spike to show what the problem is ( a huge clump of enemies spawn right after the lag and if the player has unstable ping it causes random gaps between enemies ) ).

Replicate all the spawnings Client Sided.

Make the server send to the client how many enemies that should spawn before a round,
in that way the client will know and not need constant connection with the server.

3 Likes

To elaborate on GrenadeNade’s reply

The server should only keep track of how many enemies should be present at any certain moment.
This data, including whenever they get killed and their current position is relayed to all the clients which then take action upon the replicated enemies accordingly.

All visuals such as animating and physically moving the models should be done on the client.

Basically, treat the server as the back-end and the client as the front-end.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.