Skip to content

Commit

Permalink
Fix numpy bug (in pystk2 0.3.8)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpiwowar committed Sep 6, 2024
1 parent 329f3c2 commit cf4851d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ format-jinja = "{% if distance == 0 %}{{ base }}{% else %}{{ base }}+{{ distance

[tool.poetry.dependencies]
python = "^3.8"
PySuperTuxKart2 = ">=0.3.7"
PySuperTuxKart2 = ">=0.3.8"
gymnasium = ">0.29.0"
8 changes: 5 additions & 3 deletions src/pystk2_gymnasium/pystk_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from typing import List, Optional
import pystk2

logger = logging.getLogger("pystk2_gymnasium.mp")


class PySTKRemoteProcess:
world: Optional[pystk2.WorldState] = None
Expand Down Expand Up @@ -61,16 +63,16 @@ def warmup_race(self, config) -> pystk2.Track:
# Start race
self.race.start()
self.world = pystk2.WorldState()
self.track = pystk2.Track()
self.track.update()
track = pystk2.Track()

while True:
self.race.step()
self.world.update()
if self.world.phase == pystk2.WorldState.Phase.GO_PHASE:
break

return self.track
track.update()
return track

def get_world(self):
if self.world is None:
Expand Down
4 changes: 1 addition & 3 deletions tests/test_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_env(name, use_ai):
ix = 0
done = False
state, *_ = env.reset()
logging.exception("Running with environment %s", env.unwrapped.current_track)

for _ in range(10):
ix += 1
Expand All @@ -30,9 +31,6 @@ def test_env(name, use_ai):
done = truncated or terminated
if done:
break
except Exception:
logging.exception("with environment %s", env.current_track)
raise
finally:
if env is not None:
env.close()

0 comments on commit cf4851d

Please sign in to comment.