Is it possible to rescue my project? (lag/latency issue)

so ive been working on this project/game similar to lumber tycoon 2 for almost almost one and half a year now. there is a really big terrain map (its not even finished yet) and there are lots of trees growing around the map which causes a lot of lag/latency. heres an example:


the cooldown of the axe is 0.2 seconds, but i have to wait like 2 seconds because of the lag

so far i tried enabling streaming and setting the lighting technology to Voxel and i dont really know what to do now. i really dont want to give up on this project because ive spent so much time working on it already. any help appreciated

2 Likes

How high is your ping when the latency is that bad? Just to confirm that’s really what’s going on

around a 100, my average roblox ping

Maybe add a custom region loading/unloading system to make the game lighter?

is it possible to load and unload terrain?

Terrain is probably not causing you to lag, Recommend unloading and loading trees.

But if you DO want to unload and load terrain, Take a look at this.

1 Like

That shouldn’t be causing a 2000ms delay, so the issue must be something else.

What makes you say that?

what do you mean?
image

If your ping is so low, why do you think it’s due to latency?

what else could it possibly be

It’s hard to say, latency would be my first guess too but it’s pretty much ruled out if you only have 100ms ping. My second guess is a bug in your code.

the lag only happens sometimes so i doubt its a code bug

As mentioned by @Nerbzzz a loading/unloading system would work best.

You can log all the tree spawn points in a dictionary as a key and set the value to time elapsed since it’s been cut down. You can then compare it to your ‘respawntime’ variable when loading in trees to see if a full tree should be spawned in or none at all.

This paired with streaming enabled should fix your issue. My guess would be the latency is caused by the server trying to essentially ‘render’ each tree into 3d space when the ‘graphical rendering’ can be done on the client to reduce server latency. You’ll just need to work out a loading / unloading system, send any new loaded / unloaded trees to the client and let the client draw the trees in the 3d space. Your server should just hold the tree-data.

1 Like