[SOLVED] Limit the fps so as not to destroy internet

Is there any way to limit the fps?
For example, I want my game never to exceed 30fps. It’s possible?

The FPS of your game should have no impact on the amount of bandwidth the game uses since it is always rendered client side.

Thank you for your response, but my question is whether it is possible or not.

At the moment, the update loop is done at the same rate as requestAnimationFrame which is normally at 60.

To change this you would need to change/patch the engine as it doesn’t support frame limiting.

That said, you can use the renderNextFrame functionality to only render every other frame unless it is below 30/60 which will help ease the load. This does get tricky when you have to do with normal frame rates of between 30 and 60 though.

Thank you very much for the answer. I will investigate about that mysterious renderNextFrame, maybe in it I can find an alternative solution :slight_smile:

Someone asked me in a DM on how this could be achieved. Looking the engine source, my best guess is to patch pc.application.makeTick so that update and render isn’t called until dt matches the desired lower framerate.


To avoid patching the engine you can also use the autoRender property on the pc.Application class:

this.app.autoRender = false;

That will stop the application automatically rendering each frame as soon as possible.

From there you can write your own update loop/logic and call the render method to render the next frame: