How to render or update your game at 120fps or higher

This has been asked a couple of times now, so here is a short answer for it :

me.timer.maxfps = 120; = 120;;

and ta-daaa :

With timer.maxfps defining the target fps for rendering, and defining the speed which the game world or physic is updated.

Note that those two can be different, you could update your game world only at 60 fps but choose to render the game at 120fps for a butter smooth visual without impacting on performances.

After modifying the target fps, you then need to update the renderer framerate by calling game.updateFrameRate(), and you are all set ! (admittedly this could be automated with updateFrameRate being automatically called when changing the target fps).

Finally, do note that there are currently no way (at least in melonJS) to detect if the browser support a framerate higher than 60fps, so to be used with caution.

Any comments of tips or feedback on using 120fps or higher in your game, let us know !