@wombatstampede said:
There are two handlers in each Node which are repetively called. One is _process(delta)
and the other is _physics_process(delta)
. The first is (roughly) called for every frame rendered. The latter is called in fixed intervals which equal the configured (project settings) physics fps rate. By default this is set to 60 iterations/calls per second. But it can be changed in the project settings.
So you `_physics_process(delta)' does sound like the thing that you search. It is not a loop though but a handler that is called regularly and should finish at least until the next iteration takes place.
But perhaps I misunderstood what you wanted to tell us. It is also possible to use multithreading.
Yes and no. That is one part of two. I would like to get those methods called more often than 60 frames per second. But secondly, i want the parameter to be set to 1/60 of a second. So if i run my game normally, it should run with ~60fps, but for training my ai, that would take way too long. Basically, i want to simulate my game fast, so i don't have to wait, but the game should act as if it would run with normal speed. I think if i set the mentioned value to more than 60 calles per second, the physiccs get more precise but the game is simulated at normal speed. The physics system acts dependent of the time. That is normal behavior and wanted in most cases. But in my case, it is not. Maybe i can show what i want with some pseudo code:
A normal game loop (simplified):
while(game_running) {
update(time_since_last_frame); // normally around 1/60s
wait_for_some_time();
}
And i want:
while(game_running) {
update(1/60 second); // so the game acts as if it is run with 60fps, but it runs faster
// wait_for_some_time(); so run as fast as possible
}