Dear YelloAfterLife,
Hello! I'm working on adding external mod support to my game.
When I create more monsters or player projectiles for the game, the performance cost of using lua_call to invoke Lua script functions in the step event becomes too high.
Originally, the game runs at 2000 frames per second, but when there are more than 400 bullets in the game scene, the frame rate drops quickly (down to 20 fps).
Is there any way to optimize this situation?
I tried using object pools, but I couldn't reset the luaState (Is it possible to add an additional lua_state_reset() function to clear and restore the luaState's code content?).
Regardless, the performance cost of lua_call is still significant, especially considering that there are more event functions for bullets in the mod. If I enable and call all of them, the game performance would be unbearable (it's terrifying). Do you have any suggestions?
Thank you.
Best regards,