yxc20098 commited on
Commit
aa68464
·
1 Parent(s): 1120c46

Bundle canonical map assets in-repo (addresses PR #12 map concern)

Browse files

PR #12 (feature/gryffin, @GryffindorafAviator) flagged that the bench
could not resolve base maps without an external OpenRA-RL-Training
checkout. This addresses that concern correctly:

- Bundle the 5 canonical .oramap terrain files the 200 packs actually
use — rush-hour-arena (195 packs) + singles-maginot/twobody/gauntlet
/dilemma — into data/maps/, copied verbatim from the canonical
source (bundled rush-hour-arena map.bin sha == canonical 9567214c).
- loader.py: data/maps is scanned first in _MAP_DIRS so the bench is
self-contained for terrain; the home-dir paths stay as dev fallbacks.
discover_packs uses rglob for nested pack dirs.

NOT taken from PR #12:
- Its bundled maps were placeholder terrain (rush-hour-arena and
scout-maginot shared one generic map.bin that did NOT match
canonical) — replaced with the real maps.
- Its openra_rl_training shim was hand-written stubs diverging from the
real package (DEFAULT_REWARD_WEIGHTS outcome 0.2 vs real 0.5;
ScenarioDefinition schema mismatch) — would silently corrupt scoring;
declined.
- Its numpy<2 pin — the bench is green on numpy 1.26.4 and modern
pandas/pyarrow support numpy 2; the ABI claim is outdated, no pin.

data/maps/rush-hour-arena.oramap ADDED
Binary file (874 Bytes). View file
 
data/maps/singles-dilemma.oramap ADDED
Binary file (870 Bytes). View file
 
data/maps/singles-gauntlet.oramap ADDED
Binary file (872 Bytes). View file
 
data/maps/singles-maginot.oramap ADDED
Binary file (870 Bytes). View file
 
data/maps/singles-twobody.oramap ADDED
Binary file (875 Bytes). View file
 
openra_bench/scenarios/loader.py CHANGED
@@ -22,7 +22,11 @@ PACKS_DIR = Path(__file__).parent / "packs"
22
  # Dirs scanned for `<base_map>.oramap` terrain files. The Rust engine
23
  # parses real .oramap terrain (map.bin) when handed an absolute path, so
24
  # any map present here is a usable custom map — not a 2-entry allowlist.
 
 
 
25
  _MAP_DIRS = [
 
26
  Path.home() / "Projects/OpenRA-RL-Training/scenarios/maps",
27
  Path.home() / "Projects/openra-rl/maps",
28
  ]
@@ -61,7 +65,7 @@ def discover_packs(directory: str | Path | None = None) -> list[ScenarioPack]:
61
  """
62
  directory = Path(directory) if directory else PACKS_DIR
63
  packs: list[ScenarioPack] = []
64
- for p in sorted(directory.glob("*.yaml")):
65
  if p.name.startswith(("_", "TEMPLATE")):
66
  continue
67
  packs.append(load_pack(p))
 
22
  # Dirs scanned for `<base_map>.oramap` terrain files. The Rust engine
23
  # parses real .oramap terrain (map.bin) when handed an absolute path, so
24
  # any map present here is a usable custom map — not a 2-entry allowlist.
25
+ # `data/maps` (first) bundles the canonical terrain in-repo so the bench
26
+ # is self-contained — no external OpenRA-RL-Training checkout needed;
27
+ # the home-dir paths remain as fallbacks for dev setups.
28
  _MAP_DIRS = [
29
+ Path(__file__).resolve().parents[2] / "data" / "maps",
30
  Path.home() / "Projects/OpenRA-RL-Training/scenarios/maps",
31
  Path.home() / "Projects/openra-rl/maps",
32
  ]
 
65
  """
66
  directory = Path(directory) if directory else PACKS_DIR
67
  packs: list[ScenarioPack] = []
68
+ for p in sorted(directory.rglob("*.yaml")):
69
  if p.name.startswith(("_", "TEMPLATE")):
70
  continue
71
  packs.append(load_pack(p))