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
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.
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.