Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion games_covered.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Total:  🥇: 1 | 🥈: 2 | 🥉: 0  |  ❌: 2
| enduro | 🥇 | 0 |
| fishing_derby | 🥇 | 0 |
| freeway | 🥇 | 3 |
| frostbite | 🥇 | 0 |
| frostbite | 🥇 | 11 |
| gopher | ❌ | 0 |
| gravitar | 🥇 | 0 |
| hero | ❌ | 0 |
Expand Down
55 changes: 55 additions & 0 deletions scripts/list_mods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import importlib
import sys
import os
import warnings
import textwrap

# Suppress noisy warnings
warnings.filterwarnings("ignore", category=UserWarning)
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"

# Add src to path so we can import jaxatari if it's not installed
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")))

from jaxatari.core import GAME_MODULES, MOD_MODULES

def _load_from_string(path: str):
"""Dynamically import an attribute from a module path string."""
module_path, attr_name = path.rsplit(".", 1)
module = importlib.import_module(module_path)
return getattr(module, attr_name)

def list_mods():
all_games = sorted(GAME_MODULES.keys())

print(f"{'GAME':<20} | MODS")
print("-" * 80)

for game in all_games:
mods = []
if game in MOD_MODULES:
try:
controller_class = _load_from_string(MOD_MODULES[game])
if hasattr(controller_class, 'REGISTRY'):
# Get all keys from the registry
mods = sorted(controller_class.REGISTRY.keys())
except Exception as e:
mods = [f"Error loading mods: {e}"]

if mods:
mod_str = ", ".join(mods)
else:
mod_str = "(no mods)"

# Wrap the mod string for better readability
wrapped_mods = textwrap.wrap(mod_str, width=57)

if not wrapped_mods:
print(f"{game:<20} | (no mods)")
else:
print(f"{game:<20} | {wrapped_mods[0]}")
for line in wrapped_mods[1:]:
print(f"{' ':<20} | {line}")

if __name__ == "__main__":
list_mods()
3 changes: 2 additions & 1 deletion scripts/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ def running_fn():
if not frame_by_frame or next_frame_asked:

obs, state, reward, done, info = jitted_step(state, action)
# print(reward)
if reward != 0:
print(reward)
total_return += reward
if next_frame_asked:
next_frame_asked = False
Expand Down
8 changes: 7 additions & 1 deletion src/jaxatari/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ def _warn_deprecated_obs_to_flat_array(env: JaxEnvironment) -> None:
"enduro": "jaxatari.games.mods.enduro_mods.EnduroEnvMod",
"qbert": "jaxatari.games.mods.qbert_mods.QbertEnvMod",
"mspacman": "jaxatari.games.mods.mspacman_mods.MsPacmanEnvMod",
"beamrider": "jaxatari.games.mods.beamrider_mods.BeamRiderEnvMod"
"beamrider": "jaxatari.games.mods.beamrider_mods.BeamRiderEnvMod",
"venture": "jaxatari.games.mods.venture_mods.VentureEnvMod",
"spaceinvaders": "jaxatari.games.mods.spaceinvaders_mods.SpaceInvadersEnvMod",
"skiing": "jaxatari.games.mods.skiing_mods.SkiingEnvMod",
"alien": "jaxatari.games.mods.alien_mods.AlienEnvMod",
"timepilot": "jaxatari.games.mods.timepilot_mods.TimePilotEnvMod",
"asteroids": "jaxatari.games.mods.asteroids_mods.AsteroidsEnvMod"
}


Expand Down
Loading