I need to scale up my time in the game.
Like a “x2 game speed” switcher:
The problem:
If I use set_time_step with factor > 1, then I get updates with dt > 1/60.
My game logic uses messages (msg.post()) and there is a problem when I have factor > 1.
Example:
I have a gun. It shoots 60 times per second.
When factor == 1, every frame gun script sends message:
msg.post("#bullets", “createBullet”)
When I set factor = 4, then gun script on every frame will generate 4 messages in update per frame.
But only once per frame entire messages stack executes.
It causes a problem, that in case with factor == 4, gun will shoot 4 bullets at the same time (and at the same position too).
Solutions?
-
First idea: on factor > 1 and mode == 3 (create a new one) do updates and messages more than once per frame.
-
Second idea: create engine-function like msg.executeEntireStack()