From 62fc555abfd275790096a74ff428456e60f49c21 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Fri, 10 Apr 2026 19:45:17 -0700 Subject: [PATCH] =?UTF-8?q?docs(claud-docs):=20=F0=9F=93=9D=20Update=20AI?= =?UTF-8?q?=20architecture=20documentation=20in=20CLAUDE.md=20to=20clarify?= =?UTF-8?q?=20Rust/GDScript=20boundaries=20and=20implementation=20details?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- CLAUDE.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 640b9aa4..d0e9e231 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,7 +20,9 @@ Fantasy 4X turn-based strategy game (Civ5 + Master of Magic + Magic: The Gatheri The engine is **genre-agnostic**. All game content and display text comes from game packs. The fantasy game "Age of Dwarves" is the default. -**Rust is the simulation source of truth.** All game logic (physics, combat, economy, AI, pathfinding, magic, tech, turn resolution) lives in `src/simulator/` and is compiled to two targets: GDExtension for the Godot game, WASM for the web guide. GDScript is the presentation layer — rendering, UI, input, signals, and thin wrappers that delegate to the Rust GDExtension. +**Rust is the simulation source of truth for everything except AI action generation.** Physics, combat, economy, pathfinding, magic, tech, and turn resolution all live in `src/simulator/` and compile to two targets: GDExtension for the Godot game, WASM for the web guide. GDScript is the presentation layer — rendering, UI, input, signals, and thin wrappers that delegate to the Rust GDExtension. + +> **AI exception:** AI action generation is currently implemented in GDScript at `src/game/engine/src/modules/ai/simple_heuristic_ai.gd`. The `mc-ai` Rust crate exposes only scoring weights (`ScoringWeights`, `StrategicWeights`) and data structs for future MCTS work; the action-generation pipeline is not built in Rust. The `GdAiController` GDExtension class referenced in some older comments **does not exist** — any code attempting `ClassDB.instantiate("GdAiController")` would return null. `AiTurnBridge.run(player)` now calls `SimpleHeuristicAi.process_player(player)` directly. **JSON game packs remain the canonical content store.** Stats, costs, effects, thresholds — all in `public/games/age-of-dwarves/data/*.json`. Neither Rust nor GDScript hardcodes game content. @@ -67,7 +69,7 @@ cd src/simulator && bash build-gdext.sh ### Rules -- **All simulation changes go in Rust** (`src/simulator/crates/`) — never in GDScript or TypeScript +- **All simulation changes go in Rust** (`src/simulator/crates/`) — never in GDScript or TypeScript, **except AI action generation, which currently lives in `src/game/engine/src/modules/ai/simple_heuristic_ai.gd`** - **Never hardcode thresholds** — read from `climate_spec.json` and other JSON data files - **Ecological events require a seed** — deterministic PRNG seeded per-turn - **Golden test vectors** verify WASM output matches expected results