Phaser API Documentation

  Version: 
updateFPS(time)

Description:

Update the estimate of the frame rate, fps. Every second, the number of frames that occurred in that second are included in an exponential moving average of all frames per second, with an alpha of 0.25. This means that more recent seconds affect the estimated frame rate more than older seconds.

When a browser window is NOT minimized, but is covered up (i.e. you're using another app which has spawned a window over the top of the browser), then it will start to throttle the raf callback time. It waits for a while, and then starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. So if the game was running at 60fps, and the player opens a new window, then after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz.

When they make the game visible again, the frame rate is increased at a rate of approx. 8fps, back up to 60fps (or the max it can obtain)

There is no easy way to determine if this drop in frame rate is because the browser is throttling raf, or because the game is struggling with performance because you're asking it to do too much on the device.

Compute the new exponential moving average with an alpha of 0.25.

Parameters:

name type description
time number

The timestamp passed in from RequestAnimationFrame or setTimeout.

Since: 3.60.0
Source: src/core/TimeStep.js (Line 603)