Background Loading
Spent some time trying to make zooming in and out smoother. Ran into a few unexpected challenges and ended up spending more time than ideal, but made enough improvements for now.
Initially tried offloading as much stuff as possible to a background thread since Godot 3.4 appeared to have a background loader and multi-threaded renderer option. The background loader just loads data from disc into a packed scene in memory and appeared to work fine, but unfortunately that wasn’t the main issue for my scenario since my scenes are all preloaded. The biggest bottleneck was instancing packed scenes & customizing & attaching them to scene tree.
Instancing packed scenes from a background thread unfortunately didn’t appear to be fully baked. Probably that’s why multi-threaded renderer option is not default in Godot. Trying to instance from a thread, I ran into various crashes, and attempted to work around areas that appeared to have threading issues. But ultimately it ended up being too much work to figure out all the potential threading issues and work around them. Someone mentioned Godot 4 may have better threading support, so for now just decided to use single threaded renderer and spread out render object creation overhead across multiple frames and also have a resource pool that recycles instanced scenes, rather than tossing them when not in use.
However, calculating positions of H3 hexagon boundaries were a big enough overhead that could be fully offloaded to the background thread without issues and that appears to help reduce overhead.
Just for fun got geo coordinates of some major cities, gave them random colors, and let them randomly spread to see what it looks like. Looks interesting but having too many random colors does get kind of messy. Maybe there’s a way to make it more aesthetically pleasing but we’ll see …