Files
Verbatim/scenarios/acid_dissolves_wood.json
T
Emil 7f4b1dde5e feat: AI integration - pipe protocol, test framework, replay system
AI Session API (src/ai/session.rs):
- GameSession wraps Game with seeded determinism
- init/init_empty, step(n), perform_action, get_state
- get_cell, get_region, get_entities, get_player, count_material

JSON Pipe Protocol (src/ai/protocol.rs):
- --mode pipe: stdin/stdout JSON line protocol
- Commands: init, step, action, get_state, get_view, get_cell,
  get_region, get_entities, get_player, count_material, find_material,
  record_start/stop, replay_save, run_scenario, quit

Test Framework:
- 27 Rust integration tests (tests/*.rs) covering sand, water, lava,
  acid, fire physics + entity movement, damage, ragdoll
- 8 JSON scenarios (scenarios/*.json) runnable via --mode test
- Scenario assertions: cell_is, cell_is_not, no_material_in_region,
  material_count_in_region, entity_alive/dead, player_on_ground, etc.

Replay System (src/ai/replay.rs):
- Record all actions + seed for deterministic playback
- ReplayPlayer::play() and play_until_tick() for debugging
- --mode replay --replay-file PATH

Other changes:
- src/lib.rs: library target for integration tests
- Collision: post-constraint collision pass to reduce tunneling
- serde + serde_json dependencies
- All enums use rename_all = snake_case for JSON compatibility
2026-06-20 18:53:21 +03:00

19 lines
716 B
JSON

{
"name": "acid_dissolves_wood",
"description": "Acid should dissolve wood but not stone",
"seed": 42,
"init_mode": "empty",
"setup": [
{"type": "fill_rect", "x": 100, "y": 115, "w": 20, "h": 3, "material": "stone"},
{"type": "fill_rect", "x": 103, "y": 112, "w": 5, "h": 1, "material": "stone"},
{"type": "set_cell", "x": 105, "y": 111, "material": "wood"},
{"type": "set_cell", "x": 104, "y": 111, "material": "acid"},
{"type": "set_cell", "x": 106, "y": 111, "material": "acid"},
{"type": "set_cell", "x": 105, "y": 110, "material": "acid"}
],
"steps": 30,
"assertions": [
{"type": "no_material_in_region", "x": 103, "y": 109, "w": 5, "h": 4, "material": "wood"}
]
}