How does the main loop work in Godot?

Hi,

I’m now investigating hours on the topic of finding the main game loop of Godot. I just want to see it and figure out how this stuff works.

I found now this file: godot/main/main.cpp at master · godotengine/godot · GitHub

The iterate method. This is where the physics and normal update happens i think. But from where is the :iteration been called? There also is a MainLoop.cpp file and apparently SceneTree inherits this. Scenetree has indeed the physics_process and prcoess functions, but who and from where are these functions then beeing called?

Can somebody explain to me in the most simple form of what the loop consists? Is there like a diagram or flowchart?

I’m searching for something like
while(true) → iterate()

I know its not that simple because there is threads and all but still I want to get a very basic grasp.

edit I found this: godot/platform/windows/godot_windows.cpp at master · godotengine/godot · GitHub

Is this calling itself every time?

Thx

I don’t have an answer for you because I haven’t spent any time in the code, but what are using to peruse the code? If you are just browsing on GitHub, that seems incredibly painful. I’d recommend checking the code out and opening it up in an IDE that supports it. It should be a lot easier to follow the logic of the code when you can look up all uses of a function, etc.