Reduce server lag

How does games with a lot of entities that spawn like Tower Defense Games reduce server lag?

Any tips will help.

1 Like

By offloading rendering off to the client, you can reduce server workload significantly:

I.e; construct npc appearance on the client and leave the server with just the root part. Handle the effects such as bullets, explosions, etc. with a remote call that tells the client to render those things.

The client is the one who is going to be in-charge of all the rendering anyway, and only they end up actually seeing your effects. Therefore it makes the most sense to just have the client do all of it for optimal server (and client) performance.

4 Likes

ooh. Here comes client replication.

okay it’s actually pretty simple. Let’s say you wanna fire a bullet, and If you lag, you still see it move. So follow my steps

  1. Server - shoot bullet
  2. Remoteevent. Server fires it to all clients
  3. Client does tweening when remoteevent is fired.
  4. Client will fire remoteevent if player touched bullet, and server will give player damage.

If you want a more secure one, this one’s tricky, you gotta like kind of time it and do it as fast as possible

  1. Server - shoot bullet
  2. Remoteevent. Server fires to all clients
  3. Client and server will tween and both will connect a touched event too.
  4. If touched in server or client, damage player.

This way, even if the exploiter modify localscript, bullet will still move but depending on server ping. So exploiter will regret deleting localscript as all what it does is lag him.

You could do this with other stuff too, like actual moving doors etc.

Hope this helped

2 Likes