Control when Game Loop Steps?

Godot Version

Godot Engine 4.3

Question

To give some context, I’m trying to make an environment for a Machine Learning agent to play in. It is a simple race track to emulate something like AWS DeepRacer. Because Machine Learning training is nowhere near real-time, I’d like to control the main loop of the simulation, which is in Godot.

When I say ‘control the main loop’, I mean I’d like to listen to a network for a specific message. When that message is received it should then cause the engine to process one update of physics with an arbitrary delta-time so that the time it takes to train or process between frames doesn’t affect the ‘gameplay’.

I hope that’s clear what I’m asking! I figure this is all possible if I modify the Godot Engine source, but I wonder if I can do this without doing that. Thanks!

There was a similar question posted yesterday with a good answer from @gaboot, I think this is what you want as well.