# Cannot use 'this.physics.world.setFPS' to set FPS update rate?

**URL:** <https://phaser.discourse.group/t/cannot-use-this-physics-world-setfps-to-set-fps-update-rate/7260>\
**Category:** Phaser 3\
**Created:** [August 24, 2020, 2:00pm UTC](https://phaser.discourse.group/t/cannot-use-this-physics-world-setfps-to-set-fps-update-rate/7260 "2020-08-24T14:00:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![exciteabletom](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/exciteabletom/32/3125_2.png) [@exciteabletom](https://phaser.discourse.group/u/exciteabletom)\
**Post date:** [August 24, 2020, 2:00pm UTC](https://phaser.discourse.group/t/cannot-use-this-physics-world-setfps-to-set-fps-update-rate/7260/1 "2020-08-24T14:00:39Z")

</div>

Hello everyone,

I was going to create an issue on the tracker, but I figured I would check here first just in case I am messing something up.

**This is my problem:**

[Example Here](https://jsfiddle.net/76vwyms8/)

According to the [docs](https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Arcade.World.html#setFPS__anchor), I should be able to use `this.physics.world.setFPS` to limit a scenes update rate. However, using this method from within a scene doesn’t seem to work.

In my example above I have set up a simple scene.

Here’s what I think it does:

- Creates a tick variable
- Sets the physics world fps to an arbitrary value
- Every update the tick is incremented
- If the tick is greater than 500, the time elapsed from the start of the game is printed

As you can see in the example, the time elapsed remains (roughly) the same even if you **change** the **framerate** in the `setFPS` method.

The behaviour I expect is that if the update rate is doubled, the time would halve.

This issue became apparent in a game I am working on, where everything becomes ~twice as fast when a user has a 144hz monitor.

It seems to affect both FireFox and Chromium

Perhaps I am being stupid, but I think there might be a bug or incorrect documentation.

---

<div class="post-metadata">

**Author:** ![Milton](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@Milton](https://phaser.discourse.group/u/Milton)\
**Post date:** [August 24, 2020, 2:55pm UTC](https://phaser.discourse.group/t/cannot-use-this-physics-world-setfps-to-set-fps-update-rate/7260/2 "2020-08-24T14:55:39Z")

</div>

You can not set the render rate with Physics.

Docs:  
“This frame rate is **independent of the frequency at which the game is rendering**. The higher you set the fps, the more physics simulation steps will occur per game step.”

Look at this topic:

> [@Different game speed depending on monitor refresh rate](https://phaser.discourse.group/t/different-game-speed-depending-on-monitor-refresh-rate/7231):
>
> I’m working on a grid based snake game and I’ve put the movement updates in the update() event. similar to [this game](https://phaser.discourse.group/t/phaser-3-snake-game/1884). The gamelogic boils down to something like this (simplified for the example): update () { // move down one pixel this.\_player.y++; // move left one pixel this.\_fox[0].x--; // after each tile move, check eat apple, move fox etc. this.\_tilestep++; if (this.\_tilestep \> 32) { // check game logic } } This all works fine, except I’ve recently…

---

<div class="post-metadata">

**Author:** ![Telinc1](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/telinc1/32/60_2.png) [@Telinc1](https://phaser.discourse.group/u/Telinc1)\
**Post date:** [August 24, 2020, 3:07pm UTC](https://phaser.discourse.group/t/cannot-use-this-physics-world-setfps-to-set-fps-update-rate/7260/3 "2020-08-24T15:07:52Z")

</div>

Judging by your example, you’re confused by what `setFPS` actually does.

A scene’s `update` method is called on every frame of the game loop. The game loop uses the `requestAnimationFrame` API provided by the browser and its speed is tied to the refresh rate of the player’s monitor. You cannot directly limit or control how often `update` is called. Any code that runs in this method should not behave differently whether it’s called 60 times a second or 144.

The `setFPS` method relates solely to the Arcade Physics engine and will only affect game objects controlled by it (i.e. ones added through `this.physics.add`). Arcade Physics runs separately from the scene. It is independent of the speed of the update loop and will always update at a fixed time step - by default, 60 FPS. Increasing this frame rate with `setFPS` makes Arcade Physics perform more updates in smaller increments, which can sometimes help with accuracy at the expense of performance. The FPS of the fixed time step does not affect the speed of the physics simulation.

The scene’s update method receives two arguments - `time`, which is the current time in milliseconds, and `delta`, which is the time elapsed since the last frame. If you want predictable timing from your `update` method, create a fixed time step by accumulating the values of `delta` to keep track of how much time has passed.

---

<div class="post-metadata">

**Author:** ![exciteabletom](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/exciteabletom/32/3125_2.png) [@exciteabletom](https://phaser.discourse.group/u/exciteabletom)\
**Post date:** [August 25, 2020, 1:20am UTC](https://phaser.discourse.group/t/cannot-use-this-physics-world-setfps-to-set-fps-update-rate/7260/4 "2020-08-25T01:20:36Z")

</div>

Thanks very much for the detailed explanation and solution.
