How to dynamically change the frequency of update calls

I want to make an example of implementing frame synchronization, but I encountered some problems in implementing the function of disconnection and reconnection. I hope to increase the game frame rate and sprite speed during the reconnection phase. After entering the latest state, the game frame rate and sprite speed will return to normal values, but I don’t seem to be able to dynamically adjust the game frame rate.

When using requestAnimationFrame to trigger the call to update, the frequency of calling updates is consistent with the frequency of browser refresh, usually 60 frames per second. Modifying config.fps.target cannot change the frequency of calling updates.

When configuring config.fps.forceSetTimeout=true and config.fps.target=n, the number of updates called per second is n. Then I tried setting this.game.loop.targetFps, calling this.game.loop.updateFps, calling this.physics.world.setFps, but none of them could change the number of updates per second.

My brothers, do you know any way to dynamically modify the frequency of calling updates?

1 Like

Thank you so much, it solved my problem very well