bzier / gym-mupen64plus

An OpenAI Gym environment wrapper for the Mupen64Plus N64 emulator
MIT License
91 stars 39 forks source link

Async await for controller responses #86

Closed bzier closed 3 years ago

bzier commented 3 years ago

Currently, the behavior of the controller server and the environment step is a bit hacky. Basically, the HTTP request from the emulator to the controller server to request the current controller state needs to wait until the agent has acted in the environment (step). Likewise, the step call needs to wait to return to the agent until the emulator has read the latest controller state. They do this by toggling the value of hold_response and sleeping in a busy wait until the other side toggles its value back.

This should be replaced with a proper, non-blocking async await (see here for some possibilities). Depending on the approach, this may be dependent on the Python3 upgrade (#81). Obviously, this will need thorough testing as well.

See send_controls and do_GET