jondubois/iogrid

[Bug] Delays and map refreshes

Closed this issue · 2 comments

Poea commented

Steady stream of delays and random map refresh

@Poea Could you give more details please?

You may get items disappearing on the map if your front end doesn't receive updated data for a while.
That can happen if your WORLD_UPDATE_INTERVAL is too low and the cell processing takes longer than the update interval (the CPU can become congested).

If this happens, you may want to make the WORLD_UPDATE_INTERVAL higher. The default 20ms is actually really low/fast (it's 50 times per second), 40ms is more reasonable (and most games seem to update at that rate since bandwidth can be expensive anyway); if you find the 40ms interval to be too 'choppy', you may want to add some sort of motion smoothing/interpolation on the front-end to smooth things out.

Having a longer interval duration allows you to perform more processing without overwhelming the CPU.

Another solution if you don't want to increase the WORLD_UPDATE_INTERVAL, is to make the cells in your grid smaller (see this) - With more smaller cells, each cell will cover less area and will have fewer items/states to process so it means that it can process them faster (and, therefore, it will be able to keep up with the low WORLD_UPDATE_INTERVAL).

Poea commented

i'll take a look into client side interpolation