godot-docs icon indicating copy to clipboard operation
godot-docs copied to clipboard

Please add documentation about physics FPS option

Open danilw opened this issue 4 years ago • 4 comments

Your Godot version: 3.2.2 stable

Issue description: Project->Project Settings->General-Physics->Common->Physics FPS I missing info about "how physics FPS work in Godot".

  1. when Physics FPS lower than actual FPS how Physics calculated
  2. does 2D Physics works the same
  3. does Godot GodotPhysics works the same

Info like this should be added:

  1. Physics does not depend on Graphic FPS in GLES2 and GLES3 native builds. Having 100% CPU usage with Physics FPS 60FPS, and setting Physics FPS to 30 will decrease CPU usage by 50%. in WASM Physics FPS calculated every frame with Graphic FPS, and changing Physics FPS option will not decrease CPU usage(it still be 100% even when Physics FPS set to 1)

URL to the documentation page: https://docs.godotengine.org/en/stable/tutorials/physics/physics_introduction.html

danilw avatar Nov 14 '20 11:11 danilw

  1. does 2D Physics works the same
  2. does Godot GodotPhysics works the same

The Physics FPS settings applies to all physics engines in both 2D and 3D. I'm not sure if we really need to mention this in the description.

Calinou avatar Nov 14 '20 13:11 Calinou

The Physics FPS settings applies to all physics engines in both 2D and 3D. I'm not sure if we really need to mention this in the description.

Physics FPS may work two ways, as I know:

  1. it loops thru all object every Graphic FPS frame, and "pause" next frame if for example physics FPS is set to 30 when Graphic FPS is 60, this how it works in WASM build, this why Physics FPS does not change CPU usage in WASM, it still loops thru all object even if not every frame but calculate all object per frame every 2 frames(it still same slow as every frame because it drop FPS every 2 frames(when 30Phys FPS and 60 real FPS, FPS droped same as with 60Phys FPS)... I hope you understand what I mean

  2. physics separated from Graphic FPS and does not loop thru all objects every frame, so it make good performance improvement by changing Physics FPS

and I mean "does Godot Physics" work the same like Bullet physics, and dont loop thru all objects every graphic frame this why I add it

danilw avatar Nov 14 '20 13:11 danilw

I have my game at 30 fps and the physics at 60 fps, what happens in this case with the physics? Is there a problem if I set the physics to 30fps and the framerate to 30fps? Does physics have to be at the same speed as framerate?

Torguen avatar Jul 26 '22 08:07 Torguen

I have my game at 30 fps and the physics at 60 fps, what happens in this case with the physics?

Input processing and physics won't match, so moving around while rotating the camera will look really bad. This isn't recommended. Having the physics FPS be a multiple of the rendering FPS is fine though, even if physics FPS exceeds the monitor refresh rate. This can also be desired to minimize input lag and maximize physics stability at the cost of higher CPU usage.

Is there a problem if I set the physics to 30fps and the framerate to 30fps?

No, it'll look fine. Input lag will be higher than with both set to 60 FPS though.

Does physics have to be at the same speed as framerate?

When not using physics interpolation: Yes, or physics should run at a multiple of the rendering framerate target.

When using physics interpolation: No, the physics FPS can be anything. However, lower physics FPS will increase input lag (which physics interpolation already increases on its own).

Calinou avatar Jul 26 '22 14:07 Calinou