How to get fps value

Hello there, how to get a variable with the current number of frames per second (fps)? What is the most efficient way? I need it mainly to evaluate, recognize the situation when the fps drops so much that the game is unplayable.

You can get the fps by running engine.getFps(). I would recommend running this in your engine.runRenderLoop function and updating a HTML element you put over the top of everything.

4 Likes

In addition to engine.getFps().
The simplest way to know FPS is just to open the Inspector

Also, below is the button which is called “Open Realtime Perf Viewer” - a fantastic visual performance debugging tool which can help you easily identify performance issues and hiccups in your scene. More info here - The Performance Profiler | Babylon.js Documentation

And, finally, one may use some simple bookmarklet as here - Babylon.js Playground

2 Likes