You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Transform python_bridge to an "asynchronous procedural" workflow #78
The current implementation is full of race condition probability. A Godot module may be instantiated before or after the python bridge, and therefore it's _ready function may or may not initialize its python counterpart before starting processing answers.
For example, a biofeedback module may try to send a start command in _ready and then wait for answer in _process. But the start command may not be received by Python, since it may not event be activated yet.
Screenshots
Proposition
Use a more procedural method where each call to Python wait for a return value before doing another call. No more "start" or "once" mode: a Python command is executed only once on demand, returns its return value, and then we check for new command requests, and so on.
Doing this blindly is a bad idea since the aim of using Python is to let calculations happen in parallel of the game engine, to not slow down Godot and miss frames. Therefore, this has to be still asynchrononous. In Godot, we would do:
func _process(delta):
# Do some stuff here
result = await(python_bridge.send(command, args))
# Interpret result
# Do something with result
We would not poll using python_bridge(receive). Instead, python_bridge.send() would return a signal, and then would wait for a UDP answer and process+send it via the signal once it receives it.
Activity
[68-create-a-new-biofeedback-module-for-the-propulsion-force] Working…
felixchenier commentedon Sep 11, 2026
Closed with #80