5d-diplomacy-with-multiverse-time-travel icon indicating copy to clipboard operation
5d-diplomacy-with-multiverse-time-travel copied to clipboard

Lag when panning while zoomed out for large worlds

Open Oliveriver opened this issue 2 weeks ago • 1 comments

Split from #25.

A while ago I looked into this and found that the following problems each contributed roughly equally to the amount of lag:

  • Shadows on unit sprites. Removing shadows completely erased about half the lag I experienced. I don't consider this a good fix though, since the shadows are necessary for distinguishing units from a background region of the same colour (a border could work, but doesn't look as nice). I tried a haphazard system for conditionally removing shadows if the player is zoomed out, but the callbacks for updating unit sprites caused about as much lag as the shadows did. It's probable that a similar idea would work if done properly.

  • The sheer amount and complexity of region SVGs. If I remove all region SVGs from the world, the other half of the lag disappears. Many people have suggested a load-on-demand system to fix this, but I don't know how to do that with React. I suspect any solution here would be fighting React more than anything, since it's not really designed to have so many individual graphic elements on screen at once.

Oliveriver avatar Feb 11 '25 13:02 Oliveriver