diff --git a/environments/LICENSE b/environments/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e7396c3b741933f7cc00bb300f417681ad090105 --- /dev/null +++ b/environments/LICENSE @@ -0,0 +1,29 @@ +GameDojo Non-Commercial Research License 1.0 + +Copyright (c) 2026 the GameDojo authors + +The GameDojo authors grant permission to use, reproduce, modify, and share +original GameDojo environment code and the accompanying configuration, +documentation, and training and evaluation code in this directory solely for +non-commercial scientific research, including reproduction of research results. + +Non-commercial scientific research is work whose primary purpose is scientific +inquiry and whose use of these materials is neither primarily directed toward +commercial advantage nor intended for monetary compensation. Commercial use +requires separate written permission from the applicable rights holders. + +Copies and substantial portions of the covered materials, including modified +copies, must retain this copyright notice and license. Modified copies must +identify their changes and may be shared only under these terms. + +All game titles, characters, artwork, and other third-party material remain the +property of their respective rights holders. GameDojo is independent of those +rights holders and has no affiliation, endorsement, or sponsorship from them. +This license grants no rights in third-party material. Separately licensed +components remain subject to their own terms. See THIRD_PARTY_NOTICES.md. + +THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE, AND NON-INFRINGEMENT. TO THE EXTENT PERMITTED BY LAW, THE AUTHORS ARE +NOT LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM THE MATERIALS +OR THEIR USE. diff --git a/environments/README.md b/environments/README.md index 403b054d3e1ae66aa849556e5d51c75a312fa5c6..808581ac0f0df751b0a1555aa52aa64afeef92af 100644 --- a/environments/README.md +++ b/environments/README.md @@ -1,7 +1,41 @@ -# GameDojo game environments (local staging) +# GameDojo environments -This directory contains the game source and runtime files for 20 environments. It does not contain rendered videos, screenshots, example replays, model weights, local virtual environments, or development logs. +GameDojo contains 120 boss encounters across 20 games. The environment package provides browser play, Gymnasium interfaces, scripted reference controllers, and a model evaluation harness. -Install Python 3.12 dependencies with `pip install -r requirements-games.txt` and Chromium with `python -m playwright install chromium`. Run `python check_games.py --game terraria_remake --out terraria-check.json` for a basic game check. The web game launcher can be served with `python -m http.server 8765 --directory games/web`. +## Setup -Runtime source and prompts are English. +From this directory, install Python 3.12 dependencies and a Chromium browser for RGB observations. Install Node.js and put `node` on `PATH` to use the symbolic back end for the shared web games. Minecraft RGB observations require a working OpenGL context through ModernGL. + +```sh +python -m pip install -r requirements-games.txt +python -m playwright install chromium +``` + +## Play in a browser + +Serve the game launcher at `http://127.0.0.1:8766/`. + +```sh +python -m http.server 8766 --bind 127.0.0.1 --directory games/web +``` + +Start the Minecraft play server in another terminal. Its page is available directly at `http://127.0.0.1:8765/`. + +```sh +python games/prototype/bossbench/play_server.py +``` + +## Train and evaluate + +Set `PYTHONPATH=games/prototype` when importing `bossbench`. The `BENCH_CASES` registry in `bossbench.scope` lists the official encounters. Use `bossbench.make_policy_env` for 200 ms keyboard and mouse actions, `bossbench.make_compact_env` for discrete semantic actions, and `bossbench.make_training_env` for the step-damage reward wrapper. + +```sh +python check_games.py --game terraria_remake --out terraria-check.json +python run_model.py --case doom/cyberdemon --tier normal --policy noop --max-steps 1 +``` + +`run_model.py` accepts `--format lumine` for CUA or `--format semantic` for semantic actions, and `--time paused` or `--time realtime`. For model evaluation, use `--policy chat` and set `--base-url` and `--model` to your OpenAI-compatible endpoint and model. Run `python run_model.py --help` for the available options. + +## License + +Original GameDojo materials in this directory are available for non-commercial scientific research under the [GameDojo Non-Commercial Research License](LICENSE). See the [third-party notices](THIRD_PARTY_NOTICES.md) and the [project copyright and use statement](https://gamedojo-benchmark.github.io/). diff --git a/environments/THIRD_PARTY_NOTICES.md b/environments/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000000000000000000000000000000000000..a2049b9b93be790a2beae4c4550748ffd1dd8b81 --- /dev/null +++ b/environments/THIRD_PARTY_NOTICES.md @@ -0,0 +1,7 @@ +# Third-party notices + +- Three.js r160 is bundled as `games/web/games/_boss3d/vendor/three.min.js`. Copyright © 2010–2023 Three.js authors. The [MIT license](games/web/games/_boss3d/vendor/LICENSE) applies to that component. +- Game titles, characters, and other third-party intellectual property belong to their respective owners. The GameDojo license grants rights in original GameDojo material only. +- The Battle City environment includes stage layouts and spawn order transcribed from the reference game via an [annotated disassembly](https://github.com/cyneprepou4uk/NES-Games-Disassembly/blob/6c145873e0f344ac4f132f451ac2dc7ea95cea6b/Battle%20City/bank_FF.asm) and the [vgrichina/battlecity reference implementation](https://github.com/vgrichina/battlecity). The Mega Man environment includes weapon and boss tables transcribed via an [annotated disassembly](https://github.com/plasticsmoke/megaman1-disassembly-ca65/tree/2771fb3). The GameDojo license does not grant rights in the original games or their data. +- The Kirby encounters reference the [Kirby's Dream Land disassembly](https://github.com/ElectroDeoxys/kirbydreamland/tree/dba74416a66e4641204073276c0330f07b30cf12) and WiKirby. The source-game graphics and audio are excluded from the package. +- Upstream references for Need for Speed: Most Wanted, Hexen II, Quake II, and Tomb Raider are recorded in their game manifests. diff --git a/environments/games/prototype/bossbench/compact.py b/environments/games/prototype/bossbench/compact.py index 007650fd9b85785fcd6e78bad3f4e91e63dd8d6f..8086e601af03a2e1003d92b93a95977912594361 100644 --- a/environments/games/prototype/bossbench/compact.py +++ b/environments/games/prototype/bossbench/compact.py @@ -1,7 +1,6 @@ -"""Compact discrete action spaces for the public BossBench env: bossbench/compact-actions@1 (2026-11-10). +"""Compact discrete action spaces for the public BossBench env: bossbench/compact-actions@1. -User 2026-11-10: every game except Terraria must have an action space below 1000 (here: fewer than 1000 actions), -in the manner of ViZDoom. +Most games use fewer than 1,000 action combinations. Terraria has a separate action space. A game declares a few independent heads (move, turn, attack, ...), each a short list of options. One action picks one option per head and is held for one 200 ms packet, which is the ViZDoom frame-skip analogue. The action count is the product of the head sizes and must be below 1000. @@ -46,7 +45,7 @@ from . import keymouse as km SCHEMA = 'bossbench/compact-actions@1' CONTRACT = 'bossbench/policy-compact@1' MAX_ACTIONS = 1000 -EXEMPT_GAMES = frozenset({'terraria_remake'}) # user 2026-11-10: "all games except Terraria" +EXEMPT_GAMES = frozenset({'terraria_remake'}) ROOT = Path(__file__).resolve().parents[2] _FOLDER = {'minecraft': 'minecraft_remake'} _LABEL = re.compile(r'[a-z0-9_]+\Z') diff --git a/environments/games/prototype/bossbench/keymouse.py b/environments/games/prototype/bossbench/keymouse.py index 0ac417ce4bd71b4963a2bc9f07d78914dd052f82..da507c86ef1f41dbef3fd5f31b054ba70e0023a9 100644 --- a/environments/games/prototype/bossbench/keymouse.py +++ b/environments/games/prototype/bossbench/keymouse.py @@ -3,7 +3,7 @@ <|action_start|> dx dy dz ; K1 ; K2 ; K3 ; K4 ; K5 ; K6 <|action_end|> One packet = 200 ms = 6 sub-steps of 33 ms; K_j = 0-4 keys held during sub-step j. The parser is a -line-for-line port of web/engine/case.js BB.parsePacket (tests/unified_env.py checks they agree), so a +line-for-line port of web/engine/case.js BB.parsePacket, so a packet means the same thing whether the case runs in Python or in the browser engine. Both engines tick at 60 Hz (2 ticks per sub-step); `schedule` spreads a packet over any number of diff --git a/environments/games/prototype/bossbench/mc4d.py b/environments/games/prototype/bossbench/mc4d.py index ef98ef42eb3190302f4c7ca7a8f2d3532a36cc4a..a97d80199e73baf420c7229d87d8785bff63a57c 100644 --- a/environments/games/prototype/bossbench/mc4d.py +++ b/environments/games/prototype/bossbench/mc4d.py @@ -1,7 +1,7 @@ """3D Minecraft 1v1 v2: one voxel arena, seven boss cases, one shared rig. 3d/minecraft_iron_golem ground melee: telegraphed slam that flings, knockback immune, walks around walls - 3d/minecraft_zombie fast light melee, relentless pressure (FORMAL_CASES: kept exactly as in @4) + 3d/minecraft_zombie fast light melee, relentless pressure (legacy case) 3d/minecraft_ender_dragon aerial phases: circling, fireball strafes, perching with breath; healing end crystals 3d/minecraft_wither hovering artillery: three heads of skulls, spawn blast, arrow-proof armor at half health 3d/minecraft_warden blind juggernaut of the deep dark: crushing melee, darkness, a sonic boom for out-of-reach @@ -19,39 +19,7 @@ the same 4-state machine so the observation vector keeps one layout across mobs. Rendering is a skin: boxes come from bossbench.rig, which the simulation poses once per tick; textures, per-state poses, particles, renderer and HUD all live in bossbench.mcskin. -Rule version (RULES) - recordings, goldens and media must carry the version they were made under: - minecraft-arena@1 the H200-era rules (tests/mc4d_golden.json): sword pitch auto-aimed, crit at charge > 0.848, - hits inside the 10-tick immunity fully ignored, wither with a dash and arrow hits at any HP. - minecraft-arena@2 2026-10-31 overnight, Java Edition 1.21 combat subset ( - real pitch (mouse dy) for every weapon, no aim assist; crit needs cooldown > 0.9 (84.8 % damage); - vanilla immunity (a stronger hit inside the window deals the difference, no knockback); sprint - knockback; a two-slot hotbar (sword, bow; wheel dz switches, switching resets the cooldown) and - fist punches with the bow in hand; zombie armor 2; Java wither (11 s spawn charge + blast, - 3 heads, black/blue skulls, Wither II, regen, armor at half HP immune to arrows, no dash); - vanilla HP/contact damage for the dragon. Unfrozen: only the round-1 media used it (history). - minecraft-arena@3 frozen 2026-11-01, pinned to Java 1.21.1: @2 plus no melee crits on the ender dragon (its parts - are not LivingEntity) and the play/scripted fixes of rounds 2-3 (tests/mc4d_golden_20261031.json). - minecraft-arena@4 2026-11-02, three public tiers (TIERS below; d = 0 / 0.5 / 1 = each TABLE row's easy / normal / - hard knot): the player's kit is one fixed full-diamond loadout on every tier (only the boss - scales); boss health, attack rate and damage rise easy -> hard, calibrated so the reference - controller finishes in about 25 s / 1 min / 3 min; Java Easy / Normal / Hard damage per tier where - Java has them. Ground mobs path-find around walls (a pillar on the straight line soft-locked the - golem); the dragon calls off a fireball closer than fire_min (the scaled arena allowed point-blank - shots) and its landing chance gets a land_base knob (tests/mc4d_golden_20261102.json). - minecraft-arena@5 2026-11-03, six scenes: the zombie case becomes a leader zombie with Java reinforcements (on every - tier: same fight, scaled chance and a cap on how many are alive) on a night field; new warden - (deep dark) and skeleton archer (ruins) cases; the player's kit is part of a scene (KITS: iron sword - and armor against the overworld mobs, diamond against the end-game bosses), identical on every - tier. Iron golem, ender dragon and wither are unchanged from @4 (tests/mc4d_golden_20261103.json). - Superseded the same day by @6: the leader had replaced a FORMAL_CASES scene. - minecraft-arena@6 2026-11-03, the formal 3d/minecraft_zombie (FORMAL_CASES; its d = 0.5 was evaluated 16 times in - the mc-bow-compare-20261020 campaign) is restored to its exact @4 table, behaviour, field arena, - diamond kit, 90 s limit and observation layout; the @5 leader zombie with reinforcements is its - own case 3d/minecraft_zombie_leader (night field, iron kit). The four formal scenes equal @4 and - warden / skeleton / zombie leader equal @5 (tests/mc4d_golden_20261103_arena6.json). - minecraft-arena@7 2026-11-07, no passive regeneration: the player's natural regeneration (Java, food >= 18: - 1 HP every 80 vanilla ticks) is removed. The arena has no hunger, so it amounted to standing - still to heal (user, 2026-11-07). Nothing else changed in the rules. +Replay compatibility is tracked by the RULES identifier. """ from __future__ import annotations @@ -65,10 +33,10 @@ from . import mcskin from .rig import Rigged RULES = "minecraft-arena@7" -# Public difficulty tiers (bossbench.tiers, 2026-11-02 meeting): every TABLE row below is (easy, normal, hard), so a tier +# Public difficulty tiers: every TABLE row below is (easy, normal, hard), so a tier # reads exactly one knot of each row. The continuous d in [0, 1] still interpolates between them for fine control. TIERS = {"easy": 0.0, "normal": 0.5, "hard": 1.0} -S = 34 # arena side (blocks); was 24, enlarged so fights have room to kite +S = 34 # arena side in blocks MID = S / 2 # arena centre line (z of both spawns) AREA_K = (S - 2) ** 2 / 22 ** 2 # obstacle counts scale with floor area so density matches the 24 layout VT = 20 / FPS # one simulation tick in vanilla Minecraft ticks @@ -949,7 +917,7 @@ class ZombieLeader(Mob): arena's free floor 7-12 blocks from the player instead of Java's 0 / +-7-40 blocks in darkness. """ TABLE = { # (easy, normal, hard) = TIERS - "hp": (215, 520, 1650), # TIER calibration (Java leader: 40-100 = 2-5x a zombie's 20); round 4 + "hp": (215, 520, 1650), # TIER calibration (Java leader: 40-100 = 2-5x a zombie's 20) "speed": (0.105, 0.117, 0.135), # vanilla b/t chase; Java 0.117 (see SPEED_NOTE), slower than a walk "dmg_min": (2.5, 3.0, 4.5), # Java easy / normal / hard (fixed per difficulty) "dmg_max": (2.5, 3.0, 4.5), @@ -1738,7 +1706,7 @@ class Warden(Mob): netherite, which this arena does not model). Hard keeps every other Java Hard trait: 36-tick cooldown, 4.2 s roar. """ TABLE = { # (easy, normal, hard) = TIERS - "hp": (260, 820, 2100), # TIER calibration (Java 500 on every difficulty); round 4 + "hp": (260, 820, 2100), # TIER calibration (Java 500 on every difficulty) "speed": (0.22, 0.26, 0.286), # vanilla b/t chase; Java 0.286 = attribute 0.3 x 1.2 (SPEED_NOTE), # a sprinting player's pace (walk 0.216, sprint 0.281) "dmg": (16.0, 23.0, 30.0), # melee before armor: Java Easy 16, midway, Java Normal 30 (see below) @@ -2053,9 +2021,7 @@ class MobFight(Case): # the formal zombie case has none, as in @4) EXTRA_OBS = {"wither": 21, "skeleton": 21, "zombie_leader": 12, "warden": 3} - # Default camera "first" (user 2026-11-11: "use first-person view in Minecraft", like the original's default view; F5-style third - # person stays available as reset option camera="third"). The camera only changes the picture: the same packets give - # the same fight and the same state hash in either view (checked on 3 recorded fights), so the rule version stays. + # The camera changes only the image. Third-person is available through the reset options. def __init__(self, mob="iron_golem", style="field", width=RES[0], height=RES[1], camera="first", max_seconds=120.0, weapon='sword'): self.default_weapon, self.default_camera = _weapon(weapon), _camera(camera) diff --git a/environments/games/prototype/bossbench/mcskin.py b/environments/games/prototype/bossbench/mcskin.py index 90b4bca2f85d08be9b3bd47c558a732ce1654079..4debe08dab0baba3afb5c74d5222ffa01fb76f98 100644 --- a/environments/games/prototype/bossbench/mcskin.py +++ b/environments/games/prototype/bossbench/mcskin.py @@ -2,8 +2,7 @@ Everything here is drawing. Pose functions read simulation state and write only to the rig (keyframes and rig.mem); particle helpers draw from case.fxrng; nothing reads or advances -case.rng, so an episode stays a pure function of (case, seed, d, actions) and the golden digests -do not move when this file changes. +case.rng, so drawing cannot change an episode’s simulation state. Borrowed from the 2D web client (web/games/hollowknight_remake/draw/wanderer.js + web/engine/renderer.js): * one pose table per boss state, with anticipation / follow-through keyed to state entry @@ -1255,8 +1254,7 @@ FOG = {"field": (28.0, 76.0), "towers": (22.0, 62.0), "night": (20.0, 56.0), "de "ruins": (24.0, 68.0)} STARS = {"towers": 1.0, "night": 1.0} # third-person camera height above the player's feet, per arena style (default 2.6): the overworld night mobs are as tall -# as Steve, so from 2.6 a zombie or skeleton straight ahead hides behind the player's own body, bow draw included -# (minecraft-arena@5 round 4); the approved scenes keep their camera +# as Steve, so from 2.6 a zombie or skeleton straight ahead hides behind the player's own body, bow draw included. CAM_UP = {"night": 3.5, "ruins": 3.5} @@ -1796,7 +1794,7 @@ def hud(img, c): tw = d.textlength(tag, font=f2) d.text(((w - tw) / 2 + 1, by + bh + int(5 * u) + 1), tag, font=f2, fill=(0, 0, 0)) d.text(((w - tw) / 2, by + bh + int(5 * u)), tag, font=f2, fill=tc) - # fight clock + native simulation rate, top right (2026-11-02 meeting: every game shows its native Hz) + # fight clock + native simulation rate, top right f5 = _font(max(9, int(12 * u)), True) clock = f"{c.t / FPS:6.1f} s {FPS}Hz" cw5 = d.textlength(clock, font=f5) diff --git a/environments/games/prototype/bossbench/play_server.py b/environments/games/prototype/bossbench/play_server.py index cac72306e935e36518a890130055e7471fb3cfff..2d6d81696ba420543e14af430a84c3324d5f90bd 100644 --- a/environments/games/prototype/bossbench/play_server.py +++ b/environments/games/prototype/bossbench/play_server.py @@ -1,7 +1,7 @@ """Human play server for the Minecraft remake: the real mc4d simulation + ModernGL renderer behind a browser page. - python prototype/bossbench/play_server.py # http://127.0.0.1:8765/ - python prototype/bossbench/play_server.py --port 8770 --open + python games/prototype/bossbench/play_server.py # http://127.0.0.1:8765/ + python games/prototype/bossbench/play_server.py --port 8770 --open Standard library only (http.server on 127.0.0.1). Each browser tab owns one session = one public-interface style environment (bossbench.make(case, obs_mode="symbolic") -> PyCaseEnv -> mc4d.MobFight), so a human packet is decoded diff --git a/environments/games/prototype/bossbench/scope.py b/environments/games/prototype/bossbench/scope.py index 88d05a48cbad3b23b2eac881cc87f6c3c2cb100f..505b223ecfe0cc7749b708dd3a224ba21dd20ac0 100644 --- a/environments/games/prototype/bossbench/scope.py +++ b/environments/games/prototype/bossbench/scope.py @@ -27,12 +27,7 @@ FORMAL_CASES = MappingProxyType({ }) RETIRED_CASES = ("2d/tank_battle", "tank_battle_1v1") -# Public interface eligibility is distinct from membership in a frozen experiment. -# Adding an implementation here never changes FORMAL_CASES or starts training. -# -# 2026-11-02: every case a game registers (BB.CASES in its own JS, or its manifest.json for native games) -# is publicly eligible automatically, so a game can add scenes without editing this file. FORMAL_CASES stays an -# explicit, hand-written list: a new scene never enters the frozen training scope by being discovered. +# Public cases are discovered from registrations. Frozen evaluation cases are listed above. from . import WEB_GAME PUBLIC_WEB_CASES = MappingProxyType({ case_id: {"game": game, "dimension": "2d", "engine": "web"} @@ -51,10 +46,7 @@ POLICY_CASES = MappingProxyType({**FORMAL_CASES, **PUBLIC_WEB_CASES, **PUBLIC_PY key: {'game': value['game'], 'dimension': value['dimension'], 'engine': 'native'} for key, value in NATIVE_CASES.items() }}) -# The benchmark's scene list: every game has exactly six scenes (user 2026-11-10: "add a sixth Hexen scene and remove one Minecraft scene", -# then "remove the Green Brawler"). A retired scene stays registered (bossbench.make, make_policy_env, FORMAL_CASES, frozen -# experiments and old tests keep working); it only leaves what the benchmark lists: lobby, delivery and research pages, -# media and compact checks, and new datasets. List pages and tools from BENCH_CASES, not from POLICY_CASES. +# Retired cases retain their IDs for replay compatibility and are omitted from the benchmark registry. BENCH_RETIRED = frozenset({ "3d/minecraft_zombie", # Minecraft had 7; its tier calibration is the separate 3d/minecraft_zombie_leader }) diff --git a/environments/games/prototype/bossbench/skin.py b/environments/games/prototype/bossbench/skin.py deleted file mode 100644 index c43c89ea8e57c5953d6910dfca1df48ea19a2a78..0000000000000000000000000000000000000000 --- a/environments/games/prototype/bossbench/skin.py +++ /dev/null @@ -1,263 +0,0 @@ -"""Rendering adapters. None of this participates in judging: a renderer reads case.state() -and nothing it computes may flow back into the simulation (architecture rule 1). - - raster numpy, no GPU -> render() default for 2D - gl moderngl instanced boxes -> render() default for 3D - godot the Godot client in skin/project, driven over a socket or by frame dumping - -Use: - from bossbench import skin - skin.shoot("3d/minecraft_iron_golem", "shots/golem", agent=my_policy) # PNG via Godot - with skin.GodotRenderer(env): # env.render() now returns Godot pixels - frame = env.render() # 480x854x3 uint8, same contract - with skin.GodotPlayer(env): # live window you can play in - env.step(...) -""" -from __future__ import annotations - -import json -import os -import shutil -import socket -import subprocess -import sys - -import numpy as np - -HERE = os.path.dirname(os.path.abspath(__file__)) -ROOT = os.path.dirname(HERE) -PROJECT = os.path.join(ROOT, "skin", "project") -from .core import FPS, RES - -GODOT = os.path.join(ROOT, "..", "tools", "Godot_v4.4.1-stable_win64_console.exe") - - -def _plain(o): - """numpy scalars / arrays -> json-native.""" - if isinstance(o, np.bool_): - return bool(o) - if isinstance(o, np.integer): - return int(o) - if isinstance(o, np.floating): - return float(o) - if isinstance(o, np.ndarray): - return o.tolist() - raise TypeError(type(o)) - - -def dumps(obj) -> str: - return json.dumps(obj, default=_plain, separators=(",", ":")) - - -def scene_msg(case) -> dict: - """Everything static about the case, sent once. Enough for the client to build the world.""" - msg = {"cmd": "scene", "case": case.name, "arena": {}} - H = getattr(case.arena, "H", None) # 3D voxel heightmap - if H is not None: - msg["arena"]["terrain"] = {f"{x},{z}": int(h) for (x, z), h in np.ndenumerate(H)} - else: - raise ValueError("This historical Godot skin supports Minecraft terrain only") - return msg - - -def frame_msg(env) -> dict: - c = env.case - return {"cmd": "frame", "tick": c.t, "t": c.t / FPS, **c.state(), "skin": skin_hints(c)} - - -def skin_hints(case) -> dict: - """Drawing-only facts that case.state() leaves out (facing, hit flicker, max HP). - - Read-only like everything else here; the client uses them for pose and tint, never for rules. - """ - body, boss = case.body, case.boss - h = {"body_iframes": int(getattr(body, "iframes", 0)), "boss_iframes": int(getattr(boss, "iframes", 0)), - "body_max_hp": float(getattr(body, "max_hp", 1)), "boss_max_hp": float(getattr(boss, "max_hp", 1))} - if hasattr(boss, "e"): # voxel entities carry a yaw - h["boss_yaw_deg"] = round(float(np.degrees(boss.e.yaw)), 1) - if hasattr(body, "since_swing"): - h["body_swing"] = body.since_swing < 0.2 * FPS - return h - - -def rollout_frames(case_name, seed=0, d=0.5, agent=None, max_steps=6000, every=4, **env_kw): - """Run one episode in Python and return the frame messages a client needs to draw it.""" - if agent is None: - raise ValueError("rollout_frames requires an explicit policy; no implicit demo agent") - import bossbench - env = bossbench.make(case_name, difficulty=d, **env_kw) - obs, info = env.reset(seed=seed) - msgs = [scene_msg(env.case)] - for _ in range(max_steps): - obs, r, term, trunc, info = env.step(agent(env, obs, info)) - if env.case.t % every == 0: - msgs.append(frame_msg(env)) - if term or trunc: - break - msgs.append({"cmd": "bye", "outcome": env.case.outcome() or "timeout"}) - return env, msgs - - -def godot_binary() -> str: - found = shutil.which("godot") - if found: - return found - if os.path.exists(GODOT): - return GODOT - raise FileNotFoundError( - "Godot not found: put godot on PATH, or unzip Godot 4.4 into BossBench/tools/.") - - -def shoot(case_name, out_dir="shots", seed=0, d=0.5, agent=None, every=4, **env_kw): - """Render one episode with the Godot client and write out_dir/frame_%04d.png.""" - env, msgs = rollout_frames(case_name, seed=seed, d=d, agent=agent, every=every, **env_kw) - out_dir = os.path.abspath(out_dir) - os.makedirs(out_dir, exist_ok=True) - for f in os.listdir(out_dir): # stale frames from a longer episode - if f.startswith("frame_") and f.endswith(".png"): - os.remove(os.path.join(out_dir, f)) - tmp = out_dir + ".frames.json" - with open(tmp, "w") as f: - f.write(dumps(msgs)) - cmd = [godot_binary(), "--path", PROJECT, "--resolution", f"{RES[0]}x{RES[1]}", - "--", "--shot", tmp, "--out", out_dir] - r = subprocess.run(cmd, capture_output=True, text=True, timeout=900) - if r.returncode != 0: - sys.stderr.write(r.stdout[-2000:] + r.stderr[-2000:]) - raise RuntimeError(f"godot exited {r.returncode}") - os.remove(tmp) - return env.verifier(), sorted( - os.path.join(out_dir, f) for f in os.listdir(out_dir) if f.endswith(".png")) - - -class GodotPlayer: - """Server side of the live link: serves case.state() and applies the client's action. - - The client is a display only; it never advances the world. With time_mode="paused" the - simulation waits in step() until the client sends an action, so the window runs at - whatever rate the renderer manages. - """ - - def __init__(self, env, host="127.0.0.1", port=8765, timeout=30.0, launch=True): - self.env, self.host, self.port, self.timeout = env, host, port, timeout - self.launch, self.srv, self.conn, self.buf, self.client = launch, None, None, "", None - - def __enter__(self): - self.srv = socket.socket() - self.srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - self.srv.bind((self.host, self.port)) - self.srv.listen(1) - self.srv.settimeout(self.timeout) - if self.launch: - print(f"launching skin client (godot --path {PROJECT} -- --port {self.port})") - self.client = subprocess.Popen( - [godot_binary(), "--path", PROJECT, "--resolution", f"{RES[0]}x{RES[1]}", - "--", "--host", self.host, "--port", str(self.port)], - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - self.conn, _ = self.srv.accept() - self.conn.settimeout(self.timeout) - self.send(scene_msg(self.env.case)) - return self - - def __exit__(self, *exc): - try: - self.send({"cmd": "bye", "outcome": self.env.case.outcome() or "quit"}) - self.conn.close() - self.srv.close() - finally: - if self.client: - self.client.terminate() - - def send(self, obj): - self.conn.sendall((dumps(obj) + "\n").encode()) - - def recv(self): - while "\n" not in self.buf: - chunk = self.conn.recv(4096) - if not chunk: - raise ConnectionError("skin client disconnected") - self.buf += chunk.decode() - line, self.buf = self.buf.split("\n", 1) - return json.loads(line) - - def play(self, action_fn, max_steps=100000): - """action_fn(info, state) -> action; the client's input is used when it returns None.""" - obs, info = self.env.reset(seed=0) - self.send(frame_msg(self.env)) - for _ in range(max_steps): - act = action_fn(info) if action_fn else None - if act is None: - act = self.recv()["act"] - obs, r, term, trunc, info = self.env.step(np.array(act)) - self.send(frame_msg(self.env)) - if term or trunc: - break - return self.env.verifier() - - -class GodotRenderer: - """env.render() backend: Python sends case.state(), Godot draws it and returns the 480p frame. - - Judging is untouched -- the sim never waits on, or reads, anything but the frame it asked for. - One Godot process per env; the scene is re-sent whenever the env has been reset. - """ - - def __init__(self, env, host="127.0.0.1", port=0, timeout=30.0, offscreen=True): - self.env, self.host, self.port, self.timeout, self.offscreen = env, host, port, timeout, offscreen - self.proc = self.conn = self.srv = None - self.buf, self.episode = b"", None - - def __enter__(self): - self.srv = socket.socket() - self.srv.bind((self.host, self.port)) - self.srv.listen(1) - self.srv.settimeout(self.timeout) - port = self.srv.getsockname()[1] - cmd = [godot_binary(), "--path", PROJECT, "--resolution", f"{RES[0]}x{RES[1]}"] - if self.offscreen: # a real window (pixels need one), parked off-screen - cmd += ["--position", "-10000,-10000"] - self.proc = subprocess.Popen(cmd + ["--", "--host", self.host, "--port", str(port), "--serve"], - stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - self.conn, _ = self.srv.accept() - self.conn.settimeout(self.timeout) - self.conn.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) - self.env.renderer = self - return self - - def __exit__(self, *exc): - self.env.renderer = None - for s in (self.conn, self.srv): - if s: - s.close() - if self.proc: - self.proc.terminate() - self.proc.wait(10) - - def _read(self, n): - while len(self.buf) < n: - chunk = self.conn.recv(1 << 20) - if not chunk: - raise ConnectionError("Godot renderer disconnected") - self.buf += chunk - out, self.buf = self.buf[:n], self.buf[n:] - return out - - def _line(self): - while b"\n" not in self.buf: - chunk = self.conn.recv(1 << 16) - if not chunk: - raise ConnectionError("Godot renderer disconnected") - self.buf += chunk - line, self.buf = self.buf.split(b"\n", 1) - return json.loads(line) - - def __call__(self, env): - out = [] - if self.episode != env.episode: - out.append(scene_msg(env.case)) - self.episode = env.episode - out.append({**frame_msg(env), "want_pixels": True}) - self.conn.sendall("".join(dumps(m) + "\n" for m in out).encode()) - head = self._line() - img = np.frombuffer(self._read(head["pixels"]), np.uint8).reshape(head["h"], head["w"], 3) - return img.copy() diff --git a/environments/games/prototype/bossbench/tiers.py b/environments/games/prototype/bossbench/tiers.py index 3f2bac048f26e14485139333477d4f0ca48b52a8..800a6042c91ad5fb06a69a2195c9a7a91ecca7d1 100644 --- a/environments/games/prototype/bossbench/tiers.py +++ b/environments/games/prototype/bossbench/tiers.py @@ -1,8 +1,6 @@ -"""Three public difficulty tiers shared by every BossBench game (2026-11-02). +"""Three public difficulty tiers shared by every BossBench game. -The meeting decision is that the standard evaluation interface exposes only three tiers — easy / normal / -hard — instead of a scattering of per-parameter knobs. The continuous `difficulty` in [0, 1] stays underneath -for anyone who needs fine control, so this module is a naming and calibration layer, not a new mechanic. +The standard interface takes one of three named tiers. Use continuous difficulty for finer control. env.reset(seed=1, options={"tier": "easy"}) # public: one of three tiers env.reset(seed=1, options={"difficulty": 0.37}) # still allowed: direct continuous control @@ -17,11 +15,6 @@ page and this public interface all read one source of truth: A game that declares nothing uses DEFAULT_TIERS. Passing both `tier` and `difficulty` is rejected, so a recording can never be ambiguous about which one produced it. -Acceptance targets agreed in the meeting (measured with the game's standard scripted controller): - - easy the reference script finishes in 20-30 s, boss health around the 500 mark - normal about 1 minute - hard about 3 minutes """ from __future__ import annotations @@ -34,7 +27,7 @@ TIER_NAMES = ("easy", "normal", "hard") DEFAULT_TIERS = MappingProxyType({"easy": 0.2, "normal": 0.5, "hard": 0.8}) TIERS = DEFAULT_TIERS # backwards-compatible name -# Scripted-controller completion windows, in seconds, from the 2026-11-02 meeting. +# Reference-controller completion windows in seconds. TARGET_SECONDS = MappingProxyType({ "easy": (20.0, 30.0), "normal": (45.0, 90.0), @@ -99,6 +92,6 @@ def tier_of(difficulty, declared=None, tolerance=1e-9): def within_target(tier, seconds): - """True when a scripted run's duration falls inside the meeting's window for that tier.""" + """True when a scripted run's duration falls inside the reference-controller window for that tier.""" low, high = TARGET_SECONDS[tier] return low <= float(seconds) <= high diff --git a/environments/games/prototype/bossbench/webenv.py b/environments/games/prototype/bossbench/webenv.py index 2130f44dd8286e7b2cb0011a91bd2e011d2511c5..53369d7934bd7d37d05563207d2ad55eb634723b 100644 --- a/environments/games/prototype/bossbench/webenv.py +++ b/environments/games/prototype/bossbench/webenv.py @@ -8,8 +8,7 @@ This module drives it through web/engine/bridge.js over one of two transports: browser a headless Chromium page (Playwright) with the game's scripts + renderer loaded; needed for obs_mode="rgb". BB_CHANNEL=msedge|chrome picks an installed browser instead of Playwright's own build. -transport="auto" picks browser for rgb and node otherwise. The rules are the same files either way, so -the two transports produce identical trajectories (tests/unified_env.py checks this). +transport="auto" picks browser for rgb and node otherwise. Both transports load the same game rules. """ from __future__ import annotations diff --git a/environments/games/prototype/bossbench_llm/prompts/games/battlecity_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/battlecity_remake.json index fe28fef35a95bc34c0f84b70aa43f144bd5e340a..ddfd8e1665b512395c5433ca20c2131c95ce5956 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/battlecity_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/battlecity_remake.json @@ -419,12 +419,5 @@ } ] } - ], - "sources": [ - "web/games/battlecity_remake/game.js" - ], - "uncertain": [ - "Enemy counts, lives, and pursuit times for the three difficulties come from supplied materials and were not checked individually against code.", - "The scenes have no named bosses; boss names are descriptive names for the arenas." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/cuphead_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/cuphead_remake.json index 7f87f8abfe20ba263fab2bff21865954794ccbd3..8bd489a792923a81944ee50c8eb297717ecc16af 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/cuphead_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/cuphead_remake.json @@ -664,10 +664,5 @@ } ] } - ], - "sources": [], - "uncertain": [ - "Per-fight time limit is not stated in the sources, so goal gives no number.", - "Compact sub-step timings come from the extracted note, not re-verified in code." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/doom_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/doom_remake.json index cf3f2477d0daea3a6930d7175d1716c101aeb4d2..b70c709cd2eb18cc79298ad8da7db223450650a3 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/doom_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/doom_remake.json @@ -425,15 +425,5 @@ ], "phases": [] } - ], - "sources": [ - "web/games/doom_remake/game.js", - "web/games/doom_remake/README.md", - "web/games/doom_remake/manifest.json" - ], - "uncertain": [ - "Damage values and ranges are described qualitatively from code; exact weapon fire intervals were not checked.", - "Pickup respawn was read from the README only; stated as single-use by analogy with other scenes.", - "Simulation runs at 60 Hz with the original 35 Hz timing kept in seconds (doom-arena@11, game.js header); timings in this file are in seconds." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/genshin_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/genshin_remake.json index 25aca318272f94660ca48b57bf418db7394f69b6..d745224ef476bbf81db7c0a7b98140c3a7734f38 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/genshin_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/genshin_remake.json @@ -1210,18 +1210,5 @@ } ] } - ], - "sources": [ - "web/games/genshin_remake/manifest.json", - "web/games/genshin_remake/game.js", - "web/games/genshin_remake/boss_andrius.js", - "web/games/genshin_remake/boss_kenki.js", - "web/games/genshin_remake/boss_signora.js", - "web/games/genshin_remake/README.md" - ], - "uncertain": [ - "On-screen move wind-up times are approximations converted from tick counts.", - "Move details for the floating array, cannon-backed giant, and tidal-pool summoner come from game.js values and the README; their visual behavior has not been checked individually.", - "Some move damage types and specific elements have not been verified item by item." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/hexen2_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/hexen2_remake.json index 702b60e965ec0810ee3d8e5b9436723ea27978dc..121d59b39934fca3640d44fdb8ee3b7040c2e50c 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/hexen2_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/hexen2_remake.json @@ -607,16 +607,5 @@ } ] } - ], - "sources": [ - "web/games/hexen2_remake/README.md", - "web/games/hexen2_remake/game.js", - "web/games/hexen2_remake/telegraph.js (T.praevus)" - ], - "uncertain": [ - "REPRODUCTION_SPEC is an empty template. Moves come from source notes and numeric values are only approximate.", - "Move damage scales with difficulty; the exact values are not listed here.", - "The wind-up table for each rider has not been checked item by item.", - "Scene 6 (star_volley_sorcerer) follows telegraph.js T.praevus; easy has four easy-only changes (shorter recharge invulnerability, 0.5 s teleport, 8 s entry protection) that the prompt does not spell out." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/hollowknight_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/hollowknight_remake.json index 8970714546c416d27f77f8c5e0bf39fabb36192e..91fb5d1c0b386d9b9a74d4678d20b60f9bba4314 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/hollowknight_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/hollowknight_remake.json @@ -989,14 +989,5 @@ } ] } - ], - "sources": [ - "web/games/hollowknight_remake/game.js" - ], - "uncertain": [ - "All moves come from the engine-exported move table; the timing values have not been checked against code item by item.", - "Move timings come from the engine skill table and were not re-checked against code.", - "The berserker plunge stab duration of roughly 0.9 s is estimated by adding 0.58 s and 0.35 s.", - "The roughly 0.9 s for the berserker's plunge stab is summed from 0.58 + 0.35 s." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/isaac_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/isaac_remake.json index 74bc7b9895227b33917f4d331f2fdc28d09b71b9..10a1ecc2811396ae15d2876adc6666b5498a5366 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/isaac_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/isaac_remake.json @@ -530,12 +530,5 @@ } ] } - ], - "sources": [ - "web/games/isaac_remake/game.js" - ], - "uncertain": [ - "Moves taken from the spec section 5 without re-reading game.js attack functions line by line; timings are approximate.", - "Exact bomb damage and passive item set per scene are not stated to the model." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/kirby_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/kirby_remake.json index 91c7d5fbb54269e3a7e77e90199deccd4378e3c4..daac04e1fdfcfc40cafb76ed30ea6b7c74030b0e 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/kirby_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/kirby_remake.json @@ -504,12 +504,5 @@ } ] } - ], - "sources": [ - "web/games/kirby_remake/game.js" - ], - "uncertain": [ - "Twins scene source lists only the push move; the door-change entry is inferred from the cue and not verified", - "Which moves are expert-only is taken from the 'Extra Game' labels in the extracted skill table" ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/kof_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/kof_remake.json index c860b9cdd5208e73883786fc28f7e2e785c03eef..8236574c70bee4ab20c730e6e41370757ddb225b 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/kof_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/kof_remake.json @@ -807,11 +807,5 @@ } ] } - ], - "sources": [ - "web/games/kof_remake/compact_actions.json" - ], - "uncertain": [ - "Exact damage and gauge values are not given; the number of opponents in a match varies with difficulty." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/mario64_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/mario64_remake.json index d58ecbe83a7ef13b4900ef6a7dcdd415a51c50b0..b9ba6c2a25d947a961a6efc4cc1cc419d711b1fe 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/mario64_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/mario64_remake.json @@ -642,13 +642,5 @@ } ] } - ], - "sources": [ - "web/games/mario64_remake/game.js" - ], - "uncertain": [ - "REPRODUCTION_SPEC.md states sm64-bosses@2; rules taken from game.js (@5)", - "Hit counts, speeds and damage vary by tier and are not stated numerically", - "Eyerok and Wiggler move descriptions are summarised from code state names; exact damage per hit not verified" ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/megaman_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/megaman_remake.json index af7e347fb54a240c7ab8bf569c55e29f9ff4319c..710c81ae04b09b64858a579354d58151099c3606 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/megaman_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/megaman_remake.json @@ -513,12 +513,5 @@ } ] } - ], - "sources": [ - "web/games/megaman_remake/game.js" - ], - "uncertain": [ - "Specific weapon-versus-boss weakness damage values were not verified.", - "stand_down in the fire scene is a quirk copied from the extracted skill table." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/minecraft.json b/environments/games/prototype/bossbench_llm/prompts/games/minecraft.json index e4c8a40e1d15010fbefa0190c19819ad2d32a290..6ffd4694234a8b4177fb674168b2cf73f8489dd8 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/minecraft.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/minecraft.json @@ -444,13 +444,5 @@ ], "phases": [] } - ], - "sources": [ - "web/games/minecraft_remake/manifest.json", - "web/games/minecraft_remake/compact_actions.json" - ], - "uncertain": [ - "Exact time limit per fight not in the extracted sources, so goal gives no number.", - "The 'chase' move for the Hurling Brute is inferred from general behaviour, not from the skills table." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/nfsmw_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/nfsmw_remake.json index 9f1accafa2c3bf05ffdc0674afb593ae9e078382..d8f59415fd27e2a711a905ae4b8f803d34c90422 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/nfsmw_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/nfsmw_remake.json @@ -515,19 +515,5 @@ } ] } - ], - "sources": [ - "web/games/nfsmw_remake/README.md", - "web/games/nfsmw_remake/manifest.json", - "web/games/nfsmw_remake/modes_tollbooth.js", - "web/games/nfsmw_remake/modes_drag.js", - "web/games/nfsmw_remake/modes_speedtrap.js", - "web/games/nfsmw_remake/modes_knockout.js", - "web/games/nfsmw_remake/modes_pursuit.js", - "web/games/nfsmw_remake/cops.js" - ], - "uncertain": [ - "The manifest and game.js use rule version nfsmw-arena@2; the task brief says @1. This file follows the manifest.", - "The heat levels at which helicopters appear, the police configuration in the champion event, and traffic appearing only at normal and hard difficulty in knockout races were read from code and not independently verified." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/quake2_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/quake2_remake.json index 08f4d8579d024acc9fe76e8d456cf8e6c95cdc47..c0d53e45ef5c403cc1f0cbfeeaeca98ccda207f4 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/quake2_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/quake2_remake.json @@ -455,14 +455,5 @@ ], "phases": [] } - ], - "sources": [ - "web/games/quake2_remake/game.js (controls, arenas, health table)", - "web/games/quake2_remake/q2monsters.js (moves frame tables)", - "web/games/quake2_remake/README.md, draw.js (HUD strings)", - "web/games/quake2_remake/compact_actions.json" - ], - "uncertain": [ - "The quake2/makron scene is a two-boss fight (mech then pilot); it is listed as one scene with both phases' moves." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/sekiro_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/sekiro_remake.json index ffd561fffd3b72bd7919f3185a519df8ce358416..c39ee8d88f2cfb88ee27ce4e450f97d4668f0e38 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/sekiro_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/sekiro_remake.json @@ -1004,14 +1004,5 @@ } ] } - ], - "sources": [ - "web/games/sekiro_remake/README.md", - "web/games/sekiro_remake/game.js", - "web/games/sekiro_remake/manifest.json" - ], - "uncertain": [ - "Move names and timing for the old-master and mounted-general bosses are summarised from game.js tables and README; exact damage values not stated.", - "Execution counts per bar are approximate (README lists 2-4 per boss)." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/soulknight_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/soulknight_remake.json index 267c802b9b025d31e21d661c14ed9b1cfd0ff179..2440d48a8e491e6d72167cd45fcd65f7ad9c95b0 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/soulknight_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/soulknight_remake.json @@ -648,13 +648,5 @@ } ] } - ], - "sources": [ - "web/games/soulknight_remake/game.js (controls; POOLS; ATTACKS comments)", - "web/games/soulknight_remake/README.md (controls, rules, enrage, rooms)", - "web/games/soulknight_remake/compact_actions.json" - ], - "uncertain": [ - "Move descriptions condensed from the attack-script comments in game.js; exact bullet counts and timings are left out on purpose." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/terraria_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/terraria_remake.json index b66afa2c4f2b45c8583661386e885c778cafd6cc..66e21dc1cb9f438980b756f09e8fd41066168b4a 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/terraria_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/terraria_remake.json @@ -458,14 +458,5 @@ } ] } - ], - "sources": [ - "web/games/terraria_remake/specs/*.yaml (moves: cue / punish / damage, = Case.manual().skills)", - "web/games/terraria_remake/body_adventurer.js (P.keys, P.manual)", - "web/games/terraria_remake/README.md (controls, mechanics, win conditions)", - "web/tools/action_labels.json" - ], - "uncertain": [ - "Expert-only moves are tagged with `only`; the three public tiers (d 0.2/0.5/0.7) are all Classic, so they do not appear there." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/tombraider_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/tombraider_remake.json index 986ae6ba44743cc3eac60c060fb40c5b1510a2c7..a16a1b07db8771076f79df124ba97510b638a999 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/tombraider_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/tombraider_remake.json @@ -495,15 +495,5 @@ } ] } - ], - "sources": [ - "web/games/tombraider_remake/README.md", - "web/games/tombraider_remake/game.js" - ], - "uncertain": [ - "Mouse steering is still pending a decision; this describes current game.js behaviour.", - "The quadruped's level location and count are unverified.", - "Move timings come from code constants and are approximate.", - "Stage split and faint length come from source rules and are not shown on screen." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/touhou_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/touhou_remake.json index e9de94b89af998531de6a6523248f44840b2c5c0..eb3442ab606eac645c55719c8c60580e8d84d4e2 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/touhou_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/touhou_remake.json @@ -806,14 +806,5 @@ } ] } - ], - "sources": [ - "web/games/touhou_remake/game.js", - "web/games/touhou_remake/README.md", - "web/games/touhou_remake/manifest.json" - ], - "uncertain": [ - "Most spell-card projectile shapes, speeds, and counts were reconstructed from written sources and code structure; visual details may differ slightly.", - "Patchouli and Remilia spell cards lack written sources. Their descriptions rely mainly on move names and code; verify against the game screen." ] } diff --git a/environments/games/prototype/bossbench_llm/prompts/games/zelda_oot_remake.json b/environments/games/prototype/bossbench_llm/prompts/games/zelda_oot_remake.json index e56661d32e91302f9406d1ba9edb9cbc68a500d1..8033d0b697136727d9ec68d8da0d53b62f78b73c 100644 --- a/environments/games/prototype/bossbench_llm/prompts/games/zelda_oot_remake.json +++ b/environments/games/prototype/bossbench_llm/prompts/games/zelda_oot_remake.json @@ -587,12 +587,5 @@ } ] } - ], - "sources": [ - "web/games/zelda_oot_remake/manifest.json" - ], - "uncertain": [ - "Items in each scene and some phase transitions were inferred from the telegraph table and have not been checked against boss code.", - "Per-scene items and some phase changes were not checked against boss code; they come from the telegraph table and inference." ] } diff --git a/environments/games/prototype/bossbench_llm/run.py b/environments/games/prototype/bossbench_llm/run.py index eb303e8706b6a8dd7ee6c92ac1270521920ea964..9262fa0fbb244203058ca83ec0e14161182a8892 100644 --- a/environments/games/prototype/bossbench_llm/run.py +++ b/environments/games/prototype/bossbench_llm/run.py @@ -5,10 +5,9 @@ semantic JSON) -> executed in the game. Default time mode is `paused`: the game not depend on inference speed and every run is replayable. `realtime`: every full 200 ms the model takes inserts one empty 200 ms window before its action (latency under 200 ms costs nothing). -Examples (run from the package root with PYTHONPATH=prototype): - python -m bossbench_llm.run --case terraria/king_slime --tier easy --seeds 1-3 --format lumine --lang zh \ +Examples (run from the package root with PYTHONPATH=games/prototype): + python -m bossbench_llm.run --case terraria/king_slime --tier easy --seeds 1-3 --format lumine --lang en \ --policy chat --base-url http://127.0.0.1:8000/v1 --model my-model - python -m bossbench_llm.run --policy replay --replay replays/terraria__king_slime__easy.replay.json # self-test python -m bossbench_llm.run --case terraria/queen_bee --tier easy --format semantic --policy random --max-steps 50 """ from __future__ import annotations diff --git a/environments/games/prototype/bossbench_llm/verify.py b/environments/games/prototype/bossbench_llm/verify.py index 06a54e6b5751350ad895db78a6db4d6e54641e58..7ee7ab60eab51019d455e65ca7df8d7059744fc0 100644 --- a/environments/games/prototype/bossbench_llm/verify.py +++ b/environments/games/prototype/bossbench_llm/verify.py @@ -4,7 +4,7 @@ python -m bossbench_llm.verify replays/*.replay.json Accepts episode folders written by bossbench_llm.run (replay.json or semantic_replay.json inside) and plain -bossbench/policy-replay@1 files (the packaged scripted wins). Also reports source files whose bytes differ from +bossbench/policy-replay@1 files. Also reports source files whose bytes differ from the ones recorded (a different game version), which is the usual reason a replay stops reproducing. """ from __future__ import annotations diff --git a/environments/games/web/engine/case.js b/environments/games/web/engine/case.js index f5a53c327d35f310b05bfaddc3dcb1d9f57cd2da..7bd7434c7fc75108bafbc254b9f29f597cffd0dd 100644 --- a/environments/games/web/engine/case.js +++ b/environments/games/web/engine/case.js @@ -1,5 +1,5 @@ // Case = Arena + Body + Boss stepped at 60 Hz, and the Gym-style env of proposal 4.4 on top of it. -// No DOM here: the same file runs in the browser and in Node (tests/, headless rollouts). +// No DOM here: the same file runs in the browser and in Node. // Game-agnostic: a game registers BB.CASES[id] = {title, Body, Boss} and provides BB.ARENA {W, H}. // Body contract: id, keys {action: 'K1|K2'}, manual [..], NAIL (damage per hit), reset, update(c, input), box, // hurtBox, centre, slashBox() -> {pts, tink, dir} | null, slashHits {}, slashFacing, onSlashContact(c, kind), diff --git a/environments/games/web/engine/sessions.js b/environments/games/web/engine/sessions.js index c5ca244e648b79ac8f41341cdf656435d5603ba9..cf73179e4a174b83ed7163ee35ff287d8ee536aa 100644 --- a/environments/games/web/engine/sessions.js +++ b/environments/games/web/engine/sessions.js @@ -60,11 +60,6 @@ var url=URL.createObjectURL(new Blob([JSON.stringify(run,null,2)],{type:'application/json'})),a=doc.createElement('a');a.href=url;a.download=run.case.replace('/','-')+'-seed'+run.seed+'.json';a.click();setTimeout(function(){URL.revokeObjectURL(url);},1000); }); if($('load-run'))$('load-run').addEventListener('change',async function(){try{var f=this.files[0];if(f){if(f.size>8*1024*1024)throw Error('Replay file exceeds 8 MB.');load(JSON.parse(await f.text()),true);}}catch(e){showError(e);}this.value='';}); - var demos=BB.GAME_REPLAYS||{}; - if($('demo-run')){ - var select=$('demo-run');Object.keys(demos).forEach(function(key){var op=doc.createElement('option'),run=demos[key];op.value=key;op.textContent=BB.CASES[run.case].title+' · '+(run.d==null?'':('d='+run.d))+' · '+(run.verifier&&run.verifier.win?'Winning example':'Recorded replay');select.appendChild(op);}); - select.addEventListener('change',function(){try{if(this.value)load(demos[this.value],true);}catch(e){showError(e);}}); - } if($('replay-toggle'))$('replay-toggle').addEventListener('click',function(){if(active){notice=null;active.playing=!active.playing;acc=0;update();}}); if($('replay-step'))$('replay-step').addEventListener('click',function(){if(!active)return;notice=null;active.playing=false;var end=Math.min((Math.floor(active.frame/12)+1)*12,active.parsed.length*12);while(active.frame