From c657cfb20f7c280a395e08b75b7a45665eefe686 Mon Sep 17 00:00:00 2001 From: hanzy Date: Fri, 20 Nov 2026 13:23:09 +0000 Subject: [PATCH] Add ViZDoom standard benchmark --- .github/workflows/games.yml | 2 +- configs/game_benchmarks.toml | 3 + configs/game_suites/vizdoom-smoke.toml | 15 + configs/game_suites/vizdoom.toml | 60 ++++ .../benchmarks/vizdoom/SOURCE.json | 9 + game_first_exam/benchmarks/vizdoom/adapter.py | 212 ++++++++++++++ .../benchmarks/vizdoom/instance_schema.py | 161 +++++++++++ .../benchmarks/vizdoom/metric_rules.py | 78 +++++ .../benchmarks/vizdoom/requirements.txt | 11 + .../benchmarks/vizdoom/vizdoom_actions.py | 37 +++ .../benchmarks/vizdoom/vizdoom_client.py | 14 + .../benchmarks/vizdoom/vizdoom_server.py | 20 ++ .../images/vizdoom-files/FILES.json | 14 + game_first_exam/images/vizdoom-files/VERSION | 1 + game_first_exam/tasks/vizdoom/README.md | 38 +++ .../vizdoom/vizdoom-basic-i01-standard/DIGEST | 1 + .../vizdoom-basic-i01-standard/README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 43 +++ .../vizdoom-basic-i01-standard/instruction.md | 56 ++++ .../solution/actions.json | 6 + .../solution/solve.sh | 13 + .../vizdoom-basic-i01-standard/task.toml | 59 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 43 +++ .../tests/rcb_limits.json | 26 ++ .../vizdoom-basic-i01-standard/tests/test.sh | 6 + .../DIGEST | 1 + .../README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 43 +++ .../instruction.md | 59 ++++ .../solution/actions.json | 10 + .../solution/solve.sh | 15 + .../task.toml | 59 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 43 +++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../DIGEST | 1 + .../README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 47 ++++ .../instruction.md | 56 ++++ .../solution/actions.json | 74 +++++ .../solution/solve.sh | 15 + .../task.toml | 59 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 47 ++++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../vizdoom-deathmatch-i01-standard/DIGEST | 1 + .../vizdoom-deathmatch-i01-standard/README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 60 ++++ .../instruction.md | 57 ++++ .../solution/actions.json | 24 ++ .../solution/solve.sh | 15 + .../vizdoom-deathmatch-i01-standard/task.toml | 60 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 60 ++++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../vizdoom-defend-center-i01-standard/DIGEST | 1 + .../README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 43 +++ .../instruction.md | 56 ++++ .../solution/actions.json | 14 + .../solution/solve.sh | 15 + .../task.toml | 60 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 43 +++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../vizdoom-defend-line-i01-standard/DIGEST | 1 + .../README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 43 +++ .../instruction.md | 56 ++++ .../solution/actions.json | 18 ++ .../solution/solve.sh | 15 + .../task.toml | 60 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 43 +++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../DIGEST | 1 + .../README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 43 +++ .../instruction.md | 56 ++++ .../solution/actions.json | 22 ++ .../solution/solve.sh | 15 + .../task.toml | 60 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 43 +++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../DIGEST | 1 + .../README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 43 +++ .../instruction.md | 56 ++++ .../solution/actions.json | 22 ++ .../solution/solve.sh | 15 + .../task.toml | 60 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 43 +++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../vizdoom-my-way-home-i01-standard/DIGEST | 1 + .../README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 45 +++ .../instruction.md | 56 ++++ .../solution/actions.json | 52 ++++ .../solution/solve.sh | 13 + .../task.toml | 59 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 45 +++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../DIGEST | 1 + .../README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 43 +++ .../instruction.md | 56 ++++ .../solution/actions.json | 10 + .../solution/solve.sh | 15 + .../task.toml | 59 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 43 +++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../vizdoom-take-cover-i01-standard/DIGEST | 1 + .../vizdoom-take-cover-i01-standard/README.md | 35 +++ .../environment/Dockerfile | 14 + .../environment/docker-compose.yaml | 43 +++ .../environment/rcb_monitor/limits.json | 26 ++ .../environment/sim/Dockerfile | 18 ++ .../environment/sim/instance.json | 42 +++ .../instruction.md | 56 ++++ .../solution/actions.json | 14 + .../solution/solve.sh | 15 + .../vizdoom-take-cover-i01-standard/task.toml | 60 ++++ .../tests/Dockerfile | 11 + .../tests/instance.json | 42 +++ .../tests/rcb_limits.json | 26 ++ .../tests/test.sh | 6 + .../tests/benchmarks/vizdoom/exported.toml | 57 ++++ game_first_exam/tests/envs/vizdoom.Dockerfile | 6 + game_first_exam/tests/run.sh | 3 + game_first_exam/tests/test_game_harbor.py | 27 +- game_first_exam/tests/test_vizdoom.py | 266 ++++++++++++++++++ scripts/game_harbor.py | 4 +- scripts/game_preflight.py | 16 +- scripts/game_reports.py | 91 ++++-- scripts/game_schemas.py | 14 + scripts/task_conventions.py | 22 +- scripts/task_resources.toml | 6 + 191 files changed, 5827 insertions(+), 32 deletions(-) create mode 100644 configs/game_suites/vizdoom-smoke.toml create mode 100644 configs/game_suites/vizdoom.toml create mode 100644 game_first_exam/benchmarks/vizdoom/SOURCE.json create mode 100644 game_first_exam/benchmarks/vizdoom/adapter.py create mode 100644 game_first_exam/benchmarks/vizdoom/instance_schema.py create mode 100644 game_first_exam/benchmarks/vizdoom/metric_rules.py create mode 100644 game_first_exam/benchmarks/vizdoom/requirements.txt create mode 100644 game_first_exam/benchmarks/vizdoom/vizdoom_actions.py create mode 100644 game_first_exam/benchmarks/vizdoom/vizdoom_client.py create mode 100644 game_first_exam/benchmarks/vizdoom/vizdoom_server.py create mode 100644 game_first_exam/images/vizdoom-files/FILES.json create mode 100644 game_first_exam/images/vizdoom-files/VERSION create mode 100644 game_first_exam/tasks/vizdoom/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/test.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/DIGEST create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/README.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/docker-compose.yaml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/rcb_monitor/limits.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/sim/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/sim/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/instruction.md create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/solution/actions.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/solution/solve.sh create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/task.toml create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/Dockerfile create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/instance.json create mode 100644 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/rcb_limits.json create mode 100755 game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/test.sh create mode 100644 game_first_exam/tests/benchmarks/vizdoom/exported.toml create mode 100644 game_first_exam/tests/envs/vizdoom.Dockerfile create mode 100644 game_first_exam/tests/test_vizdoom.py diff --git a/.github/workflows/games.yml b/.github/workflows/games.yml index ebee4f6..e1dc10e 100644 --- a/.github/workflows/games.yml +++ b/.github/workflows/games.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - benchmark: [common, minigrid, crafter, textworld, babaisai, minihack] + benchmark: [common, minigrid, crafter, textworld, babaisai, minihack, vizdoom] steps: - uses: actions/checkout@v4 with: {persist-credentials: false} diff --git a/configs/game_benchmarks.toml b/configs/game_benchmarks.toml index 8f77b59..5c97e69 100644 --- a/configs/game_benchmarks.toml +++ b/configs/game_benchmarks.toml @@ -14,3 +14,6 @@ schema = "game_first_exam/benchmarks/babaisai/instance_schema.py" [benchmarks.minihack] schema = "game_first_exam/benchmarks/minihack/instance_schema.py" + +[benchmarks.vizdoom] +schema = "game_first_exam/benchmarks/vizdoom/instance_schema.py" diff --git a/configs/game_suites/vizdoom-smoke.toml b/configs/game_suites/vizdoom-smoke.toml new file mode 100644 index 0000000..aa55274 --- /dev/null +++ b/configs/game_suites/vizdoom-smoke.toml @@ -0,0 +1,15 @@ +schema_version = "game-suite/2.1" +version = "1.3.0" +tier = "smoke" +name = "games-vizdoom-smoke-v1.3.0" +files_images = ["connection-files", "game-files", "vizdoom-files"] + +[[tasks]] +name = "vizdoom-basic-i01-standard" +benchmark = "vizdoom" +family = "basic" + +[[tasks]] +name = "vizdoom-my-way-home-i01-standard" +benchmark = "vizdoom" +family = "my-way-home" diff --git a/configs/game_suites/vizdoom.toml b/configs/game_suites/vizdoom.toml new file mode 100644 index 0000000..e8cc5df --- /dev/null +++ b/configs/game_suites/vizdoom.toml @@ -0,0 +1,60 @@ +schema_version = "game-suite/2.1" +version = "1.1.0" +tier = "evaluation" +name = "games-vizdoom-v1.1.0" +files_images = ["connection-files", "game-files", "vizdoom-files"] + +[[tasks]] +name = "vizdoom-basic-i01-standard" +benchmark = "vizdoom" +family = "basic" + +[[tasks]] +name = "vizdoom-my-way-home-i01-standard" +benchmark = "vizdoom" +family = "my-way-home" + +[[tasks]] +name = "vizdoom-basic-notifications-i01-standard" +benchmark = "vizdoom" +family = "basic-notifications" + +[[tasks]] +name = "vizdoom-predict-position-i01-standard" +benchmark = "vizdoom" +family = "predict-position" + +[[tasks]] +name = "vizdoom-deadly-corridor-i01-standard" +benchmark = "vizdoom" +family = "deadly-corridor" + +[[tasks]] +name = "vizdoom-defend-center-i01-standard" +benchmark = "vizdoom" +family = "defend-center" + +[[tasks]] +name = "vizdoom-defend-line-i01-standard" +benchmark = "vizdoom" +family = "defend-line" + +[[tasks]] +name = "vizdoom-take-cover-i01-standard" +benchmark = "vizdoom" +family = "take-cover" + +[[tasks]] +name = "vizdoom-health-gathering-i01-standard" +benchmark = "vizdoom" +family = "health-gathering" + +[[tasks]] +name = "vizdoom-health-gathering-supreme-i01-standard" +benchmark = "vizdoom" +family = "health-gathering-supreme" + +[[tasks]] +name = "vizdoom-deathmatch-i01-standard" +benchmark = "vizdoom" +family = "deathmatch" diff --git a/game_first_exam/benchmarks/vizdoom/SOURCE.json b/game_first_exam/benchmarks/vizdoom/SOURCE.json new file mode 100644 index 0000000..6d747f4 --- /dev/null +++ b/game_first_exam/benchmarks/vizdoom/SOURCE.json @@ -0,0 +1,9 @@ +{ + "repository": "https://github.com/Farama-Foundation/ViZDoom", + "version": "1.3.2", + "commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "linux_x86_64_cp312_wheel_sha256": "d3f8fa01d9df31bccb9d9ccad2e03d139c1a2713ddd9152acc601f020bf2be75", + "asset_source": "Unmodified official wheel, using its freedoom2.wad as the IWAD", + "vizdoom_license": "https://github.com/Farama-Foundation/ViZDoom/tree/1.3.2#license", + "freedoom_license": "https://github.com/freedoom/freedoom/blob/master/COPYING.adoc" +} diff --git a/game_first_exam/benchmarks/vizdoom/adapter.py b/game_first_exam/benchmarks/vizdoom/adapter.py new file mode 100644 index 0000000..9f76618 --- /dev/null +++ b/game_first_exam/benchmarks/vizdoom/adapter.py @@ -0,0 +1,212 @@ +"""Use the native single-player engine and expose player-facing observations.""" +import hashlib +import importlib.metadata +from pathlib import Path +import re +import tempfile + +import vizdoom as vzd + +from contracts import Transition +from encoding import png, state_hash +from instance_schema import SCENARIOS +from vizdoom_actions import DELTA_BUTTONS, DURATION, dense_pattern + + +class Adapter: + def __init__(self, instance, assets): + self.instance = instance + self.default_tics = instance["tics_per_decision"] + self.variable_tics = self.default_tics == 1 + self.action_tics = [] + for package, expected in instance["engine_versions"].items(): + if importlib.metadata.version(package) != expected: + raise ValueError(f"ViZDoom dependency version mismatch: {package}") + installed = Path(vzd.__file__).resolve().parent + for relative, expected in instance["scenario_hashes"].items(): + if hashlib.sha256((installed / relative).read_bytes()).hexdigest() != expected: + raise ValueError(f"ViZDoom asset mismatch: {relative}") + + family = instance["family"] + scene = SCENARIOS[family] + scenario = scene["stem"] + self.buttons = instance["buttons"] + self.delta_buttons = [button for button in self.buttons if button in DELTA_BUTTONS] + self.binary_buttons = [button for button in self.buttons if button not in DELTA_BUTTONS] + self.actions = [] + if not self.delta_buttons: + for mask in range(1 << len(self.buttons)): + action = "+".join(button for i, button in enumerate(self.buttons) if mask & (1 << i)) + self.actions.append(action or "noop") + + self.goal = scene["goal"] + self.goal_variable = {"kill": vzd.GameVariable.KILLCOUNT, "vest": vzd.GameVariable.ARMOR, + "green-vest": vzd.GameVariable.ARMOR}.get(self.goal) + self.goal_value = 100 if self.goal in ("vest", "green-vest") else 1 + self.stats = scene.get("stats", ()) + self.expose_notifications = instance["observation_profile"] == "rgb-notifications-v1" + self.notifications = "" + self.action_deadline_reached = lambda: False + self.advanced_tics = 0 + self.decisions = 0 + self.native_return = 0.0 + self.terminated = self.truncated = self.player_dead = False + self.goal_progress = 0 + self.game = vzd.DoomGame() + self.config = tempfile.TemporaryDirectory(prefix="vizdoom-session-") + try: + if not self.game.load_config(str(installed / "scenarios" / f"{scenario}.cfg")): + raise ValueError("could not load the frozen ViZDoom scenario") + self.game.set_doom_game_path(str(installed / "freedoom2.wad")) + self.game.set_doom_config_path(str(Path(self.config.name) / "doom.ini")) + self.game.set_seed(instance["seed"]) + self.game.set_mode(vzd.Mode.PLAYER) + self.game.set_window_visible(False) + self.game.set_sound_enabled(False) + self.game.set_screen_format(vzd.ScreenFormat.RGB24) + self.game.set_depth_buffer_enabled(False) + self.game.set_automap_buffer_enabled(False) + self.game.set_labels_buffer_enabled(False) + self.game.set_objects_info_enabled(False) + self.game.set_sectors_info_enabled(False) + self.game.set_audio_buffer_enabled(False) + self.game.set_notifications_buffer_enabled(self.expose_notifications) + if not self.expose_notifications: + self.game.set_notifications_buffer_size(0) + self.game.init() + if ([button.name for button in self.game.get_available_buttons()] != self.buttons or + self.game.get_episode_start_time() != instance["start_tic"] or + self.game.get_episode_timeout() != instance["timeout_tics"] or + self.game.get_episode_time() != instance["start_tic"] or self.game.get_ticrate() != 35 or + self.game.get_total_reward() != 0 or (self.goal_variable is not None and + self.game.get_game_variable(self.goal_variable) != 0)): + raise ValueError("ViZDoom native initialization differs from the frozen scenario") + self._capture() + if self.image is None: + raise ValueError("ViZDoom did not supply an initial frame") + except BaseException: + self.close() + raise + + def _capture(self): + state = self.game.get_state() + if state is None: + if not (self.terminated or self.truncated): + raise ValueError("missing screen during an active ViZDoom episode") + self.image = None + return + frame = state.screen_buffer + if frame.shape != (240, 320, 3) or str(frame.dtype) != "uint8": + raise ValueError("ViZDoom must supply an RGB24 320x240 screen") + self.image = frame.copy() + if self.expose_notifications and state.notifications_buffer: + self.notifications = state.notifications_buffer + + def spec(self): + spec = {"adapter_version": "1.0.0", "capabilities": self.instance["capabilities"], + "screen_width": 320, "screen_height": 240, + "episode_timeout_tics": self.instance["timeout_tics"]} + if self.variable_tics: + spec["default_tics"] = self.default_tics + if self.delta_buttons: + spec["action_schema"] = {"type": "string", "pattern": dense_pattern(self.binary_buttons), + "max_length": 512} + spec["binary_buttons"] = self.binary_buttons + spec["delta_buttons"] = self.delta_buttons + else: + alternatives = "|".join(re.escape(action) for action in self.actions) + spec["action_schema"] = {"type": "string", "pattern": rf"(?:{alternatives}){DURATION}"} + spec["actions"] = self.actions + else: + spec["action_schema"] = {"type": "string", "enum": self.actions} + spec["tics_per_decision"] = self.default_tics + return spec + + def observe(self): + if self.image is None: + return {"frame_available": False} + response = {"frame_available": True, "image_png_base64": png(self.image)} + if self.expose_notifications: + response["notifications"] = self.notifications + return response + + def step(self, action): + controls, _, duration = action.partition("@") + requested = int(duration) if duration and self.variable_tics else self.default_tics + buttons, _, delta = controls.partition("~") + pressed = set(buttons.split("+")) + deltas = dict(zip(self.delta_buttons, map(float, delta.split(",")))) if delta else {} + vector = [deltas.get(button, int(button in pressed)) for button in self.buttons] + if self.terminated or self.truncated: + raise ValueError("ViZDoom episode is closed") + self.decisions += 1 + reward = 0.0 + start = self.advanced_tics + timeout = self.instance["timeout_tics"] + planned = min(requested, timeout - start) if timeout else requested + # Map exit can reset the native absolute clock to zero. Count each + # processed tic while exposing only the final snapshot of the decision. + for _ in range(planned): + increment = self.game.make_action(vector, 1) + reward += increment + self.advanced_tics += 1 + done = self.game.is_episode_finished() + self.truncated = done and self.game.is_episode_timeout_reached() + self.player_dead = done and self.game.is_player_dead() + if self.goal_variable is not None: + progress = int(self.game.get_game_variable(self.goal_variable)) + self.goal_progress = max(self.goal_progress, progress) + elif self.goal == "correct-target" and increment > 0: + # The correct target is the only positive reward event in this WAD. + self.goal_progress = 1 + self.terminated = done and (not self.truncated or self.player_dead or self.success()) + if done: + break + if self.expose_notifications: + state = self.game.get_state() + if state.notifications_buffer: + self.notifications = state.notifications_buffer + if self.game.get_episode_time() != self.instance["start_tic"] + self.advanced_tics: + raise ValueError("ViZDoom tic accounting changed during an active episode") + if self.action_deadline_reached(): + break + if self.variable_tics: + self.action_tics.append([requested, self.advanced_tics - start]) + self.native_return = self.game.get_total_reward() + self._capture() + return Transition(reward, self.terminated, self.truncated) + + def success(self): + return self.goal is not None and self.goal_progress >= self.goal_value + + def metrics(self): + metrics = self._native_metrics() + if self.variable_tics: + metrics["action_tics"] = self.action_tics + return metrics + + def _native_metrics(self): + metrics = {"native_return": self.native_return, "native_tics": self.advanced_tics, + "decisions": self.decisions, "native_terminated": self.terminated, + "native_truncated": self.truncated, "player_dead": self.player_dead} + if self.goal is not None: + metrics.update(objective_success=int(self.success()), objective_progress=self.goal_progress) + metrics.update({variable.lower(): int(self.game.get_game_variable(getattr(vzd.GameVariable, variable))) + for variable in self.stats}) + return metrics + + def fingerprint(self): + frame = hashlib.sha256(self.image.tobytes()).hexdigest() if self.image is not None else None + state = {"screen_sha256": frame, "seed": self.instance["seed"], "metrics": self._native_metrics()} + if self.expose_notifications: + state["notifications"] = self.notifications + return state_hash(state) + + def frame(self): + return self.image + + def close(self): + try: + self.game.close() + finally: + self.config.cleanup() diff --git a/game_first_exam/benchmarks/vizdoom/instance_schema.py b/game_first_exam/benchmarks/vizdoom/instance_schema.py new file mode 100644 index 0000000..7821688 --- /dev/null +++ b/game_first_exam/benchmarks/vizdoom/instance_schema.py @@ -0,0 +1,161 @@ +"""Frozen ViZDoom scenario profiles shared by the host, simulator and verifier.""" +from config_schema import validate_engine_versions + +SCHEMA_VERSION = "1.0.0" +BENCHMARK = "vizdoom" +STANDARD_CLIENT = "vizdoom_client.py" +FIELDS = {"engine_versions", "engine_commit", "scenario_hashes", "start_tic", + "timeout_tics", "tics_per_decision", "buttons"} +METRICS = {"objective_success", "native_return"} +PER_SCENARIO_METRICS = {"native_return"} +PROFILES = {"rgb-first-person-v1", "rgb-notifications-v1"} +REDUCERS = {("family_macro", "1.0.0")} +ENGINE_COMMIT = "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a" +ENGINE_VERSIONS = {"vizdoom": "1.3.2", "numpy": "2.5.5"} +COMMON_ASSETS = { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", +} +SCENARIOS = { + "basic": { + "goal": "kill", "stem": "basic", "start_tic": 14, "timeout_tics": 300, + "buttons": ["MOVE_LEFT", "MOVE_RIGHT", "ATTACK"], + "cfg": "306ce424442279a1e5d98a75c36a900b616c2496dcdac93a2923946049c926e7", + "wad": "fd0b7e5e2422e09288c786e7fc32181bb8ee4a3faa613a75ef88a3e39b5ce94e", + }, + "my-way-home": { + "goal": "green-vest", "stem": "my_way_home", "start_tic": 10, "timeout_tics": 2100, + "buttons": ["TURN_LEFT", "TURN_RIGHT", "MOVE_FORWARD", "MOVE_LEFT", "MOVE_RIGHT"], + "cfg": "3dc0eb5e3557df7918484f91bdc4bc13b78cf67c6a6eaf2052e8ad66cfccbe46", + "wad": "18e98ff4c9186808eb00696b799cfe88a79e7486429c1692aafbed8ef359c0b1", + }, + 'basic-notifications': {'stem': 'basic_notifications', + 'goal': 'correct-target', + 'start_tic': 14, + 'timeout_tics': 300, + 'buttons': ['MOVE_LEFT', 'MOVE_RIGHT', 'ATTACK'], + 'cfg': '172233cb048bcd67a5c112378ced33e270d4b0ad6455be7fac29276dee5a36a6', + 'wad': 'c4b4bdc9c32c1244c080dac9381363f9b70e9bcb87edab3e4feed109b8f7f4ca', + 'observation_profile': 'rgb-notifications-v1'}, + 'predict-position': {'stem': 'predict_position', + 'goal': 'kill', + 'start_tic': 16, + 'timeout_tics': 300, + 'buttons': ['TURN_LEFT', 'TURN_RIGHT', 'ATTACK'], + 'cfg': '5e97217a17d5285d80c9c7351cb69562c5ff005423780c352e5c507951e08f6f', + 'wad': 'a5a1bdbbfdbef2a505b496f6889d06751ba3431a50ec382fb303fcc4066917a6'}, + 'deadly-corridor': {'stem': 'deadly_corridor', + 'goal': 'green-vest', + 'start_tic': 1, + 'timeout_tics': 2100, + 'buttons': ['MOVE_LEFT', + 'MOVE_RIGHT', + 'ATTACK', + 'MOVE_FORWARD', + 'MOVE_BACKWARD', + 'TURN_LEFT', + 'TURN_RIGHT'], + 'cfg': 'b76c53ad90ff27680c4a4655c88dc04458f2d597baac6cec5d38df91ca67c17a', + 'wad': '3c868f88c78df8219a2c41a2695ae04e5a19d60a32f1718282b3bbc7f20951ca'}, + 'defend-center': {'stem': 'defend_the_center', + 'goal': None, + 'start_tic': 10, + 'timeout_tics': 2100, + 'buttons': ['TURN_LEFT', 'TURN_RIGHT', 'ATTACK'], + 'cfg': 'dd01c3d8041c282c9002540eecb6ddb264aebabaa9aaf24804a10c933587133c', + 'wad': 'eb3f8d3b3f456bbef32a1d41f847189dd83cc1d4e320157ba92b75a9b0d8d5bb', + 'stats': ('KILLCOUNT', 'HEALTH', 'AMMO2')}, + 'defend-line': {'stem': 'defend_the_line', + 'goal': None, + 'start_tic': 10, + 'timeout_tics': 0, + 'buttons': ['TURN_LEFT', 'TURN_RIGHT', 'ATTACK'], + 'cfg': '3cb32d16a101339d62ced9118f1c4caeeec4ae978e7d86596a1d1cc52276ea65', + 'wad': 'b1d0fc43d987eee9e1dfee0e6bdecde8cf1ce5b15b9a09f79751bd73c553f3d8', + 'stats': ('KILLCOUNT', 'HEALTH', 'AMMO2')}, + 'take-cover': {'stem': 'take_cover', + 'goal': None, + 'start_tic': 1, + 'timeout_tics': 0, + 'buttons': ['MOVE_LEFT', 'MOVE_RIGHT'], + 'cfg': '9dd89baabf83eac8dfa8dc37afffbd5a94c653e9de196b4086eeb9605c62eab2', + 'wad': '6fcd3c50c7f303628a9c36f1af68dd5b683c56a81302cd1118f569dbb6637990', + 'stats': ('HEALTH',)}, + 'health-gathering': {'stem': 'health_gathering', + 'goal': None, + 'start_tic': 1, + 'timeout_tics': 2100, + 'buttons': ['TURN_LEFT', 'TURN_RIGHT', 'MOVE_FORWARD'], + 'cfg': '582a547f47e7a721a8728d30690d018d7588644074c7a204cd9e401f63090e2e', + 'wad': 'c77c8ba3254ae19eaff8d00418870a7718ef8a5822e5872ab68b76205cb2bacf', + 'stats': ('HEALTH', 'ITEMCOUNT')}, + 'health-gathering-supreme': {'stem': 'health_gathering_supreme', + 'goal': None, + 'start_tic': 1, + 'timeout_tics': 2100, + 'buttons': ['TURN_LEFT', 'TURN_RIGHT', 'MOVE_FORWARD'], + 'cfg': 'd53069631aacb542bd9bf5349787f5d4f5bf61a9f720cd23ae9cc3d89d2f4fe7', + 'wad': 'dade758e5295adfd860721cb9d5ac42576a560b1283bf572bf656a056fda3515', + 'stats': ('HEALTH', 'ITEMCOUNT')}, + 'deathmatch': {'stem': 'deathmatch', + 'goal': None, + 'start_tic': 1, + 'timeout_tics': 4200, + 'buttons': ['ATTACK', + 'SPEED', + 'STRAFE', + 'MOVE_RIGHT', + 'MOVE_LEFT', + 'MOVE_BACKWARD', + 'MOVE_FORWARD', + 'TURN_RIGHT', + 'TURN_LEFT', + 'SELECT_WEAPON1', + 'SELECT_WEAPON2', + 'SELECT_WEAPON3', + 'SELECT_WEAPON4', + 'SELECT_WEAPON5', + 'SELECT_WEAPON6', + 'SELECT_NEXT_WEAPON', + 'SELECT_PREV_WEAPON', + 'LOOK_UP_DOWN_DELTA', + 'TURN_LEFT_RIGHT_DELTA', + 'MOVE_LEFT_RIGHT_DELTA'], + 'cfg': 'ab2b1a71fecda7e156d43e015aec4e48a5141795c0c22777f654ea00ee75c407', + 'wad': '1d06c2113f2c1546062635ad599f49cd852287a08b7b07b26d30b8f4c362a42d', + 'stats': ('KILLCOUNT', 'HEALTH', 'ARMOR', 'SELECTED_WEAPON', 'SELECTED_WEAPON_AMMO')}, +} + + +def scenario_hashes(family): + scene = SCENARIOS[family] + return {**COMMON_ASSETS, **{f"scenarios/{scene['stem']}.{ext}": scene[ext] for ext in ("cfg", "wad")}} + + +def validate(instance): + family = instance["family"] + if family not in SCENARIOS: + raise ValueError("unsupported ViZDoom scenario") + scene = SCENARIOS[family] + validate_engine_versions(instance["engine_versions"], ENGINE_VERSIONS) + if (instance["engine_commit"] != ENGINE_COMMIT or + instance["scenario_hashes"] != scenario_hashes(family)): + raise ValueError("unsupported ViZDoom engine or scenario assets") + default_tics = instance["tics_per_decision"] + if type(default_tics) is not int or default_tics not in (1, 4): + raise ValueError("unsupported ViZDoom tic profile") + if (instance["env_id"] != f"ViZDoom/{scene['stem']}" or + instance["buttons"] != scene["buttons"] or instance["max_steps"] is not None or + any(type(instance[k]) is not int or instance[k] != scene[k] for k in ("start_tic", "timeout_tics"))): + raise ValueError("unsupported ViZDoom buttons or native timing") + if default_tics == 4 and family not in {"basic", "my-way-home"}: + raise ValueError("only the two historical ViZDoom tasks support fixed tics") + if instance["observation_profile"] != scene.get("observation_profile", "rgb-first-person-v1"): + raise ValueError("unsupported ViZDoom observation profile for this scenario") + expected_metric = "objective_success" if scene["goal"] else "native_return" + if instance["metric_spec"]["primary"] != expected_metric: + raise ValueError("unsupported ViZDoom metric for this scenario") + action_mode = "text" if default_tics == 1 else "enum" + if instance["capabilities"] != {"images": True, "action_mode": action_mode, "timing": "action-stepped", + "native_truncation": True}: + raise ValueError("unsupported ViZDoom player profile") diff --git a/game_first_exam/benchmarks/vizdoom/metric_rules.py b/game_first_exam/benchmarks/vizdoom/metric_rules.py new file mode 100644 index 0000000..b9f35de --- /dev/null +++ b/game_first_exam/benchmarks/vizdoom/metric_rules.py @@ -0,0 +1,78 @@ +"""Check native score and tic evidence from the isolated live simulator.""" +import math + +from instance_schema import SCENARIOS + + +def validate_action_tics(actions, decisions, total_tics, ended): + if not isinstance(actions, list) or len(actions) != decisions: + raise ValueError("invalid ViZDoom per-action tic ledger") + actual_tics = 0 + for index, pair in enumerate(actions, 1): + if not isinstance(pair, list) or len(pair) != 2 or any(type(value) is not int for value in pair): + raise ValueError("invalid ViZDoom requested/actual tic pair") + requested, actual = pair + if not 1 <= actual <= requested or (actual != requested and not (ended and index == decisions)): + raise ValueError("invalid ViZDoom action duration") + actual_tics += actual + if actual_tics != total_tics: + raise ValueError("ViZDoom tic ledger disagrees with the native total") + + +def validate_metrics(final, instance): + metrics = final["metrics"] + scene = SCENARIOS[instance["family"]] + fields = {"native_return", "native_tics", "decisions", "native_terminated", "native_truncated", "player_dead"} + stats = {name.lower() for name in scene.get("stats", ())} + fields |= stats + if scene["goal"]: + fields |= {"objective_success", "objective_progress"} + variable = instance["tics_per_decision"] == 1 + if variable: + fields.add("action_tics") + if set(metrics) != fields: + raise ValueError("invalid ViZDoom metric fields") + if any(type(metrics[name]) is not int for name in stats): + raise ValueError("invalid ViZDoom native statistics") + score = metrics["native_return"] + if type(score) not in (int, float) or not math.isfinite(score) or not math.isclose( + score, final["return"], rel_tol=1e-10, abs_tol=1e-10 + ): + raise ValueError("inconsistent ViZDoom native return") + decisions, tics = metrics["decisions"], metrics["native_tics"] + timeout, repeat = instance["timeout_tics"], instance["tics_per_decision"] + if type(decisions) is not int or decisions != final["steps"] or type(tics) is not int or tics < 0 or (timeout and tics > timeout): + raise ValueError("invalid ViZDoom decision or tic count") + terminated, truncated, dead = (metrics[k] for k in ("native_terminated", "native_truncated", "player_dead")) + if (any(type(v) is not bool for v in (terminated, truncated, dead)) or + terminated != final["terminated"] or truncated != final["truncated"]): + raise ValueError("inconsistent ViZDoom native ending flags") + if decisions == 0: + if tics != 0 or score != 0 or terminated or truncated: + raise ValueError("ViZDoom episode progressed without a decision") + if variable: + stopped = terminated or truncated or final["reason"] == "time_limit" + validate_action_tics(metrics["action_tics"], decisions, tics, stopped) + elif decisions > 0: + if not (decisions - 1) * repeat < tics <= decisions * repeat: + raise ValueError("invalid ViZDoom fixed action length") + if not (terminated or truncated) and tics != decisions * repeat: + raise ValueError("ViZDoom stopped inside a nonterminal action") + if truncated and (not timeout or tics != timeout): + raise ValueError("ViZDoom native timeout before the tic limit") + if dead and not terminated: + raise ValueError("ViZDoom player death must terminate the episode") + if not scene["goal"]: + if final["success"] is not False: + raise ValueError("score-only scenarios do not assign objective success") + return + goal = 100 if scene["goal"] == "green-vest" else 1 + progress = metrics["objective_progress"] + if type(progress) is not int or progress not in (0, goal): + raise ValueError("unexpected scenario objective progress") + success = progress == goal + if (type(metrics["objective_success"]) is not int or metrics["objective_success"] != int(success) or + final["success"] != success or (success and not terminated)): + raise ValueError("inconsistent ViZDoom objective evidence") + if instance["family"] in {"basic", "my-way-home", "deadly-corridor"} and terminated != (success or dead): + raise ValueError("inconsistent objective or death termination") diff --git a/game_first_exam/benchmarks/vizdoom/requirements.txt b/game_first_exam/benchmarks/vizdoom/requirements.txt new file mode 100644 index 0000000..0d8f792 --- /dev/null +++ b/game_first_exam/benchmarks/vizdoom/requirements.txt @@ -0,0 +1,11 @@ +# CPython 3.12, Linux x86-64. Install binary wheels with --require-hashes. +cloudpickle==3.1.3 --hash=sha256:1654f4f18e416447210a63c5c25a135d65a292156aa5fa519dfa4baf7726dddb +farama-notifications==0.0.6 --hash=sha256:f84839188efa1ce5bb361c2a84881b2dc2c0d0d7fb661ff00421820170930935 +gymnasium==1.4.0 --hash=sha256:1cb947c59e7c72d8eabb2c2274c00cd20948e69f8452a9ef4092223be24fdf0e +imageio==2.37.0 --hash=sha256:11efa15b87bc7871b61590326b2d635439acc321cf7f8ce996f812543ce10eed +imageio-ffmpeg==0.6.0 --hash=sha256:c7e46fcec401dd990405049d2e2f475e2b397779df2519b544b8aab515195282 +numpy==2.5.5 --hash=sha256:704d819265e5d1064d932968e9ee85fff2103ccc78c05b878c06943ba27b8507 +pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a +pygame-ce==2.5.8 --hash=sha256:bf9c8b4376077efec6ae31443172ae98545f278d0e4426852e81c28ab1f5d7c2 +typing-extensions==4.16.0 --hash=sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8 +vizdoom==1.3.2 --hash=sha256:d3f8fa01d9df31bccb9d9ccad2e03d139c1a2713ddd9152acc601f020bf2be75 diff --git a/game_first_exam/benchmarks/vizdoom/vizdoom_actions.py b/game_first_exam/benchmarks/vizdoom/vizdoom_actions.py new file mode 100644 index 0000000..c42f0fb --- /dev/null +++ b/game_first_exam/benchmarks/vizdoom/vizdoom_actions.py @@ -0,0 +1,37 @@ +"""Encode trusted ViZDoom button names and optional native continuous controls.""" +import math +import re +from decimal import Decimal + +DELTA_BUTTONS = ("LOOK_UP_DOWN_DELTA", "TURN_LEFT_RIGHT_DELTA", "MOVE_LEFT_RIGHT_DELTA") +DECIMAL = r"-?(?:0|[1-9][0-9]{0,63})(?:\.[0-9]{1,64})?" +DURATION = r"(?:@[1-9][0-9]*)?" + + +def dense_pattern(buttons): + """Canonical order, with every binary combination supported without enumerating masks.""" + alternatives = [re.escape(b) + "".join(rf"(?:\+{re.escape(other)})?" for other in buttons[i+1:]) + for i, b in enumerate(buttons)] + alternative = "|".join(["noop", *alternatives]) + return rf"(?:{alternative})(?:~{DECIMAL},{DECIMAL},{DECIMAL})?{DURATION}" + + +def encode_action(action, tics, deltas=None): + if type(tics) is not int or tics < 1: + raise ValueError("tics must be a positive integer") + if not isinstance(action, str) or not action or "@" in action or "~" in action: + raise ValueError("action must be a native ViZDoom button combination") + if deltas is not None: + if not isinstance(deltas, dict) or deltas.keys() - set(DELTA_BUTTONS): + raise ValueError("deltas must map native continuous button names to numbers") + values = [] + for button in DELTA_BUTTONS: + value = deltas.get(button, 0) + if type(value) not in (int, float) or (type(value) is float and not math.isfinite(value)): + raise ValueError("delta values must be finite numbers") + text = format(Decimal(str(value)), "f") + if not re.fullmatch(DECIMAL, text): + raise ValueError("delta value is outside the representable decimal range") + values.append(text) + action = f"{action}~{','.join(values)}" + return f"{action}@{tics}" diff --git a/game_first_exam/benchmarks/vizdoom/vizdoom_client.py b/game_first_exam/benchmarks/vizdoom/vizdoom_client.py new file mode 100644 index 0000000..cc55c03 --- /dev/null +++ b/game_first_exam/benchmarks/vizdoom/vizdoom_client.py @@ -0,0 +1,14 @@ +"""ViZDoom action durations and continuous controls over the standard transport.""" +from standard_game_client import GameClient as StandardGameClient, main +from vizdoom_actions import encode_action + + +class GameClient(StandardGameClient): + def step(self, action, expected_step, request_id=None, *, tics=1, deltas=None): + return super().step(encode_action(action, tics, deltas), expected_step, request_id) + + act = step + + +if __name__ == "__main__": + main() diff --git a/game_first_exam/benchmarks/vizdoom/vizdoom_server.py b/game_first_exam/benchmarks/vizdoom/vizdoom_server.py new file mode 100644 index 0000000..af398a1 --- /dev/null +++ b/game_first_exam/benchmarks/vizdoom/vizdoom_server.py @@ -0,0 +1,20 @@ +"""Use the standard service with a deadline check inside long native actions.""" +import time + +import server + + +class ViZDoomSession(server.Game): + def __init__(self, adapter, instance, output, wall_clock=600): + super().__init__(adapter, instance, output, wall_clock) + self.adapter.action_deadline_reached = self.action_deadline_reached + + def action_deadline_reached(self): + return self.started is not None and time.monotonic() - self.started >= self.wall_clock + + +if __name__ == "__main__": + # Select the session implementation in this simulator process. The protocol + # handler, scenario lifecycle, collection and scoring remain shared. + server.Game = ViZDoomSession + server.main() diff --git a/game_first_exam/images/vizdoom-files/FILES.json b/game_first_exam/images/vizdoom-files/FILES.json new file mode 100644 index 0000000..c85c2bc --- /dev/null +++ b/game_first_exam/images/vizdoom-files/FILES.json @@ -0,0 +1,14 @@ +{ + "image": "ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3", + "source": "game_first_exam/benchmarks/vizdoom", + "files": { + "SOURCE.json": "285a2368880ebfd0d6bf0dcf994e3e6e0596d7b19c72044c4d6b9bf4ae44fc33", + "adapter.py": "e15fe458772c7a9c706bef2d9cf5664b086c9ad2d9223a1eb08b376d7210109f", + "instance_schema.py": "f1306690d713a0375b4bcf7d7e87fe46e8caf84edfeb3e4b42228c93544b0030", + "metric_rules.py": "d1af8420ecca256468152ae2ea5f2abd5b0623e0022a8f8984aa71b6d64c608e", + "requirements.txt": "baaf9c76dbdf5109c03fa2b409f7328b3da89e30b3d7ca5eea8bfe6e9d258a03", + "vizdoom_client.py": "1d798fa76081a779a38272dc2d06b9142f4c1b906a279dad708ddf83dae8301f", + "vizdoom_actions.py": "cfaaeae80acc53253c8bd0e07f9fb0db2f69c7cdbdaf465eaa2dc2f84615def5", + "vizdoom_server.py": "f135d7ab6277226e32e51c7e3f5e921a577a9869612a1b4a3d41769045cbc453" + } +} diff --git a/game_first_exam/images/vizdoom-files/VERSION b/game_first_exam/images/vizdoom-files/VERSION new file mode 100644 index 0000000..6085e94 --- /dev/null +++ b/game_first_exam/images/vizdoom-files/VERSION @@ -0,0 +1 @@ +1.2.1 diff --git a/game_first_exam/tasks/vizdoom/README.md b/game_first_exam/tasks/vizdoom/README.md new file mode 100644 index 0000000..2935baa --- /dev/null +++ b/game_first_exam/tasks/vizdoom/README.md @@ -0,0 +1,38 @@ +# ViZDoom standard integration + +The `vizdoom` suite contains eleven single-player scenes from ViZDoom 1.3.2 with bundled +Freedoom 2 assets. The `vizdoom-smoke` suite runs Basic and My Way Home. + +## Controls and observations + +The public client accepts a positive integer `tics` argument, defaulting to one tic. ViZDoom +holds the selected buttons for that duration and stops early when the native episode or the +600-second agent budget ends. The trusted tic ledger records requested and executed durations +in step order. Defend the Line and Take Cover use native death or the public wall clock to end +their episodes. Finite scenes use their frozen native tic limits. + +All tasks expose native 320×240 first-person RGB. Basic Notifications also exposes the +latest native in-game message observed by the simulator. Deathmatch accepts native binary +buttons and continuous look, turn and strafe values, applied each tic. Audio, automap, depth, +label buffers, object metadata and sector metadata stay inside the evaluation boundary. +Frozen seeds and binary assets are verified during initialization. The final image can be +absent on an engine terminal event, and a replay ends with the last available real frame. + +## Scoring + +The report covers every frozen task. Its objective completion rate and objective family macro +cover Basic, My Way Home, Basic Notifications, Predict Position and Deadly Corridor. A wrong +target or a missed rocket are valid failures. Defend the Center, Defend the Line, Take Cover, +Health Gathering, Health Gathering Supreme and Deathmatch report their native returns and +scenario statistics. They have a per-scenario score record without a shared return scale. +The verifier checks native game evidence against the frozen scene. + +## Running + +```bash +harbor run --game-suite vizdoom --standard --list +harbor run --game-suite vizdoom --standard -c configs/harbor/oracle.json --plugin game_harbor:GameRecords +``` + +The integration uses the pinned Linux x86-64 wheel for CPython 3.12. Upstream component +notices include Freedoom’s BSD license. See [official scenario descriptions](https://vizdoom.farama.org/environments/default/). diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/DIGEST new file mode 100644 index 0000000..daa3b95 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:f8bb75d0fbbbf8129c72cadd98ba75c02e205fa9af8ad159012d56fccdef451b diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/README.md new file mode 100644 index 0000000..885f7b2 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-basic-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `basic` / seed 2117382936 | +| Oracle | `full` | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Find and defeat the single target in the room. This is the unmodified ViZDoom 1.3.2 Basic scenario, using the bundled Freedoom 2 assets and a frozen seed. + +## Difficulty +First-person target localization and lateral movement. + +## Reference solution +The oracle exercises the public client with 4 frozen decisions from this initial state. + +## Verification +The isolated verifier validates the native objective, game return, tic count and instance binding of the live episode. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..805ddde --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-basic-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..97c845c --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/environment/sim/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/basic", + "family": "basic", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/basic.cfg": "306ce424442279a1e5d98a75c36a900b616c2496dcdac93a2923946049c926e7", + "scenarios/basic.wad": "fd0b7e5e2422e09288c786e7fc32181bb8ee4a3faa613a75ef88a3e39b5ce94e" + }, + "start_tic": 14, + "timeout_tics": 300, + "tics_per_decision": 1, + "buttons": [ + "MOVE_LEFT", + "MOVE_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "6a3526a25627571d73f5c8c152fd9edf2dfa9e8bd6106598c9191ae0966cc632" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/instruction.md new file mode 100644 index 0000000..0ee7a38 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · Basic + +You can move sideways and shoot in a room with one monster. + +**Task.** Defeat the monster. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 300 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +You score 1 if you kill the monster and 0 otherwise. The run also records the native return. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/solution/actions.json new file mode 100644 index 0000000..13483a4 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/solution/actions.json @@ -0,0 +1,6 @@ +[ + "MOVE_LEFT", + "MOVE_LEFT", + "ATTACK", + "MOVE_RIGHT" +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/solution/solve.sh new file mode 100755 index 0000000..83b4b30 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/solution/solve.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient +client=GameClient() +obs=client.observe() +for action in json.load(open("/solution/actions.json")): + if obs["done"]: break + obs=client.step(action, obs["step"], tics=4) +assert obs["done"], "reference trajectory did not terminate" +print("Reference episode completed in",obs["step"],"steps") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/task.toml new file mode 100644 index 0000000..11f7bc4 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/task.toml @@ -0,0 +1,59 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-basic-i01-standard" +description = "Find and defeat the single target in the room." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "basic" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "full" +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/instance.json new file mode 100644 index 0000000..97c845c --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/basic", + "family": "basic", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/basic.cfg": "306ce424442279a1e5d98a75c36a900b616c2496dcdac93a2923946049c926e7", + "scenarios/basic.wad": "fd0b7e5e2422e09288c786e7fc32181bb8ee4a3faa613a75ef88a3e39b5ce94e" + }, + "start_tic": 14, + "timeout_tics": 300, + "tics_per_decision": 1, + "buttons": [ + "MOVE_LEFT", + "MOVE_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "6a3526a25627571d73f5c8c152fd9edf2dfa9e8bd6106598c9191ae0966cc632" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..805ddde --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-basic-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/DIGEST new file mode 100644 index 0000000..646abd0 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:491d3091d24ecfb3bed9ba6aae90904ea1c69ac846f740b356e68f136ed2038d diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/README.md new file mode 100644 index 0000000..0e7a22f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-basic-notifications-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `basic-notifications` / seed 2117382936 | +| Oracle | `full` | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Read the in-game notification and defeat the specified monster. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Text grounding and visual target selection. + +## Reference solution +Recorded reference actions complete the scenario's objective. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..01282a0 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-basic-notifications-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..bdafa1f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/environment/sim/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/basic_notifications", + "family": "basic-notifications", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-notifications-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/basic_notifications.cfg": "172233cb048bcd67a5c112378ced33e270d4b0ad6455be7fac29276dee5a36a6", + "scenarios/basic_notifications.wad": "c4b4bdc9c32c1244c080dac9381363f9b70e9bcb87edab3e4feed109b8f7f4ca" + }, + "start_tic": 14, + "timeout_tics": 300, + "tics_per_decision": 1, + "buttons": [ + "MOVE_LEFT", + "MOVE_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "620b74d41415159238315898273a4b6feb8bec280fcbb564a2e24b970243de14" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/instruction.md new file mode 100644 index 0000000..166d1cd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/instruction.md @@ -0,0 +1,59 @@ +# ViZDoom · Basic Notifications + +Three monsters appear in the room. An in-game notification names the target. + +**Task.** Read the notification and defeat the named monster. Killing a different monster ends the episode. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 300 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +You score 1 for killing the named monster and 0 otherwise. The run also records the native return. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + print(data["notifications"]) # latest in-game notification, initially possibly empty + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +`observation["notifications"]` contains the latest in-game text the simulator has seen. If it is empty, advance the game and read the text before choosing a target. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/solution/actions.json new file mode 100644 index 0000000..f78d94f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/solution/actions.json @@ -0,0 +1,10 @@ +[ + [ + "noop", + 42 + ], + [ + "ATTACK", + 100 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/task.toml new file mode 100644 index 0000000..a0601c7 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/task.toml @@ -0,0 +1,59 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-basic-notifications-i01-standard" +description = "Read the in-game notification and defeat the specified monster." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "basic-notifications" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "full" +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/instance.json new file mode 100644 index 0000000..bdafa1f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/basic_notifications", + "family": "basic-notifications", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-notifications-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/basic_notifications.cfg": "172233cb048bcd67a5c112378ced33e270d4b0ad6455be7fac29276dee5a36a6", + "scenarios/basic_notifications.wad": "c4b4bdc9c32c1244c080dac9381363f9b70e9bcb87edab3e4feed109b8f7f4ca" + }, + "start_tic": 14, + "timeout_tics": 300, + "tics_per_decision": 1, + "buttons": [ + "MOVE_LEFT", + "MOVE_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "620b74d41415159238315898273a4b6feb8bec280fcbb564a2e24b970243de14" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..01282a0 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-basic-notifications-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-basic-notifications-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/DIGEST new file mode 100644 index 0000000..16f0a22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:8ceea2e8663934f86ef555e43d10488ebafaa5f96957d644c5444ac2aac16068 diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/README.md new file mode 100644 index 0000000..a97b139 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-deadly-corridor-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `deadly-corridor` / seed 2117382936 | +| Oracle | `full` | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Cross the corridor and pick up the green armor vest while surviving enemy fire. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Combat, navigation and survival under pressure. + +## Reference solution +Recorded reference actions complete the scenario's objective. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..3e258df --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-deadly-corridor-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..c191b5d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/environment/sim/instance.json @@ -0,0 +1,47 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/deadly_corridor", + "family": "deadly-corridor", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/deadly_corridor.cfg": "b76c53ad90ff27680c4a4655c88dc04458f2d597baac6cec5d38df91ca67c17a", + "scenarios/deadly_corridor.wad": "3c868f88c78df8219a2c41a2695ae04e5a19d60a32f1718282b3bbc7f20951ca" + }, + "start_tic": 1, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "MOVE_LEFT", + "MOVE_RIGHT", + "ATTACK", + "MOVE_FORWARD", + "MOVE_BACKWARD", + "TURN_LEFT", + "TURN_RIGHT" + ], + "initial_state_sha256": "5dcdec8023c6dbe3a05c81c8c0e03772b66fb06c65c53648784ed8f8d4c9e7de" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/instruction.md new file mode 100644 index 0000000..217a988 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · Deadly Corridor + +Monsters fire at you in a corridor with a green armor vest at the far end. + +**Task.** Reach and pick up the vest before you die. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 2100 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +You score 1 for picking up the vest and 0 otherwise. The native return also reflects progress toward the vest and applies a penalty for dying. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/solution/actions.json new file mode 100644 index 0000000..4ea54a9 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/solution/actions.json @@ -0,0 +1,74 @@ +[ + [ + "TURN_RIGHT", + 12 + ], + [ + "ATTACK+MOVE_FORWARD", + 8 + ], + [ + "TURN_LEFT", + 16 + ], + [ + "ATTACK+MOVE_FORWARD", + 8 + ], + [ + "TURN_RIGHT", + 12 + ], + [ + "ATTACK+MOVE_FORWARD", + 36 + ], + [ + "TURN_RIGHT", + 4 + ], + [ + "ATTACK+MOVE_FORWARD", + 8 + ], + [ + "TURN_LEFT", + 12 + ], + [ + "ATTACK+MOVE_FORWARD", + 8 + ], + [ + "TURN_RIGHT", + 8 + ], + [ + "ATTACK+MOVE_FORWARD", + 48 + ], + [ + "TURN_LEFT", + 4 + ], + [ + "ATTACK+MOVE_FORWARD", + 16 + ], + [ + "TURN_RIGHT", + 12 + ], + [ + "ATTACK+MOVE_FORWARD", + 8 + ], + [ + "TURN_LEFT", + 8 + ], + [ + "ATTACK+MOVE_FORWARD", + 72 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/task.toml new file mode 100644 index 0000000..9df7a14 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/task.toml @@ -0,0 +1,59 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-deadly-corridor-i01-standard" +description = "Cross the corridor and pick up the green armor vest while surviving enemy fire." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "deadly-corridor" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "full" +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/instance.json new file mode 100644 index 0000000..c191b5d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/instance.json @@ -0,0 +1,47 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/deadly_corridor", + "family": "deadly-corridor", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/deadly_corridor.cfg": "b76c53ad90ff27680c4a4655c88dc04458f2d597baac6cec5d38df91ca67c17a", + "scenarios/deadly_corridor.wad": "3c868f88c78df8219a2c41a2695ae04e5a19d60a32f1718282b3bbc7f20951ca" + }, + "start_tic": 1, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "MOVE_LEFT", + "MOVE_RIGHT", + "ATTACK", + "MOVE_FORWARD", + "MOVE_BACKWARD", + "TURN_LEFT", + "TURN_RIGHT" + ], + "initial_state_sha256": "5dcdec8023c6dbe3a05c81c8c0e03772b66fb06c65c53648784ed8f8d4c9e7de" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..3e258df --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-deadly-corridor-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deadly-corridor-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/DIGEST new file mode 100644 index 0000000..9cac4b4 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:c2ebed34eb8d3477597a6325f8da83a00e1ca8a1d5022a6c7fdafbf714c46c20 diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/README.md new file mode 100644 index 0000000..e0c79e6 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-deathmatch-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `deathmatch` / seed 2117382936 | +| Oracle | `partial` — Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json. | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Earn as much native return as possible by defeating monsters in the arena. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Navigate and collect resources while managing aiming and weapon selection. + +## Reference solution +The recorded reference exercises the native scoring path and provides a reproducible example score. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..7f27a78 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-deathmatch-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..887c2bf --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/environment/sim/instance.json @@ -0,0 +1,60 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/deathmatch", + "family": "deathmatch", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/deathmatch.cfg": "ab2b1a71fecda7e156d43e015aec4e48a5141795c0c22777f654ea00ee75c407", + "scenarios/deathmatch.wad": "1d06c2113f2c1546062635ad599f49cd852287a08b7b07b26d30b8f4c362a42d" + }, + "start_tic": 1, + "timeout_tics": 4200, + "tics_per_decision": 1, + "buttons": [ + "ATTACK", + "SPEED", + "STRAFE", + "MOVE_RIGHT", + "MOVE_LEFT", + "MOVE_BACKWARD", + "MOVE_FORWARD", + "TURN_RIGHT", + "TURN_LEFT", + "SELECT_WEAPON1", + "SELECT_WEAPON2", + "SELECT_WEAPON3", + "SELECT_WEAPON4", + "SELECT_WEAPON5", + "SELECT_WEAPON6", + "SELECT_NEXT_WEAPON", + "SELECT_PREV_WEAPON", + "LOOK_UP_DOWN_DELTA", + "TURN_LEFT_RIGHT_DELTA", + "MOVE_LEFT_RIGHT_DELTA" + ], + "initial_state_sha256": "96123e2d7c07cda55d22fa91b69ddb1c04e496f848b0a7b78b4fc50148218fa4" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/instruction.md new file mode 100644 index 0000000..66aea33 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/instruction.md @@ -0,0 +1,57 @@ +# ViZDoom · Deathmatch + +You play in a single-player arena where monsters spawn and resources are available. + +**Task.** Defeat monsters to earn as much native return as you can before death or the native tic limit. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 4200 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +Your score is the native return. The reward for a kill depends on the monster. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["binary_buttons"], spec["delta_buttons"]) # button names in native order +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step("noop", expected_step=obs["step"], tics=1, +# deltas={"TURN_LEFT_RIGHT_DELTA": 3.0}) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose buttons from `spec["binary_buttons"]` and join them in the listed order with `+`. Use `"noop"` to press no binary buttons. The optional `deltas` dictionary maps names from `spec["delta_buttons"]` to finite numbers for look, turn and sideways movement. Omitted axes are zero. The engine applies those values on each tic. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/solution/actions.json new file mode 100644 index 0000000..c288e29 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/solution/actions.json @@ -0,0 +1,24 @@ +[ + [ + "ATTACK", + 35, + { + "TURN_LEFT_RIGHT_DELTA": 1.5 + } + ], + [ + "MOVE_FORWARD", + 60 + ], + [ + "ATTACK", + 35, + { + "TURN_LEFT_RIGHT_DELTA": -1.5 + } + ], + [ + "ATTACK", + 4200 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/task.toml new file mode 100644 index 0000000..11c9ee9 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/task.toml @@ -0,0 +1,60 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-deathmatch-i01-standard" +description = "Earn as much native return as possible by defeating monsters in the arena." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "deathmatch" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "partial" +oracle_evidence = "Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json." +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/instance.json new file mode 100644 index 0000000..887c2bf --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/instance.json @@ -0,0 +1,60 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/deathmatch", + "family": "deathmatch", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/deathmatch.cfg": "ab2b1a71fecda7e156d43e015aec4e48a5141795c0c22777f654ea00ee75c407", + "scenarios/deathmatch.wad": "1d06c2113f2c1546062635ad599f49cd852287a08b7b07b26d30b8f4c362a42d" + }, + "start_tic": 1, + "timeout_tics": 4200, + "tics_per_decision": 1, + "buttons": [ + "ATTACK", + "SPEED", + "STRAFE", + "MOVE_RIGHT", + "MOVE_LEFT", + "MOVE_BACKWARD", + "MOVE_FORWARD", + "TURN_RIGHT", + "TURN_LEFT", + "SELECT_WEAPON1", + "SELECT_WEAPON2", + "SELECT_WEAPON3", + "SELECT_WEAPON4", + "SELECT_WEAPON5", + "SELECT_WEAPON6", + "SELECT_NEXT_WEAPON", + "SELECT_PREV_WEAPON", + "LOOK_UP_DOWN_DELTA", + "TURN_LEFT_RIGHT_DELTA", + "MOVE_LEFT_RIGHT_DELTA" + ], + "initial_state_sha256": "96123e2d7c07cda55d22fa91b69ddb1c04e496f848b0a7b78b4fc50148218fa4" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..7f27a78 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-deathmatch-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-deathmatch-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/DIGEST new file mode 100644 index 0000000..560d31e --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:d362edf30bbc39cb4a2522144f7a137e439a65d92e466fcdd29f50a04eac5551 diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/README.md new file mode 100644 index 0000000..412c279 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-defend-center-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `defend-center` / seed 2117382936 | +| Oracle | `partial` — Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json. | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Defeat as many approaching monsters as possible from the center of the arena. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Turn to cover approaching enemies and manage limited ammunition. + +## Reference solution +The recorded reference exercises the native scoring path and provides a reproducible example score. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..4a1a15c --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-defend-center-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..c85cee8 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/environment/sim/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/defend_the_center", + "family": "defend-center", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/defend_the_center.cfg": "dd01c3d8041c282c9002540eecb6ddb264aebabaa9aaf24804a10c933587133c", + "scenarios/defend_the_center.wad": "eb3f8d3b3f456bbef32a1d41f847189dd83cc1d4e320157ba92b75a9b0d8d5bb" + }, + "start_tic": 10, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "6ae09a57cbd55c8dea63702523a482ff4b11a6755c64cab5752e837bbc7f2414" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/instruction.md new file mode 100644 index 0000000..d103fed --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · Defend the Center + +You can turn and shoot from the center of the arena. Your ammunition is limited. + +**Task.** Defeat as many monsters as you can before you die or reach the native tic limit. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 2100 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +Your score is the native return, which adds 1 per kill and subtracts 1 on death. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/solution/actions.json new file mode 100644 index 0000000..a7b4bc0 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/solution/actions.json @@ -0,0 +1,14 @@ +[ + [ + "ATTACK", + 155 + ], + [ + "TURN_LEFT", + 25 + ], + [ + "ATTACK", + 2100 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/task.toml new file mode 100644 index 0000000..53f4027 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/task.toml @@ -0,0 +1,60 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-defend-center-i01-standard" +description = "Defeat as many approaching monsters as possible from the center of the arena." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "defend-center" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "partial" +oracle_evidence = "Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json." +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/instance.json new file mode 100644 index 0000000..c85cee8 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/defend_the_center", + "family": "defend-center", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/defend_the_center.cfg": "dd01c3d8041c282c9002540eecb6ddb264aebabaa9aaf24804a10c933587133c", + "scenarios/defend_the_center.wad": "eb3f8d3b3f456bbef32a1d41f847189dd83cc1d4e320157ba92b75a9b0d8d5bb" + }, + "start_tic": 10, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "6ae09a57cbd55c8dea63702523a482ff4b11a6755c64cab5752e837bbc7f2414" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..4a1a15c --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-defend-center-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-center-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/DIGEST new file mode 100644 index 0000000..655af00 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:9361f2d8346222a1c858f280fbe90fcb1b9af175ac2ba98042c9910d0701c392 diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/README.md new file mode 100644 index 0000000..0b4e6f3 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-defend-line-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `defend-line` / seed 2117382936 | +| Oracle | `partial` — Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json. | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Defeat as many incoming monsters as possible while defending the line. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Prioritize melee and ranged threats from a fixed position. + +## Reference solution +The recorded reference exercises the native scoring path and provides a reproducible example score. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..8ee91cd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-defend-line-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..7f9f5a5 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/environment/sim/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/defend_the_line", + "family": "defend-line", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/defend_the_line.cfg": "3cb32d16a101339d62ced9118f1c4caeeec4ae978e7d86596a1d1cc52276ea65", + "scenarios/defend_the_line.wad": "b1d0fc43d987eee9e1dfee0e6bdecde8cf1ce5b15b9a09f79751bd73c553f3d8" + }, + "start_tic": 10, + "timeout_tics": 0, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "3875786e9f2936a4765f1a80db5c253c22481114a8c77784b011282dc0f78678" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/instruction.md new file mode 100644 index 0000000..93583cd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · Defend the Line + +You can turn and shoot at monsters approaching from across the room. The game replenishes your ammunition. + +**Task.** Defeat as many monsters as you can while you are alive. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** Death or the wall-clock deadline ends the episode. The scenario has no fixed native tic limit. + +## Scoring +Your score is the native return, which adds 1 per kill and subtracts 1 on death. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/solution/actions.json new file mode 100644 index 0000000..713ef98 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/solution/actions.json @@ -0,0 +1,18 @@ +[ + [ + "ATTACK", + 120 + ], + [ + "TURN_RIGHT", + 10 + ], + [ + "ATTACK", + 120 + ], + [ + "noop", + 4200 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/task.toml new file mode 100644 index 0000000..749268c --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/task.toml @@ -0,0 +1,60 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-defend-line-i01-standard" +description = "Defeat as many incoming monsters as possible while defending the line." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "defend-line" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "partial" +oracle_evidence = "Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json." +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/instance.json new file mode 100644 index 0000000..7f9f5a5 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/defend_the_line", + "family": "defend-line", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/defend_the_line.cfg": "3cb32d16a101339d62ced9118f1c4caeeec4ae978e7d86596a1d1cc52276ea65", + "scenarios/defend_the_line.wad": "b1d0fc43d987eee9e1dfee0e6bdecde8cf1ce5b15b9a09f79751bd73c553f3d8" + }, + "start_tic": 10, + "timeout_tics": 0, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "3875786e9f2936a4765f1a80db5c253c22481114a8c77784b011282dc0f78678" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..8ee91cd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-defend-line-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-defend-line-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/DIGEST new file mode 100644 index 0000000..ed20458 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:4bdec458f4fad238f7ae47145a45390f2a3e5aa34f0eb612ac975ffec353c8f7 diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/README.md new file mode 100644 index 0000000..903171a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-health-gathering-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `health-gathering` / seed 2117382936 | +| Oracle | `partial` — Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json. | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Collect medkits and survive as long as possible on the damaging floor. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Navigate toward visible supplies while taking periodic damage. + +## Reference solution +The recorded reference exercises the native scoring path and provides a reproducible example score. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..4c77612 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-health-gathering-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..b29bf3b --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/environment/sim/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/health_gathering", + "family": "health-gathering", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/health_gathering.cfg": "582a547f47e7a721a8728d30690d018d7588644074c7a204cd9e401f63090e2e", + "scenarios/health_gathering.wad": "c77c8ba3254ae19eaff8d00418870a7718ef8a5822e5872ab68b76205cb2bacf" + }, + "start_tic": 1, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "MOVE_FORWARD" + ], + "initial_state_sha256": "c9b9fc92b5184cd6622850116b19f488779032d693a76b30845bf055a1dc5620" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/instruction.md new file mode 100644 index 0000000..1ddc611 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · Health Gathering + +The floor periodically damages you. Medkits restore health. + +**Task.** Collect medkits and survive as long as possible. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 2100 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +Your score is the native return, which adds 1 per survival tic and subtracts 100 on death. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/solution/actions.json new file mode 100644 index 0000000..6360f98 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/solution/actions.json @@ -0,0 +1,22 @@ +[ + [ + "TURN_RIGHT", + 16 + ], + [ + "MOVE_FORWARD", + 65 + ], + [ + "TURN_RIGHT", + 16 + ], + [ + "MOVE_FORWARD", + 65 + ], + [ + "noop", + 2100 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/task.toml new file mode 100644 index 0000000..3f8796e --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/task.toml @@ -0,0 +1,60 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-health-gathering-i01-standard" +description = "Collect medkits and survive as long as possible on the damaging floor." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "health-gathering" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "partial" +oracle_evidence = "Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json." +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/instance.json new file mode 100644 index 0000000..b29bf3b --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/health_gathering", + "family": "health-gathering", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/health_gathering.cfg": "582a547f47e7a721a8728d30690d018d7588644074c7a204cd9e401f63090e2e", + "scenarios/health_gathering.wad": "c77c8ba3254ae19eaff8d00418870a7718ef8a5822e5872ab68b76205cb2bacf" + }, + "start_tic": 1, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "MOVE_FORWARD" + ], + "initial_state_sha256": "c9b9fc92b5184cd6622850116b19f488779032d693a76b30845bf055a1dc5620" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..4c77612 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-health-gathering-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/DIGEST new file mode 100644 index 0000000..57a1021 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:c6ea3c61766f69b487862e122cf7ca2cbc177a5e4f426b57c90923971cd21150 diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/README.md new file mode 100644 index 0000000..38b49cd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-health-gathering-supreme-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `health-gathering-supreme` / seed 2117382936 | +| Oracle | `partial` — Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json. | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Find medkits, avoid poison pickups, and survive as long as possible. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Navigate a more complex layout and distinguish helpful and harmful pickups. + +## Reference solution +The recorded reference exercises the native scoring path and provides a reproducible example score. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..3ee63f4 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-health-gathering-supreme-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..af2734f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/environment/sim/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/health_gathering_supreme", + "family": "health-gathering-supreme", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/health_gathering_supreme.cfg": "d53069631aacb542bd9bf5349787f5d4f5bf61a9f720cd23ae9cc3d89d2f4fe7", + "scenarios/health_gathering_supreme.wad": "dade758e5295adfd860721cb9d5ac42576a560b1283bf572bf656a056fda3515" + }, + "start_tic": 1, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "MOVE_FORWARD" + ], + "initial_state_sha256": "20bcb84e5a591369b45394ed16c33ed45b84b1a4cf285fe86a921af8fd412bee" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/instruction.md new file mode 100644 index 0000000..694826f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · Health Gathering Supreme + +The floor damages you, and the level contains medkits and poison pickups. + +**Task.** Find medkits, avoid poison pickups, and survive as long as possible. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 2100 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +Your score is the native return, which adds 1 per survival tic and subtracts 100 on death. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/solution/actions.json new file mode 100644 index 0000000..be798cc --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/solution/actions.json @@ -0,0 +1,22 @@ +[ + [ + "TURN_LEFT", + 25 + ], + [ + "MOVE_FORWARD", + 70 + ], + [ + "TURN_LEFT", + 5 + ], + [ + "MOVE_FORWARD", + 62 + ], + [ + "noop", + 2100 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/task.toml new file mode 100644 index 0000000..7ec19e5 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/task.toml @@ -0,0 +1,60 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-health-gathering-supreme-i01-standard" +description = "Find medkits, avoid poison pickups, and survive as long as possible." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "health-gathering-supreme" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "partial" +oracle_evidence = "Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json." +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/instance.json new file mode 100644 index 0000000..af2734f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/health_gathering_supreme", + "family": "health-gathering-supreme", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/health_gathering_supreme.cfg": "d53069631aacb542bd9bf5349787f5d4f5bf61a9f720cd23ae9cc3d89d2f4fe7", + "scenarios/health_gathering_supreme.wad": "dade758e5295adfd860721cb9d5ac42576a560b1283bf572bf656a056fda3515" + }, + "start_tic": 1, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "MOVE_FORWARD" + ], + "initial_state_sha256": "20bcb84e5a591369b45394ed16c33ed45b84b1a4cf285fe86a921af8fd412bee" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..3ee63f4 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-health-gathering-supreme-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-health-gathering-supreme-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/DIGEST new file mode 100644 index 0000000..0f5bb06 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:29ab83913ef3bc96db7b11c5efad0b66a7778f4ed10047893aaeaf40f4ca93b7 diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/README.md new file mode 100644 index 0000000..ce5a508 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-my-way-home-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `my-way-home` / seed 2117382936 | +| Oracle | `full` | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Explore the connected rooms and pick up the green armor vest. This is the unmodified ViZDoom 1.3.2 My Way Home scenario, using the bundled Freedoom 2 assets and a frozen seed. + +## Difficulty +First-person navigation, turns and spatial memory. + +## Reference solution +The oracle exercises the public client with 50 frozen decisions from this initial state. + +## Verification +The isolated verifier validates the native objective, game return, tic count and instance binding of the live episode. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..165d1bf --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-my-way-home-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..b883a84 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/environment/sim/instance.json @@ -0,0 +1,45 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/my_way_home", + "family": "my-way-home", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/my_way_home.cfg": "3dc0eb5e3557df7918484f91bdc4bc13b78cf67c6a6eaf2052e8ad66cfccbe46", + "scenarios/my_way_home.wad": "18e98ff4c9186808eb00696b799cfe88a79e7486429c1692aafbed8ef359c0b1" + }, + "start_tic": 10, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "MOVE_FORWARD", + "MOVE_LEFT", + "MOVE_RIGHT" + ], + "initial_state_sha256": "25710e507c90f4f0c78ffb44de9d39b000bf53bdcf3c7eb268039c8f8ff81ecb" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/instruction.md new file mode 100644 index 0000000..d8b7884 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · My Way Home + +You start in a maze of connected rooms. + +**Task.** Explore the rooms and pick up the green armor vest. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 2100 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +You score 1 for picking up the vest and 0 otherwise. The run also records the native return. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/solution/actions.json new file mode 100644 index 0000000..c9b7bfa --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/solution/actions.json @@ -0,0 +1,52 @@ +[ + "TURN_RIGHT", + "TURN_RIGHT", + "TURN_RIGHT+MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD", + "TURN_LEFT+MOVE_FORWARD", + "TURN_LEFT+MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "TURN_LEFT+MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD", + "TURN_RIGHT", + "TURN_RIGHT", + "TURN_RIGHT", + "TURN_RIGHT", + "TURN_RIGHT", + "TURN_RIGHT", + "TURN_RIGHT", + "TURN_RIGHT+MOVE_FORWARD", + "MOVE_FORWARD", + "MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD", + "TURN_LEFT+MOVE_FORWARD", + "TURN_LEFT+MOVE_FORWARD", + "MOVE_FORWARD", + "TURN_LEFT+MOVE_FORWARD", + "TURN_LEFT+MOVE_FORWARD", + "TURN_LEFT+MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD", + "MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD", + "MOVE_FORWARD", + "TURN_RIGHT+MOVE_FORWARD" +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/solution/solve.sh new file mode 100755 index 0000000..83b4b30 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/solution/solve.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient +client=GameClient() +obs=client.observe() +for action in json.load(open("/solution/actions.json")): + if obs["done"]: break + obs=client.step(action, obs["step"], tics=4) +assert obs["done"], "reference trajectory did not terminate" +print("Reference episode completed in",obs["step"],"steps") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/task.toml new file mode 100644 index 0000000..5316728 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/task.toml @@ -0,0 +1,59 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-my-way-home-i01-standard" +description = "Explore the connected rooms and pick up the green armor vest." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "my-way-home" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "full" +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/instance.json new file mode 100644 index 0000000..b883a84 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/instance.json @@ -0,0 +1,45 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/my_way_home", + "family": "my-way-home", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/my_way_home.cfg": "3dc0eb5e3557df7918484f91bdc4bc13b78cf67c6a6eaf2052e8ad66cfccbe46", + "scenarios/my_way_home.wad": "18e98ff4c9186808eb00696b799cfe88a79e7486429c1692aafbed8ef359c0b1" + }, + "start_tic": 10, + "timeout_tics": 2100, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "MOVE_FORWARD", + "MOVE_LEFT", + "MOVE_RIGHT" + ], + "initial_state_sha256": "25710e507c90f4f0c78ffb44de9d39b000bf53bdcf3c7eb268039c8f8ff81ecb" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..165d1bf --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-my-way-home-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-my-way-home-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/DIGEST new file mode 100644 index 0000000..6eee255 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:e4cf1d3f60f72622ef9e45c48d9d25c61283dfa70e5a34fc30e8ad79f9b3a86e diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/README.md new file mode 100644 index 0000000..77bd2eb --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-predict-position-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `predict-position` / seed 2117382936 | +| Oracle | `full` | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Use the single rocket to hit the monster as it moves across the room. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Predict a moving target and account for the rocket's travel time. + +## Reference solution +Recorded reference actions complete the scenario's objective. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..c1295ed --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-predict-position-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..b54278a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/environment/sim/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/predict_position", + "family": "predict-position", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/predict_position.cfg": "5e97217a17d5285d80c9c7351cb69562c5ff005423780c352e5c507951e08f6f", + "scenarios/predict_position.wad": "a5a1bdbbfdbef2a505b496f6889d06751ba3431a50ec382fb303fcc4066917a6" + }, + "start_tic": 16, + "timeout_tics": 300, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "a11b52d8ef050cc8e3353f224fe3923272277e7d28dc3cc5dedd1bb8166396d8" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/instruction.md new file mode 100644 index 0000000..a8df80b --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · Predict Position + +You have one rocket. A monster moves sideways along the far wall. + +**Task.** Time your shot so the rocket kills the moving monster. The episode ends when the rocket hits the monster or a wall, or the native limit is reached. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** The native episode limit is 300 tics. The separate wall-clock budget is described under Time limit. + +## Scoring +You score 1 for killing the monster and 0 otherwise. The run also records the native return. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/solution/actions.json new file mode 100644 index 0000000..6517d2c --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/solution/actions.json @@ -0,0 +1,10 @@ +[ + [ + "TURN_RIGHT", + 2 + ], + [ + "ATTACK", + 300 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/task.toml new file mode 100644 index 0000000..a0415dd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/task.toml @@ -0,0 +1,59 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-predict-position-i01-standard" +description = "Use the single rocket to hit the monster as it moves across the room." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "predict-position" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "full" +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/instance.json new file mode 100644 index 0000000..b54278a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/instance.json @@ -0,0 +1,43 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/predict_position", + "family": "predict-position", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "objective_success", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "scenario_objective_completed" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/predict_position.cfg": "5e97217a17d5285d80c9c7351cb69562c5ff005423780c352e5c507951e08f6f", + "scenarios/predict_position.wad": "a5a1bdbbfdbef2a505b496f6889d06751ba3431a50ec382fb303fcc4066917a6" + }, + "start_tic": 16, + "timeout_tics": 300, + "tics_per_decision": 1, + "buttons": [ + "TURN_LEFT", + "TURN_RIGHT", + "ATTACK" + ], + "initial_state_sha256": "a11b52d8ef050cc8e3353f224fe3923272277e7d28dc3cc5dedd1bb8166396d8" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..c1295ed --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-predict-position-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-predict-position-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/DIGEST b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/DIGEST new file mode 100644 index 0000000..9aed2ff --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/DIGEST @@ -0,0 +1 @@ +sha256:088f1b2d3018253332d9467da213ed4a44821fd07805ad52ebc10a9aa35b4287 diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/README.md b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/README.md new file mode 100644 index 0000000..004ad70 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/README.md @@ -0,0 +1,35 @@ +# vizdoom-take-cover-i01-standard + +| | | +|---|---| +| Benchmark | ViZDoom | +| Mode | standard (`game-standard/2.2`) | +| Twin | — (none: ViZDoom has no privileged mode, PROTOCOL §2) | +| Simulator / robot | `vizdoom` / `game-agent` | +| Family / instance | `take-cover` / seed 2117382936 | +| Oracle | `partial` — Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json. | +| Agent time budget | 600 s; tokens: protocol default (docs/protocol/running.md "Official runs") | +| Base image | `docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db` | + +## Task +Dodge incoming projectiles by moving left or right and survive for as long as possible. The task uses the ViZDoom 1.3.2 scene and bundled Freedoom 2 assets. + +## Difficulty +Observe projectiles and time lateral movement. + +## Reference solution +The recorded reference exercises the native scoring path and provides a reproducible example score. + +## Verification +The independent verifier checks the frozen instance, native return, tic ledger and ending evidence. + +## Resources +Caps per container (PROTOCOL §6). + +| Container | CPUs | Memory | Processes | GPU memory | Disk | +|---|---|---|---|---|---| +| `main` (the agent's) | 1 | 1 GiB | 256 | no GPU | 2 GiB | +| `sim` | 1 | 1 GiB | 128 | no GPU | — | +| verifier (as `main`) | 1 | 1 GiB | no cap | no GPU | 2 GiB | + +- GPU: not needed. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/Dockerfile new file mode 100644 index 0000000..f2c607d --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +RUN apt-get update && apt-get install -y --no-install-recommends bash curl git nodejs npm ca-certificates \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @openai/codex@0.167.1 && npm cache clean --force +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /game_client.py /app/standard_game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_client.py /app/game_client.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /app/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:connection-files-0.1.0@sha256:6d1002dea6ca507b4148d3196e233838e645b33bcfa9a27ae4a43027ae519999 /service_connection.py /app/service_connection.py +RUN printf '%s\n' 'pillow==10.4.0 --hash=sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a' > /tmp/image-tools.txt \ + && pip install --no-cache-dir --only-binary=:all: --require-hashes -r /tmp/image-tools.txt \ + && rm /tmp/image-tools.txt +ENV PYTHONUNBUFFERED=1 PYTHONPATH=/app +RUN mkdir -p /app/output +WORKDIR /app diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/docker-compose.yaml b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/docker-compose.yaml new file mode 100644 index 0000000..050bf22 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/docker-compose.yaml @@ -0,0 +1,43 @@ +services: + main: + pids_limit: 256 # rcb-monitor + volumes: # rcb-monitor + - rcb_limits:/run/rcb-limits:ro # rcb-monitor + depends_on: [sim] + sim: + cpus: 1 # rcb-monitor + mem_limit: 1024m # rcb-monitor + pids_limit: 128 # rcb-monitor + volumes: # rcb-monitor + - rcb_observe:/run/rcb-observe:ro # rcb-monitor + build: + context: sim + dockerfile: Dockerfile + working_dir: /srv + command: python3 /srv/vizdoom_server.py + environment: + RCB_WALL_CLOCK_S: "600" + # >>> rcb_monitor (resource monitor, PROTOCOL §6; generated by images/monitor/rcb_monitor/inject.py) + rcb_monitor: + image: ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a + pid: host + cgroup: host + network_mode: none + cap_add: [SYS_PTRACE] + cpus: 0.5 + mem_limit: 256m + pids_limit: 64 + restart: on-failure + working_dir: /var/rcb-monitor + volumes: + - ./rcb_monitor/limits.json:/opt/rcb_monitor/limits.json:ro + - rcb_limits:/run/rcb-limits + - rcb_observe:/run/rcb-observe + environment: + RCB_LIMITS_ENFORCE: ${RCB_LIMITS_ENFORCE:-0} + RCB_LIMITS_TOLERANCE: ${RCB_LIMITS_TOLERANCE:-0.05} + command: ["python3", "/opt/rcb_monitor/monitor.py", "run"] + # <<< rcb_monitor +volumes: # rcb-monitor + rcb_limits: # rcb-monitor + rcb_observe: # rcb-monitor diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/rcb_monitor/limits.json b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/rcb_monitor/limits.json new file mode 100644 index 0000000..1ae0c0b --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/rcb_monitor/limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-take-cover-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/sim/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/sim/Dockerfile new file mode 100644 index 0000000..1688995 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/sim/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /requirements.txt /srv/requirements.txt +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /srv/requirements.txt && pip check +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /server.py /srv/server.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /srv/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /srv/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /contracts.py /srv/contracts.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /encoding.py /srv/encoding.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /recording.py /srv/recording.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /adapter.py /srv/adapter.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /srv/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_actions.py /srv/vizdoom_actions.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /vizdoom_server.py /srv/vizdoom_server.py +COPY instance.json /srv/instance.json +WORKDIR /srv +CMD ["python3", "/srv/vizdoom_server.py"] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/sim/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/sim/instance.json new file mode 100644 index 0000000..25008f0 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/environment/sim/instance.json @@ -0,0 +1,42 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/take_cover", + "family": "take-cover", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/take_cover.cfg": "9dd89baabf83eac8dfa8dc37afffbd5a94c653e9de196b4086eeb9605c62eab2", + "scenarios/take_cover.wad": "6fcd3c50c7f303628a9c36f1af68dd5b683c56a81302cd1118f569dbb6637990" + }, + "start_tic": 1, + "timeout_tics": 0, + "tics_per_decision": 1, + "buttons": [ + "MOVE_LEFT", + "MOVE_RIGHT" + ], + "initial_state_sha256": "3c229321680949e07e7db76a66d966a2bbd4ba35d8b561fdeecc334a465006a9" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/instruction.md b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/instruction.md new file mode 100644 index 0000000..cc13890 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/instruction.md @@ -0,0 +1,56 @@ +# ViZDoom · Take Cover + +Monsters fire projectiles across the room. You can only move sideways. + +**Task.** Dodge the projectiles and survive as long as possible. Use the Python client below. + +## Rules +- **Drive the game with a program.** You may read observations and run multiple actions in a loop. +- **One episode.** There is no reset or undo. Stop submitting actions when `done` is true. +- **Use the public client and its observations.** Save the control scripts you execute under `/app/output/`. +- **Limits.** Death or the wall-clock deadline ends the episode. The scenario has no fixed native tic limit. + +## Scoring +Your score is the native return, which adds 1 per survival tic. + +## Client (`/app/game_client.py`) +```python +from game_client import GameClient + +game = GameClient() +spec = game.spec() +print(spec["actions"]) # valid button combinations, including "noop" +obs = game.observe() # current snapshot without advancing the game +print(obs["step"], obs["done"]) +data = obs["observation"] +if data["frame_available"]: + game.save_image(obs, "/app/output/view.png") + +# Syntax example. Choose an action from the current observation. +# if not obs["done"]: +# obs = game.step(action, expected_step=obs["step"], tics=1) +# game.save_image(obs, "/app/output/view.png") +``` + +### Observations +When `observation["frame_available"]` is true, `observation["image_png_base64"]` contains one 320×240 first-person RGB frame encoded as a PNG. Save it with `game.save_image()` to view the PNG with an image tool or analyze it in your program. Frames are returned to your program and do not appear in your context automatically. The engine may return no frame when the episode ends. + +### Actions and feedback +Choose a command from `spec["actions"]`. A combination is written in the listed button order, with names joined by `+`. Use `"noop"` to advance without pressing any buttons. + +Pass a positive integer as `tics` to hold the action. It defaults to 1. The engine can stop an action early at episode end or the server's time limit. The game stays still between actions. + +`observe()` and `step()` return `observation`, `step`, `done`, `steps_remaining` and `time_left_s`. `step` counts accepted actions. `steps_remaining` is `None` because the service adds no action-count limit. `time_left_s` measures the service clock. Per-action rewards are not returned. + +Pass the current `step` as `expected_step`. If the step is stale or a response is lost, call `observe()` before choosing another action. + +## External material +You may read the public client and use general-purpose libraries. Network access follows the run's allowlist, including for package installation. Solve the task using the live episode. Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, rollouts or trained policies specific to this task. + +## Resources +Your container: **1 CPUs**, **1 GiB of memory**, **256 processes and threads** and **2 GiB** of disk (new files under `/app`, `/tmp` and `/root`). Your container has no GPU. The simulator runs in its own container and does not count against these. CPU only slows you down; a process that goes over any other cap can be killed. Usage and caps: `/run/rcb-limits/usage.json`. + +## Time limit +You have 600 seconds to complete this task. Do not cheat by using online solutions or hints specific to this task. + +The wall-clock budget starts with your session and includes service startup, planning and tool execution. At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in `/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock. diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/solution/actions.json b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/solution/actions.json new file mode 100644 index 0000000..7d0b64f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/solution/actions.json @@ -0,0 +1,14 @@ +[ + [ + "MOVE_RIGHT", + 46 + ], + [ + "MOVE_LEFT", + 110 + ], + [ + "MOVE_RIGHT", + 4200 + ] +] diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/solution/solve.sh b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/solution/solve.sh new file mode 100755 index 0000000..aac93bd --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/solution/solve.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail +python3 - <<'PYCODE' +import json +from game_client import GameClient + +client = GameClient() +obs = client.observe() +for action, tics, *continuous in json.load(open("/solution/actions.json")): + if obs["done"]: + break + controls = {"deltas": continuous[0]} if continuous else {} + obs = client.step(action, obs["step"], tics=tics, **controls) +print("Reference executed", obs["step"], "decisions") +PYCODE diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/task.toml b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/task.toml new file mode 100644 index 0000000..1105538 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/task.toml @@ -0,0 +1,60 @@ +schema_version = "1.3" +artifacts = [{ source = "/var/rcb-monitor/", service = "rcb_monitor" }, { source = "/data/final.json", service = "sim" }, + { source = "/data/episode.jsonl", service = "sim" }, + { source = "/data/recording.json", service = "sim" }, + { source = "/data/replay.mp4", service = "sim" }, + { source = "/data/replay.last.png", service = "sim" }, + "/app/output/", +] + +[task] +name = "embodied-first-exam/vizdoom-take-cover-i01-standard" +description = "Dodge incoming projectiles by moving left or right and survive for as long as possible." +keywords = ["game", "vizdoom", "first-person", "standard-mode"] + +[metadata] +task_type = "trajectory" +simulator = "vizdoom" +robot = "game-agent" +family = "take-cover" +dynamics = "static" +protocol = "game-standard/2.2" +oracle = "partial" +oracle_evidence = "Exercises the frozen scenario and measures its native score along a reference trajectory. See solution/actions.json." +instance_seed = 2117382936 +expert_time_estimate_hours = 0.5 + +[verifier] +timeout_sec = 120.0 +environment_mode = "separate" +network_mode = "no-network" + +# Resources (PROTOCOL §6): seal the monitor's record first. +[[verifier.collect]] +service = "rcb_monitor" +command = "python3 /opt/rcb_monitor/monitor.py seal --wait 90" +timeout_sec = 120 + +[[verifier.collect]] +service = "main" +command = "kill -9 -1 2>/dev/null; exit 0" +timeout_sec = 30 + +[[verifier.collect]] +service = "sim" +command = "kill -USR1 $(cat /data/server.pid); i=0; while [ ! -f /data/collection.ready ] && [ $i -lt 30 ]; do sleep 1; i=$((i+1)); done; test -f /data/collection.ready && test -f /data/final.json" +timeout_sec = 40 + +[agent] +network_mode = "allowlist" +timeout_sec = 600.0 +allowed_hosts = ["chatgpt.com", "*.chatgpt.com", "auth.openai.com", "api.openai.com", "*.openai.com", "api.anthropic.com", "*.anthropic.com", "openrouter.ai", "*.openai.azure.com", "*.cognitiveservices.azure.com", "pypi.org", "files.pythonhosted.org", "deb.debian.org", "security.debian.org", "archive.ubuntu.com", "security.ubuntu.com", "snapshot.ubuntu.com"] + +[environment] +build_timeout_sec = 1200.0 +cpus = 1 +memory_mb = 1024 +storage_mb = 2048 + +[verifier.env] +RCB_LIMITS_ENFORCE = "${RCB_LIMITS_ENFORCE:-0}" diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/Dockerfile b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/Dockerfile new file mode 100644 index 0000000..0de8a8f --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/Dockerfile @@ -0,0 +1,11 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +COPY test.sh instance.json /tests/ +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /grade.py /tests/grade.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /reducers.py /tests/reducers.py +COPY --from=ghcr.io/mll-lab-nu/efe:game-files-0.6.0@sha256:bfb708928954d5cc194a614ab772a65b1e56f381b49dfeb2227c3d609e5f2ecc /config_schema.py /tests/config_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /instance_schema.py /tests/instance_schema.py +COPY --from=ghcr.io/mll-lab-nu/efe:vizdoom-files-1.2.1@sha256:d1b51e9104a736458752e9bd32fe760da8fe07bc865d7d0be9b8e98392dc96b3 /metric_rules.py /tests/metric_rules.py +RUN chmod +x /tests/test.sh +# resources (PROTOCOL §6) # rcb-monitor +COPY --from=ghcr.io/mll-lab-nu/efe:monitor-0.5.0@sha256:ecc5f24f1516ca11711d7c2d3ac07c89f79cd9220812c1244498ec71e352402a /opt/rcb_monitor/rcb_limits.py /tests/rcb_limits.py +COPY rcb_limits.json /tests/rcb_limits.json diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/instance.json b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/instance.json new file mode 100644 index 0000000..25008f0 --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/instance.json @@ -0,0 +1,42 @@ +{ + "schema_version": "game-instance/2.2", + "protocol": "game-standard/2.2", + "adapter_version": "1.0.0", + "capabilities": { + "images": true, + "action_mode": "text", + "timing": "action-stepped", + "native_truncation": true + }, + "benchmark": "vizdoom", + "env_id": "ViZDoom/take_cover", + "family": "take-cover", + "seed": 2117382936, + "max_steps": null, + "observation_profile": "rgb-first-person-v1", + "metric_spec": { + "primary": "native_return", + "reducer": "family_macro", + "reducer_version": "1.0.0", + "success_label": "native_score_only" + }, + "engine_versions": { + "vizdoom": "1.3.2", + "numpy": "2.5.5" + }, + "engine_commit": "53d758a64f113ef3ef8f67bea5b4b717e51e1c0a", + "scenario_hashes": { + "freedoom2.wad": "a8772e088847032510d97ba2312406a6998f21cbab44d4ff10696faa9c0ecd4b", + "vizdoom.pk3": "24381138aede0ab03a4266f8fdd0225a1819658f004d37c9dc349e006b74f34e", + "scenarios/take_cover.cfg": "9dd89baabf83eac8dfa8dc37afffbd5a94c653e9de196b4086eeb9605c62eab2", + "scenarios/take_cover.wad": "6fcd3c50c7f303628a9c36f1af68dd5b683c56a81302cd1118f569dbb6637990" + }, + "start_tic": 1, + "timeout_tics": 0, + "tics_per_decision": 1, + "buttons": [ + "MOVE_LEFT", + "MOVE_RIGHT" + ], + "initial_state_sha256": "3c229321680949e07e7db76a66d966a2bbd4ba35d8b561fdeecc334a465006a9" +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/rcb_limits.json b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/rcb_limits.json new file mode 100644 index 0000000..1ae0c0b --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/rcb_limits.json @@ -0,0 +1,26 @@ +{ + "agent_timeout_sec": 600, + "caps": { + "main": { + "cpus": 1.0, + "disk_gb": 2.0, + "memory_gb": 1.0, + "pids": 256 + }, + "sim": { + "cpus": 1.0, + "memory_gb": 1.0, + "pids": 128 + } + }, + "disk_gb": 2.0, + "disk_tick_sec": 60, + "format": "rcb-limits/2", + "gpu": false, + "mode": "standard", + "scope_services": [ + "main" + ], + "task": "vizdoom-take-cover-i01-standard", + "tick_sec": 5 +} diff --git a/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/test.sh b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/test.sh new file mode 100755 index 0000000..0cf878a --- /dev/null +++ b/game_first_exam/tasks/vizdoom/vizdoom-take-cover-i01-standard/tests/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +rm -rf /logs/verifier/* +trap 'p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py verify' EXIT # resources, after the grader (PROTOCOL §6) +p=$(command -v python3 || command -v python); "$p" /tests/rcb_limits.py sanitize /app/output || true # untrusted agent files (PROTOCOL H.1) +mkdir -p /logs/verifier +python3 /tests/grade.py 2>/logs/verifier/grade.log diff --git a/game_first_exam/tests/benchmarks/vizdoom/exported.toml b/game_first_exam/tests/benchmarks/vizdoom/exported.toml new file mode 100644 index 0000000..65d671d --- /dev/null +++ b/game_first_exam/tests/benchmarks/vizdoom/exported.toml @@ -0,0 +1,57 @@ +[protocols] +standard = ["game-standard/2.2"] + +[[tasks]] +name = "vizdoom-basic-i01-standard" +source_task = "ViZDoom/basic" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-my-way-home-i01-standard" +source_task = "ViZDoom/my_way_home" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-basic-notifications-i01-standard" +source_task = "ViZDoom/basic_notifications" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-predict-position-i01-standard" +source_task = "ViZDoom/predict_position" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-deadly-corridor-i01-standard" +source_task = "ViZDoom/deadly_corridor" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-defend-center-i01-standard" +source_task = "ViZDoom/defend_the_center" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-defend-line-i01-standard" +source_task = "ViZDoom/defend_the_line" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-take-cover-i01-standard" +source_task = "ViZDoom/take_cover" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-health-gathering-i01-standard" +source_task = "ViZDoom/health_gathering" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-health-gathering-supreme-i01-standard" +source_task = "ViZDoom/health_gathering_supreme" +protocol = "game-standard/2.2" + +[[tasks]] +name = "vizdoom-deathmatch-i01-standard" +source_task = "ViZDoom/deathmatch" +protocol = "game-standard/2.2" diff --git a/game_first_exam/tests/envs/vizdoom.Dockerfile b/game_first_exam/tests/envs/vizdoom.Dockerfile new file mode 100644 index 0000000..7219483 --- /dev/null +++ b/game_first_exam/tests/envs/vizdoom.Dockerfile @@ -0,0 +1,6 @@ +FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db +ENV PYTHONUNBUFFERED=1 SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy +RUN apt-get update && apt-get install -y --no-install-recommends libsdl2-2.0-0 libgl1 libglib2.0-0 ca-certificates && rm -rf /var/lib/apt/lists/* +COPY game_first_exam/benchmarks/vizdoom/requirements.txt /requirements.txt +RUN pip install --no-cache-dir --only-binary=:all: --require-hashes -r /requirements.txt && pip check +WORKDIR /repo diff --git a/game_first_exam/tests/run.sh b/game_first_exam/tests/run.sh index a033e85..755f42f 100755 --- a/game_first_exam/tests/run.sh +++ b/game_first_exam/tests/run.sh @@ -13,6 +13,9 @@ case "${1:-common}" in python3 -m unittest discover -s game_first_exam/tests -p 'test_game_connection.py' python3 -m unittest discover -s game_first_exam/tests -p 'test_game_modes.py' ;; + vizdoom) + python3 game_first_exam/tests/test_vizdoom.py + ;; minihack) export GAME_TEST_BENCHMARK=minihack python3 game_first_exam/tests/test_game_adapters.py diff --git a/game_first_exam/tests/test_game_harbor.py b/game_first_exam/tests/test_game_harbor.py index e6e71f6..967f002 100644 --- a/game_first_exam/tests/test_game_harbor.py +++ b/game_first_exam/tests/test_game_harbor.py @@ -22,7 +22,7 @@ ROOT = Path(__file__).resolve().parents[2] sys.path.insert(0, str(ROOT / "scripts")) from game_harbor import GameRecords -from game_reports import write_harbor_report +from game_reports import aggregate, write_harbor_report from game_runtime import report_code_metadata from prepare_games import load_suite, prepare, select_tasks import efe @@ -32,17 +32,38 @@ class GameSelection(unittest.TestCase): def test_game_only_default_and_all_selection_never_launches(self): for flags, expected in ((["--list", "--standard"], 30), - (["--all", "--standard", "--list"], 42)): + (["--all", "--standard", "--list"], 53)): with self.subTest(flags=flags), contextlib.redirect_stdout(io.StringIO()) as output, \ patch("efe.harbor") as launch, patch("efe.prepull") as pull: self.assertEqual(efe.run(flags), 0) names = output.getvalue().splitlines() self.assertEqual(len(names), expected) - self.assertTrue(all(name.startswith(("minigrid-", "crafter-", "textworld-", "babaisai-", "minihack-")) + self.assertTrue(all(name.startswith(("minigrid-", "crafter-", "textworld-", "babaisai-", "minihack-", "vizdoom-")) for name in names)) launch.assert_not_called() pull.assert_not_called() + def test_vizdoom_mixed_objective_and_native_score_reporting(self): + _, plans = load_suite("vizdoom") + self.assertEqual(len(plans), 11) + records = {} + trials = [] + for name, (_, _, instance) in plans.items(): + records[name] = {key: instance[key] for key in ("benchmark", "family", "seed", "metric_spec")} + records[name]["digest"] = "sha256:fixture" + primary = instance["metric_spec"]["primary"] + value = 1 if primary == "objective_success" else 1000 + trials.append({"task": name, "valid": True, "success": int(primary == "objective_success"), + "status": "success" if primary == "objective_success" else "fail", + "native_metrics": {primary: value}, "steps": 1}) + output = aggregate(trials, records)["benchmarks"]["vizdoom"] + self.assertEqual((output["valid"], output["completion_valid"], output["scored_valid"]), (11, 5, 6)) + self.assertEqual(output["success_rate"], 1) + self.assertEqual(output["macro_primary_score"], 1) + self.assertEqual(output["families"]["deathmatch"]["mean_primary_score"], 1000) + self.assertEqual(sum(row["status"] == "scored" and row["success"] is None for row in trials), 6) + self.assertEqual(aggregate([], records)["benchmarks"]["vizdoom"]["missing"], 11) + def test_checkout_discovery_works_without_upstream_task_tree(self): self.assertTrue(efe.is_tree(ROOT)) self.assertFalse((ROOT / "tasks").exists()) diff --git a/game_first_exam/tests/test_vizdoom.py b/game_first_exam/tests/test_vizdoom.py new file mode 100644 index 0000000..e7f0b0a --- /dev/null +++ b/game_first_exam/tests/test_vizdoom.py @@ -0,0 +1,266 @@ +"""Compare the isolated ViZDoom adapter with the installed native scenarios.""" +import io +import json +import math +from pathlib import Path +import sys +import tempfile +import unittest + +import numpy as np +from PIL import Image +import vizdoom as vzd + +GAME_ROOT = Path(__file__).resolve().parents[1] +sys.path[:0] = [str(GAME_ROOT / "runtime"), str(GAME_ROOT / "benchmarks/vizdoom")] + +from adapter import Adapter +from config_schema import register_instance_schema, validate_instance +from grade import grade +import instance_schema +from metric_rules import validate_metrics +from server import Game, InvalidAction +from vizdoom_actions import encode_action +from vizdoom_server import ViZDoomSession + +register_instance_schema(instance_schema) + + +class ViZDoomTests(unittest.TestCase): + def scenarios(self): + for family in ("basic", "my-way-home"): + spec = instance_schema.SCENARIOS[family] + task = GAME_ROOT / "tasks/vizdoom" / f"vizdoom-{family}-i01-standard" + instance = validate_instance(json.loads((task / "tests/instance.json").read_text())) + actions = json.loads((task / "solution/actions.json").read_text()) + yield instance, spec, actions + + def native(self, instance, spec, directory): + installed = Path(vzd.__file__).resolve().parent + game = vzd.DoomGame() + self.addCleanup(game.close) + self.assertTrue(game.load_config(str(installed / "scenarios" / f"{spec['stem']}.cfg"))) + game.set_doom_game_path(str(installed / "freedoom2.wad")) + game.set_doom_config_path(str(Path(directory) / "native.ini")) + game.set_seed(instance["seed"]) + game.set_window_visible(False) + game.set_sound_enabled(False) + game.set_screen_format(vzd.ScreenFormat.RGB24) + game.init() + return game + + def compare(self, instance, spec, actions, expected): + with tempfile.TemporaryDirectory() as directory: + adapter = Adapter(instance, Path(directory)) + try: + native = self.native(instance, spec, directory) + try: + self.assertEqual(adapter.fingerprint(), instance["initial_state_sha256"]) + self.assertEqual(len(adapter.spec()["actions"]), 2 ** len(spec["buttons"])) + self.assertEqual(native.get_episode_timeout(), spec["timeout_tics"]) + self.assertEqual(native.get_episode_time(), spec["start_tic"]) + for decision, (action, tics) in enumerate(actions, start=1): + buttons = action.split("+") + vector = [int(button in buttons) for button in spec["buttons"]] + reward = native.make_action(vector, tics) + wire_action = action if tics == 1 else f"{action}@{tics}" + transition = adapter.step(wire_action) + self.assertAlmostEqual(reward, transition.reward, places=10) + self.assertEqual(transition.terminated or transition.truncated, native.is_episode_finished()) + self.assertEqual(transition.truncated, native.is_episode_timeout_reached()) + self.assertEqual(adapter.action_tics[-1][0], tics) + if native.is_episode_finished(): + self.assertEqual(decision, len(actions)) + self.assertIsNone(adapter.frame()) + self.assertEqual(adapter.observe(), {"frame_available": False}) + else: + self.assertEqual(adapter.advanced_tics, native.get_episode_time() - spec["start_tic"]) + self.assertTrue(np.array_equal(adapter.frame(), native.get_state().screen_buffer)) + self.assertTrue(native.is_episode_finished()) + self.assertAlmostEqual(adapter.metrics()["native_return"], native.get_total_reward(), places=10) + self.assertEqual(adapter.success(), expected) + self.assertEqual(adapter.truncated, not expected) + self.assertLess(adapter.action_tics[-1][1], actions[-1][1]) + self.assertEqual(sum(actual for _, actual in adapter.action_tics), adapter.advanced_tics) + if not expected: + self.assertEqual(adapter.advanced_tics, spec["timeout_tics"]) + finally: + native.close() + finally: + adapter.close() + + def test_reference_and_native_timeout_match_batched_native_actions(self): + for instance, spec, actions in self.scenarios(): + winning = [(actions[0], 1), (actions[0], 3)] + winning += [(action, 4) for action in actions[1:-1]] + winning.append((actions[-1], 16)) + timeout = [("noop", 1), ("noop", 16), ("noop", spec["timeout_tics"])] + for expected, steps in ((True, winning), (False, timeout)): + with self.subTest(family=instance["family"], objective=expected): + self.compare(instance, spec, steps, expected) + + def test_public_observation_and_invalid_or_repeated_action(self): + import base64 + for instance, _, _ in self.scenarios(): + with self.subTest(family=instance["family"]), tempfile.TemporaryDirectory() as directory: + game = Game.open(Adapter, instance, Path(directory), Path(directory) / "record") + try: + self.assertIsNone(game.final) + snapshot = game.observe() + obs = snapshot["observation"] + self.assertEqual(set(obs), {"frame_available", "image_png_base64"}) + image = Image.open(io.BytesIO(base64.b64decode(obs["image_png_base64"]))) + self.assertEqual((image.mode, image.size), ("RGB", (320, 240))) + self.assertEqual(snapshot["observation"], game.observe()["observation"]) + self.assertEqual(game.adapter.metrics()["native_tics"], 0) + self.assertEqual(game.spec()["reset_budget"], 0) + with self.assertRaises(InvalidAction): + game.submit({"action": "RESET", "expected_step": 0, "request_id": "bad"}) + self.assertEqual(game.adapter.advanced_tics, 0) + self.assertEqual(game.spec()["default_tics"], 1) + for raw in ("noop@0", "noop@-1", "noop@1.5", "noop@true", "noop@4@4"): + with self.assertRaises(InvalidAction): + game.submit({"action": raw, "expected_step": 0, "request_id": raw}) + self.assertEqual(game.adapter.advanced_tics, 0) + request = {"action": "noop", "expected_step": 0, "request_id": "one"} + self.assertEqual(game.submit(request), game.submit(request)) + self.assertEqual(game.adapter.advanced_tics, 1) + with self.assertRaisesRegex(ValueError, "different payload"): + game.submit({**request, "action": "noop@16"}) + request = {"action": "noop@16", "expected_step": 1, "request_id": "two"} + self.assertEqual(game.submit(request), game.submit(request)) + self.assertEqual(game.adapter.advanced_tics, 17) + game.finalize("agent_finished") + verdict = grade(game.final, instance, validate_metrics) + self.assertTrue(verdict["result_valid"]) + self.assertEqual(verdict["primary_score"], 0) + self.assertEqual(game.final["metrics"]["action_tics"], [[1, 1], [16, 16]]) + damaged = {**game.final, "metrics": {**game.final["metrics"], "action_tics": [[1, 1], [17, 16]]}} + with self.assertRaisesRegex(ValueError, "action duration"): + grade(damaged, instance, validate_metrics) + finally: + game.close() + + def test_no_action_is_valid_failure(self): + for instance, _, _ in self.scenarios(): + with self.subTest(family=instance["family"]), tempfile.TemporaryDirectory() as directory: + game = Game.open(Adapter, instance, Path(directory), Path(directory) / "record") + try: + game.finalize("agent_finished") + verdict = grade(game.final, instance, validate_metrics) + self.assertTrue(verdict["result_valid"]) + self.assertEqual(verdict["primary_score"], 0) + self.assertTrue(math.isclose(verdict["return"], 0)) + finally: + game.close() + + + def extended_instance(self, family): + task = GAME_ROOT / "tasks/vizdoom" / f"vizdoom-{family}-i01-standard" + instance = validate_instance(json.loads((task / "tests/instance.json").read_text())) + actions = json.loads((task / "solution/actions.json").read_text()) + return instance, actions + + def test_all_new_reference_sessions_match_native_actions_and_grade(self): + for family in instance_schema.SCENARIOS: + if family in {"basic", "my-way-home"}: + continue + with self.subTest(family=family), tempfile.TemporaryDirectory() as directory: + instance, actions = self.extended_instance(family) + spec = instance_schema.SCENARIOS[family] + game = ViZDoomSession.open(Adapter, instance, Path(directory), Path(directory) / "record") + self.addCleanup(game.close) + self.assertIsNone(game.final) + native = self.native(instance, spec, directory) + for i, (action, tics, *axes) in enumerate(actions): + if native.is_episode_finished(): + break + buttons = action.split("+") + deltas = axes[0] if axes else {} + vector = [deltas.get(button, int(button in buttons)) for button in instance["buttons"]] + native.make_action(vector, tics) + wire = encode_action(action, tics, deltas if axes else None) + obs = game.submit({"action": wire, "expected_step": i, "request_id": str(i)}) + self.assertAlmostEqual(game.adapter.native_return, native.get_total_reward(), places=9) + self.assertEqual(obs["done"], native.is_episode_finished()) + if not obs["done"]: + self.assertTrue(np.array_equal(game.adapter.frame(), native.get_state().screen_buffer)) + game.finalize("agent_finished") + verdict = grade(game.final, instance, validate_metrics) + self.assertTrue(verdict["result_valid"]) + if spec["goal"]: + self.assertTrue(game.final["success"]) + self.assertEqual(verdict["primary_score"], 1) + else: + self.assertEqual(verdict["primary_metric"], "native_return") + self.assertEqual(verdict["primary_score"], game.adapter.native_return) + game.close() + native.close() + + def test_notification_and_native_no_goal_timeout_behavior(self): + instance, _ = self.extended_instance("basic-notifications") + with tempfile.TemporaryDirectory() as directory: + game = ViZDoomSession.open(Adapter, instance, None, Path(directory)) + self.addCleanup(game.close) + first = game.observe() + self.assertEqual(set(first["observation"]), {"frame_available", "image_png_base64", "notifications"}) + action = game.submit({"action":"noop@100", "expected_step":0, "request_id":"read-notice"}) + self.assertTrue(action["observation"]["notifications"].strip().startswith("Shoot:")) + final = game.submit({"action":"noop@999", "expected_step":1, "request_id":"wait"}) + self.assertTrue(final["done"]) + self.assertFalse(game.final["success"]) + self.assertEqual(game.final["reason"], "native_truncated") + self.assertTrue(grade(game.final, instance, validate_metrics)["result_valid"]) + + def test_basic_notifications_wrong_kill_is_valid_failure(self): + instance, _ = self.extended_instance("basic-notifications") + with tempfile.TemporaryDirectory() as directory: + game = ViZDoomSession.open(Adapter, instance, None, Path(directory)) + try: + for i, action in enumerate(("MOVE_LEFT@13", "ATTACK@300")): + game.submit({"action": action, "expected_step": i, "request_id": str(i)}) + self.assertEqual(game.adapter.game.get_game_variable(vzd.GameVariable.KILLCOUNT), 1) + self.assertEqual(game.final["metrics"]["objective_success"], 0) + self.assertTrue(grade(game.final, instance, validate_metrics)["result_valid"]) + finally: + game.close() + + def test_wall_clock_can_interrupt_long_action_without_native_limit(self): + for family in ("take-cover", "defend-line"): + instance, _ = self.extended_instance(family) + with self.subTest(family=family), tempfile.TemporaryDirectory() as directory: + game = ViZDoomSession.open(Adapter, instance, None, Path(directory)) + self.addCleanup(game.close) + def tick(): + if game.adapter.advanced_tics == 3: + game.started -= game.wall_clock + return game.action_deadline_reached() + game.adapter.action_deadline_reached = tick + obs = game.submit({"action":"noop@999999999", "expected_step":0, "request_id":"deadline"}) + self.assertTrue(obs["done"]) + self.assertEqual(game.final["reason"], "time_limit") + self.assertEqual(game.final["metrics"]["action_tics"], [[999999999,3]]) + self.assertTrue(grade(game.final, instance, validate_metrics)["result_valid"]) + + def test_deathmatch_spec_supports_valid_axis_values_and_rejects_bad_actions(self): + instance, _ = self.extended_instance("deathmatch") + with tempfile.TemporaryDirectory() as directory: + game = ViZDoomSession.open(Adapter, instance, None, Path(directory)) + self.addCleanup(game.close) + spec = game.spec() + self.assertEqual(len(spec["binary_buttons"]), 17) + self.assertEqual(len(spec["delta_buttons"]), 3) + for wire in ("ATTACK+ATTACK@2", "ATTACK~nan,0,0@1", "noop~0,0@1", "noop@0"): + with self.assertRaises(InvalidAction): + game.submit({"action":wire, "expected_step":0, "request_id":wire}) + self.assertEqual(game.adapter.advanced_tics,0) + with self.assertRaises(ValueError): + encode_action("noop", 1, {"TURN_LEFT_RIGHT_DELTA": float("inf")}) + wire = encode_action("+".join(spec["binary_buttons"]),1,{b: -0.25 for b in spec["delta_buttons"]}) + game.submit({"action":wire,"expected_step":0,"request_id":"continuous"}) + self.assertEqual(game.adapter.advanced_tics,1) + game.close() + + +if __name__ == "__main__": + unittest.main() diff --git a/scripts/game_harbor.py b/scripts/game_harbor.py index fe7e36b..19c2765 100644 --- a/scripts/game_harbor.py +++ b/scripts/game_harbor.py @@ -6,7 +6,7 @@ from game_preflight import validate_task from game_reports import write_harbor_report from game_runtime import RuntimeCapture, report_code_metadata, runner_metadata, validate_report_code -from game_schemas import register_schemas +from game_schemas import metric_scope, register_schemas class GameRecords: @@ -41,7 +41,7 @@ async def on_job_start(self, job): if len(modes) > 1: raise ValueError("game reports require one execution mode; select --standard, --privileged or --realtime") instance = json.loads((task / "tests/instance.json").read_text()) - previous = metrics.setdefault(instance["benchmark"], instance["metric_spec"]) + previous = metrics.setdefault(metric_scope(instance), instance["metric_spec"]) if previous != instance["metric_spec"]: raise ValueError("incompatible metric definitions within benchmark") validate_task( diff --git a/scripts/game_preflight.py b/scripts/game_preflight.py index 687683b..c3bb57d 100644 --- a/scripts/game_preflight.py +++ b/scripts/game_preflight.py @@ -10,13 +10,13 @@ import files_image import task_conventions as tc from config_schema import PROTOCOL, positive, validate_instance, validate_suite -from game_schemas import load_schema, register_schemas, schema_paths +from game_schemas import load_schema, metric_scope, register_schemas, schema_paths sys.path.insert(0, str(ROOT / 'game_first_exam/runtime/modes')) from mode_config import validate_mode def validate_task(row, task_path=None): - load_schema(row['benchmark']) + schema = load_schema(row['benchmark']) task = Path(task_path) if task_path is not None else tc.task_dir(row['name']) config = tomllib.loads((task / 'task.toml').read_text()) instance = json.loads((task / 'tests/instance.json').read_text()) @@ -44,6 +44,16 @@ def validate_task(row, task_path=None): 'tests/Dockerfile': {f'/tests/{name}.py': ROOT / f'game_first_exam/runtime/{name}.py' for name in ('grade', 'config_schema', 'reducers')}, } + client = getattr(schema, 'STANDARD_CLIENT', None) if mode == 'standard' else None + if client: + agent_paths = paths['environment/Dockerfile'] + agent_paths['/app/standard_game_client.py'] = agent_paths['/app/game_client.py'] + agent_paths['/app/game_client.py'] = schema_paths()[row['benchmark']].with_name(client) + if client: + bench_root = schema_paths()[row['benchmark']].parent + paths['environment/Dockerfile']['/app/vizdoom_actions.py'] = bench_root / 'vizdoom_actions.py' + paths['environment/sim/Dockerfile']['/srv/vizdoom_actions.py'] = bench_root / 'vizdoom_actions.py' + paths['environment/sim/Dockerfile']['/srv/vizdoom_server.py'] = bench_root / 'vizdoom_server.py' paths['environment/sim/Dockerfile']['/srv/adapter.py'] = ROOT / f"game_first_exam/benchmarks/{row['benchmark']}/adapter.py" paths['tests/Dockerfile']['/tests/metric_rules.py'] = ROOT / f"game_first_exam/benchmarks/{row['benchmark']}/metric_rules.py" for file, prefix in [('environment/sim/Dockerfile', '/srv'), ('tests/Dockerfile', '/tests')]: @@ -100,7 +110,7 @@ def preflight(suite): plans = {row['name']: validate_task(row) for row in suite['tasks']} metrics = {} for task, _, instance in plans.values(): - previous = metrics.setdefault(instance['benchmark'], instance['metric_spec']) + previous = metrics.setdefault(metric_scope(instance), instance['metric_spec']) if previous != instance['metric_spec']: raise ValueError(f'{task.name}: incompatible metric definitions within benchmark') known_images = {p.parent.name: files_image.image(p.parent.name) for p in files_image.manifests()} diff --git a/scripts/game_reports.py b/scripts/game_reports.py index ec34e9e..8d20851 100644 --- a/scripts/game_reports.py +++ b/scripts/game_reports.py @@ -18,6 +18,7 @@ RUNNER_VERSION, validate_report_code, ) +from game_schemas import is_scenario_score from reducers import resolve from write_task_results import classify, load_json @@ -63,7 +64,9 @@ def aggregate(trials, records): raise ValueError(f"trials outside frozen suite: {sorted(unexpected)}") groups = {} for name, record in records.items(): - validate_metric_spec(record["metric_spec"]) + spec = record["metric_spec"] + validate_metric_spec(spec) + scored = is_scenario_score(record) group = groups.setdefault( record["benchmark"], { @@ -74,18 +77,28 @@ def aggregate(trials, records): "environment_errors": 0, "infrastructure_errors": 0, "evidence_errors": 0, - "metric_spec": record["metric_spec"], + "metric_spec": None, "successes": 0, - "success_label": record["metric_spec"]["success_label"], - "primary_metric": record["metric_spec"]["primary"], + "success_label": None, + "primary_metric": None, "families": {}, "rows": [], + "scored_expected": 0, + "completion_expected": 0, }, ) - if group["metric_spec"] != record["metric_spec"]: - raise ValueError("incompatible metric definitions within benchmark") + if scored: + group["scored_expected"] += 1 + else: + if group["metric_spec"] is None: + group.update(metric_spec=spec, primary_metric=spec["primary"], success_label=spec["success_label"]) + if group["metric_spec"] != spec: + raise ValueError("incompatible metric definitions within benchmark") + group["completion_expected"] += 1 group["expected"] += 1 - family = group["families"].setdefault(record["family"], {"expected": 0, "rows": []}) + family = group["families"].setdefault(record["family"], {"expected": 0, "rows": [], "spec": spec, "scored": scored}) + if family["spec"] != spec: + raise ValueError("incompatible metric definitions within task family") family["expected"] += 1 matches = [row for row in trials if row["task"] == name] if not matches: @@ -95,8 +108,8 @@ def aggregate(trials, records): raise ValueError(f"multiple attempts for {name}; void infrastructure attempts explicitly first") row = matches[0] row.update({k: record[k] for k in ("benchmark", "family", "seed", "digest")}) - row["primary_metric"] = group["primary_metric"] - row["primary_score"] = row["native_metrics"].get(group["primary_metric"]) + row["primary_metric"] = spec["primary"] + row["primary_score"] = row["native_metrics"].get(spec["primary"]) if not row["valid"]: group["infra_errors"] += 1 category = row.get("error_category") or "infrastructure" @@ -109,30 +122,48 @@ def aggregate(trials, records): if type(row["primary_score"]) not in (int, float) or not math.isfinite(row["primary_score"]): raise ValueError(f"missing or nonfinite primary score in valid trial: {name}") group["valid"] += 1 - group["successes"] += int(row["success"] == 1) + if scored: + row.update(success=None, status="scored", outcome_class="scored") + else: + group["successes"] += int(row["success"] == 1) group["rows"].append(row) family["rows"].append(row) for group in groups.values(): rows = group.pop("rows") group["complete"] = group["valid"] == group["expected"] - group["mean_primary_score"] = mean(row["primary_score"] for row in rows) if rows else None - group["success_rate"] = group["successes"] / group["valid"] if rows else None + scored_expected = group.pop("scored_expected") + expected = group.pop("completion_expected") + objectives = [row for row in rows if row.get("status") != "scored"] + objective_valid = len(objectives) + objective_complete = objective_valid == expected + group["mean_primary_score"] = mean(row["primary_score"] for row in objectives) if objectives else None + group["success_rate"] = group["successes"] / objective_valid if objectives else None group["mean_steps"] = mean(row["steps"] for row in rows) if rows else None observed = [] for family in group["families"].values(): selected = family.pop("rows") + spec = family.pop("spec") + scored = family.pop("scored") family["valid"] = len(selected) - family["successes"] = sum(row["success"] == 1 for row in selected) + family["successes"] = None if scored else sum(row["success"] == 1 for row in selected) family["mean_primary_score"] = mean(row["primary_score"] for row in selected) if selected else None - if selected: + if scored_expected: + family["primary_metric"] = spec["primary"] + if selected and not scored: observed.append(family["mean_primary_score"]) - group["macro_primary_score"] = mean(observed) if group["complete"] else None + group["macro_primary_score"] = mean(observed) if objective_complete and observed else None group["observed_macro_primary_score"] = mean(observed) if observed else None + if scored_expected: + group["completion_expected"] = expected + group["completion_valid"] = objective_valid + group["scored_expected"] = scored_expected + group["scored_valid"] = group["valid"] - objective_valid spec = group["metric_spec"] - extra = resolve(spec["reducer"], spec["reducer_version"])(rows, group["complete"]) - if extra.keys() & group.keys(): - raise ValueError("reducer cannot overwrite common completeness/accounting fields") - group.update(extra) + if spec is not None: + extra = resolve(spec["reducer"], spec["reducer_version"])(objectives, objective_complete) + if extra.keys() & group.keys(): + raise ValueError("reducer cannot overwrite common completeness/accounting fields") + group.update(extra) valid = sum(group["valid"] for group in groups.values()) return { "benchmarks": groups, @@ -197,7 +228,9 @@ def write_report(job, snapshot, output=None, configuration_link="suite-snapshot. lines.append( f"| {benchmark} | {group['valid']}/{group['expected']} | {group['primary_metric']} | " f"{fmt(group['mean_primary_score'])} | {fmt(group['macro_primary_score'])} | " - f"{group['success_label']} | {group['successes']}/{group['valid']} |" + f"{group['success_label'] or '—'} | " + + (f"{group['successes']}/{group.get('completion_valid', group['valid'])} |" + if group.get('completion_expected', group['expected']) else "— |") ) if "crafter_score" in group: notes += [ @@ -206,6 +239,24 @@ def write_report(job, snapshot, output=None, configuration_link="suite-snapshot. "", ] lines += notes + if any("scored_expected" in group for group in summary["benchmarks"].values()): + lines += [ + "", + "## Per-scenario results", + "", + "| Task | Status | Objective completed | Native return | Native tics | Native statistics |", + "| --- | --- | --- | ---: | ---: | --- |", + ] + for row in trials: + if "scored_expected" not in summary["benchmarks"][row["benchmark"]]: + continue + metrics = row["native_metrics"] + keys = ("killcount", "health", "armor", "ammo2", "itemcount", "selected_weapon", "selected_weapon_ammo") + stats = ", ".join(f"{key}: {metrics[key]}" for key in keys if key in metrics) or "—" + objective = ("yes" if row["success"] else "no") if row["valid"] and row["success"] is not None else "—" + lines.append(f"| {row['task']} | {row['status']} | {objective} | {fmt(row['return'])} | " + f"{metrics.get('native_tics', '—')} | {stats} |") + lines += ["", "The success denominator covers objective tasks only. Native returns are reported by scenario."] lines += [ "", "No cross-benchmark score is computed. A Crafter milestone failure is still a valid achievement score.", diff --git a/scripts/game_schemas.py b/scripts/game_schemas.py index 75d4f4b..64eaf40 100644 --- a/scripts/game_schemas.py +++ b/scripts/game_schemas.py @@ -49,3 +49,17 @@ def schema_metadata(name): path = schema_paths()[name] return {'contract_version': schema.SCHEMA_VERSION, 'source': str(path.relative_to(ROOT)), 'sha256': hashlib.sha256(path.read_bytes()).hexdigest()} + + +def is_scenario_score(record): + """Native scores declared by the benchmark are comparable within the scenario.""" + metric = record["metric_spec"]["primary"] + if metric != "native_return": + return False + schema = load_schema(record["benchmark"]) + return metric in getattr(schema, "PER_SCENARIO_METRICS", ()) + + +def metric_scope(record): + family = record["family"] if is_scenario_score(record) else None + return record["benchmark"], family diff --git a/scripts/task_conventions.py b/scripts/task_conventions.py index 36b7e5c..8a88faf 100644 --- a/scripts/task_conventions.py +++ b/scripts/task_conventions.py @@ -73,6 +73,7 @@ # ci_checks/ci_scope.py --check holds its UNITS / FILES_IMAGE to it. A new benchmark adds one row here. BENCHMARK_TABLE = [ ("minihack-", "MiniHack", "minihack"), + ("vizdoom-", "ViZDoom", "vizdoom"), ("babaisai-", "Baba Is AI", "babaisai"), ("crafter-", "Crafter", "crafter"), ("textworld-", "TextWorld", "textworld"), @@ -205,6 +206,12 @@ assert set(CUTOFF_NOTE) == set(MODE_REGISTRY), "every mode of MODE_REGISTRY needs its CUTOFF_NOTE (PROTOCOL §5)" # A benchmark whose service counts the limit its own way has a note of its own (PROTOCOL §5). CUTOFF_NOTE_OWN = {} # (benchmark label, mode) -> its note +CUTOFF_NOTE_OWN[("ViZDoom", "standard")] = ( + "The wall-clock budget starts with your session and includes service startup, planning and tool execution. " + "At the cutoff the episode is graded as it stands. Use the `deadline_utc` and `time_left_s` fields in " + "`/run/rcb-limits/usage.json` to track the session deadline. The client's `time_left_s` counts from the " + "first `observe()` or accepted action, whichever comes first. `spec()` and `status()` do not start that clock." +) CUTOFF_NOTE_TASK = {} CUTOFF_NOTE_TASK["crafter-survival-i01-realtime"] = ( "The wall-clock budget starts with your session and includes startup, planning and tool execution. " @@ -812,12 +819,21 @@ def external_paragraph(text: str) -> str | None: def render_external(task: "Path | str" = "") -> str: - """instruction.md's `## External material` (PROTOCOL §5): the same words in every allowlist task (EXTERNAL_TEXT); a - task with open egress (`[agent] network_mode = "public"`, network_of) keeps its own paragraph (EXTERNAL_TEXT_OPEN - when it has none).""" + """Render the external-material policy from the task network mode and benchmark. + + Open-network tasks keep their own paragraph. ViZDoom documents the live-episode + boundary and uses the allowlist of the run. Other allowlist tasks use the shared policy. + """ text = EXTERNAL_TEXT if isinstance(task, Path) and network_of(task) == "open": text = external_paragraph(read_text(task / "instruction.md") or "") or EXTERNAL_TEXT_OPEN + elif isinstance(task, Path) and bench_of(task) == "ViZDoom": + text = ( + "You may read the public client and use general-purpose libraries. Network access follows the " + "run's allowlist, including for package installation. Solve the task using the live episode. " + "Do not access scenario assets or maps, hidden engine state, other game instances, or solutions, " + "rollouts or trained policies specific to this task." + ) # the words above are the baseline every task carries; a task may add STRICTER requirements of # its own on top (never looser), as `[metadata.honour] stricter = "..."` in its task.toml, rendered after them stricter = ((metadata_of(task).get("honour") or {}).get("stricter", "")) if isinstance(task, Path) else "" diff --git a/scripts/task_resources.toml b/scripts/task_resources.toml index f5e2106..808e5b9 100644 --- a/scripts/task_resources.toml +++ b/scripts/task_resources.toml @@ -21,3 +21,9 @@ match = "^minihack-.*-standard$" main = { cpus = 1, memory_gb = 1, pids = 256, disk_gb = 2 } sim = { cpus = 1, memory_gb = 1, pids = 128 } measured = "Initial CPU-only integration caps; measure during validation" + +[[cap]] +match = "^vizdoom-.*-standard$" +main = { cpus = 1, memory_gb = 1, pids = 256, disk_gb = 2 } +sim = { cpus = 1, memory_gb = 1, pids = 128 } +measured = "Initial CPU-only caps for ViZDoom RGB capture and encoding"