0 votes

i have been try to print (delta)
in _process(delta) and in _physics process(delta)

the result is in _process(delta); the delta wasn't stable
it was print something like this:
0.003967
0.011612
0.015788
0.016176
0.016675
0.016477
0.017501
0.015837
0.016707

but in _physics process(delta) is stable:
0.016667
0.016667
0.016667
0.016667
0.016667
0.016667

why is that different ?

by the way the fps is same 60 fps for both of them
using
Project>General>Debug>Settings>Stdout>PrintFps>On

oh and also, is there any relation between delta and fps ?

(english isn't my native languange, hope this grammar right)

this is in godot version 3.0.6

in Engine by (69 points)

1 Answer

+1 vote
Best answer

_process is a function called on every idle frame.
While _physics_process is a function called on every physics frame.

...

I need to explain this better.
According to the official Godot docs, _process is called every frame in the main game loop as fast as possible. This would explain the inconsistent delta variable. physicsprocess on the other hand is called in the physics processing part of the main loop; which would mean a constant delta.

To answer your question about the relation between delta and fps, technically yes. Fps is the amount of frames drawn every second, which can be directly translated into the delta of _process. delta there is usually the amount of time it took for the last frame to be processed. Hope I'm not mistaken.

by (3,857 points)
selected by

Correct.
For example, delta can be used if you want to do stuff in given time for everyone, without worrying if one is playing on 300 FPS and someone else on 30 FPS. Without delta, 300FPS player would do stuff way faster.

nice!, thank you, this help understand more

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.