I just thought of a way to reduce the lag by a significant amount, especially once auto-evo gets implemented: running the expensive simulations in a background thread. Right now thrive only uses a single thread and that is quite problematic for expensive computations. Currently there are quite a few frame drops when things spawn, and I believe that will only get worse as we add more stuff.
So the solution is multithreading. The issue is that Lua doesn’t support multithreading (and neither does the thrive engine). So the actual solution is creating a separate Lua state or a C++ thread that does expensive computations without accessing any external data (to keep it simle) and sends simple messages to the main thread.
Of course that might have bottleneck issues with the messaging, but if we move big enough, encapsulated things to a background thread it should be fine.