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
From the perspective of simharness, we need to be able to leverage environment vectorization, which is provided by rllib. The crux of the issue is as follows:
If one sub-environment calls pygame.quit(), then it messes with all other sub-environments in the same process who aren’t yet “ready” to quit, causing the program to crash. This happens primarily by setting the rendering property to False:
The final line in the above pseudo code will call self._game.quit() (see this line in simulation.py).
Fix
To resolve this issue, we simply need to add a class variable to the simfire.game.Game class, something like num_active_games that can be incremented when a new Game object is initialized, and decremented when we call Game.quit(). When we try to quit, if num_active_games == 0, only then can we call pygame.quit() with confidence.
The text was updated successfully, but these errors were encountered:
afennelly-mitre
changed the title
Current logic in Game.quit() causes simharness vectorized environment setup to crash
Current logic to quit Game causes simharness vectorized environment setup to crash
May 15, 2024
Summary
From the perspective of
simharness
, we need to be able to leverage environment vectorization, which is provided byrllib
. The crux of the issue is as follows:If one sub-environment calls
pygame.quit()
, then it messes with all other sub-environments in the same process who aren’t yet “ready” to quit, causing the program to crash. This happens primarily by setting therendering
property toFalse
:The final line in the above pseudo code will call
self._game.quit()
(see this line insimulation.py
).Fix
To resolve this issue, we simply need to add a class variable to the
simfire.game.Game
class, something likenum_active_games
that can be incremented when a newGame
object is initialized, and decremented when we callGame.quit()
. When we try to quit, ifnum_active_games == 0
, only then can we callpygame.quit()
with confidence.The text was updated successfully, but these errors were encountered: