the game never resumes, why is that?
The expression get_tree().create_timer(1)
will create a SceneTreeTimer
, which will not execute while the game is paused.
If you want a timer that will run even when the game is paused, use a Timer
(the Node
) which you can set to run even while the game is paused by setting its process_mode
.
I also want to point out that you can create Thread
s in Godot, and have them sleep with OS.delay_msec
.
Eventually I want to create some more logic to have the game send and receive information to another non-Godot process, possibly using semaphores and shared memory or some other IPC
There aren't many options for inter-process communication with Godot. In part because games don't use them often, and in part because it is hard - if not impossible - to implement a portable solution for the platforms that Godot supports.
So, Godot does not have built-in support for named semaphores, nor named pipes, nor shared memory. Being mindful of the target platform, you could use C# or C++ with GDExtension to get access to such features.
Limiting yourself to what Godot can do out of the box, you could:
- Have Godot start other processes using
OS.execute
passing data as command line arguments. The calling thread in Godot will block during the execution, so it can get the standard output from the other program back. And the other program could do whatever means of communication you want if necessary.
- Communicate over localhost. If you need Godot to listen for incoming connections you can use
TCPServer
or UDPServer
(you might want to check and close connection that are not from localhost). Alternatively, you can have Godot connect to a server with StreamPeerTCP
or PacketPeerUDP
. There is also HTTPClient
if what you need to communicate on the other side is a web server.
- Good old hacky communication by reading and writing files in a location established beforehand.