From 8e3c6fc1917b844cf270b6f0e473bcaf353992f2 Mon Sep 17 00:00:00 2001 From: goose Date: Fri, 2 Oct 2026 10:19:12 -0400 Subject: [PATCH] docs: add complete DCWASCII Godot port plan --- .../2026-10-02-full-dcwascii-godot-port.md | 710 ++++++++++++++++++ 1 file changed, 710 insertions(+) create mode 100644 docs/superpowers/plans/2026-10-02-full-dcwascii-godot-port.md diff --git a/docs/superpowers/plans/2026-10-02-full-dcwascii-godot-port.md b/docs/superpowers/plans/2026-10-02-full-dcwascii-godot-port.md new file mode 100644 index 0000000..26c855c --- /dev/null +++ b/docs/superpowers/plans/2026-10-02-full-dcwascii-godot-port.md @@ -0,0 +1,710 @@ +# Portage complet DCWASCII vers Godot — Plan d’implémentation + +> **Pour les agents d’exécution :** COMPÉTENCE REQUISE : utiliser `subagent-driven-development` (recommandé) ou `executing-plans` pour exécuter ce plan tâche par tâche. Les étapes utilisent des checkboxes (`- [ ]`) pour le suivi. + +**Objectif :** livrer sous Godot 4 un jeu graphique complet fonctionnellement équivalent à DCWASCII, jouable sous Linux et Windows, en conservant DCWASCII comme oracle de règles, de contenu et de tests de parité. + +**Architecture :** le jeu graphique reste une application Godot/GDScript native : aucun processus Python n’est requis lors de l’exécution Windows/Linux. Les JSON de DCWASCII deviennent la source de contenu importée et validée dans `res://data/`; les règles sont portées par agrégats de domaine GDScript sans dépendance aux nœuds Godot. La couche `presentation` consomme une file d’événements de jeu pour le rendu, l’UI, les animations et l’audio sans modifier les règles. + +**Tech stack :** Godot 4.5, GDScript, GUT 9.5, scripts Bash/Python standard-library pour les vérifications, Xvfb Linux, export Godot Windows/Linux, Gitea local, Kanita. + +**Spécification de référence :** `DCWASCII/cahierDesCharges.md`, `DCWASCII/README.md`, `DCWASCII/dcw/`, `DCWASCII/tests/`. Les règles en production et les tests ASCII sont l’oracle de parité ; le prototype Godot actuel est seulement un socle technique, pas la cible fonctionnelle. + +## Contraintes globales + +- Ne jamais modifier `DCWASCII` pendant le portage ; il est lu et exécuté seulement comme référence. +- Tout comportement de jeu ajouté dans Godot est écrit et testé d’abord en GDScript avant son implémentation. +- Chaque tranche Kanita produit une démonstration jouable, des tests unitaires GUT, au moins un E2E sur la vraie scène Godot et une capture Xvfb lorsque la présentation évolue. +- Les données de contenu importées depuis ASCII gardent leurs identifiants JSON ; les textes restent français lorsque ce sont des textes de contenu ou d’interface destinés au joueur. +- Les noms de fichiers, classes, fonctions, variables, événements et tests sont en anglais. +- Les assets existants DCSS CC0 sont utilisables. Chaque nouvel asset doit être ajouté à `assets/ASSET_REGISTRY.md` avec source, licence et modifications. +- Les fichiers `.uid` associés à un script GDScript suivi sont versionnés ; `.godot/`, `artifacts/`, `.claude/`, `.superpowers/` et worktrees restent ignorés. +- Le brouillard final est noir/bleu nuit : visible = normal, exploré = sombre lisible, inconnu = noir presque total. Aucun voile blanc. +- `scripts/godot-import.sh` doit être appelé par tous les runners avant GUT ou un lancement Godot, afin que tout worktree propre soit reproductible. +- Toute PR est ouverte vers `main`, revue avant fusion, et associée à une tâche Kanita mise à `Review` avec ses preuves. + +--- + +## État initial reconnu + +Le dépôt Godot contient déjà : déplacement tour par tour, FOV, combat minimal, HUD, portes, coffres de démonstration, escalier de démonstration, tests GUT/E2E et capture Xvfb. Ce code est conservé seulement s’il respecte les contrats définis ci-dessous. + +Les écarts à combler sont majeurs : génération procédurale, plusieurs étages, contenu JSON complet, équipement/inventaire/butin, combat avancé, magie, IA complète, PNJ/dialogues/quêtes, compagnon/groupe, progression, succès/audience/factions, sauvegardes, commerce/craft, pression temporelle, UI complète, audio réel et feedback visuel. + +## Cible fonctionnelle de parité + +| Domaine ASCII | Modules ASCII oracle | Cible Godot | +| --- | --- | --- | +| Monde | `world/dungeon.py`, `world/generator.py`, `world/fov.py`, `world/surface.py` | `scripts/domain/world/` | +| Session/étages/temps | `game.py` | `scripts/domain/run/`, `scripts/game/` | +| Entités/IA | `entities/`, `ai/` | `scripts/domain/entities/`, `scripts/domain/ai/` | +| Combat/statuts | `combat/`, `magic/`, `status_effects.py`, `conditions.py`, `traps.py` | `scripts/domain/combat/`, `scripts/domain/magic/` | +| Objets/butin | `items/`, `inventory/`, `crafting.py` | `scripts/domain/items/`, `scripts/domain/inventory/` | +| Narratif | `dialogue/`, `events/`, `quests/` | `scripts/domain/narrative/` | +| Progression | `attributes.py`, `skills.py`, `perks.py`, `races.py`, `hero_classes.py`, `titles.py` | `scripts/domain/progression/` | +| Métajeu | `achievements.py`, `audience.py`, `factions.py`, `syndicate.py`, `recap.py` | `scripts/domain/meta/` | +| Sauvegarde | `save/save.py` | `scripts/infrastructure/save/` | +| Présentation | `ui/app.py`, `audio.py` | `scenes/`, `scripts/presentation/`, `scripts/infrastructure/audio/` | + +## Structure cible du dépôt Godot + +```text +assets/ + dcss/ # assets CC0 déjà vérifiés + ui/ # UI/feedback sous licence consignées + effects/ # particules/spritesheets consignés + ASSET_REGISTRY.md +data/ + ascii/ # copies versionnées des JSON de contenu DCWASCII + schemas/ # règles de validation des entrées attendues +scenes/ + bootstrap/ + menu/ + game/ + ui/ + overlays/ + entities/ +scripts/ + domain/ + content/ + world/ + run/ + entities/ + ai/ + combat/ + magic/ + items/ + inventory/ + narrative/ + progression/ + meta/ + game/ + presentation/ + infrastructure/ + save/ + audio/ + content/ +tests/ + unit/ + integration/ + e2e/ + fixtures/ + scripts/ +``` + +## Contrats architecturaux à établir au début + +```gdscript +class_name GameEvent +var kind: StringName +var actor_id: StringName +var target_id: StringName +var cell: Vector2i +var payload: Dictionary + +class_name RunState +var seed: String +var current_floor: int +var player: PlayerState +var party: Array[ActorState] +var floors: Dictionary[int, FloorState] +var log: Array[GameEvent] + +class_name FloorState +var seed: int +var map: GridMapState +var rooms: Array[RoomState] +var entrance: Vector2i +var exit: Vector2i +var enemies: Dictionary[StringName, EnemyState] +var npcs: Dictionary[StringName, NpcState] +var chests: Dictionary[Vector2i, ChestState] +var ground_items: Dictionary[Vector2i, Array[ItemInstance]] + +func resolve_action(run: RunState, action: PlayerAction) -> Array[GameEvent] +func present_events(events: Array[GameEvent]) -> void +``` + +Règles : le domaine ne manipule aucun `Node`, `Sprite2D`, `Control`, `Tween`, `AudioStreamPlayer` ou chemin de scène. La présentation ne modifie jamais `RunState` ; elle reçoit les événements produits par le domaine. + +## Matrice de parité obligatoire + +Avant de déclarer le port complet, chaque test ASCII est classé dans `docs/parity/ASCII_TEST_MATRIX.md` : + +- `ported` : test GUT/intégration/E2E Godot équivalent nommé ; +- `replaced` : comportement prouvé à un seam supérieur, justification précise ; +- `not_applicable` : uniquement si le comportement dépend exclusivement de curses et que l’UX Godot équivalente est couverte ; +- `blocked` : dépendance à une tranche non terminée. + +Aucune ligne ne peut rester sans état. Les tests critiques de génération, combat, inventaire, sauvegarde, quêtes, compagnon, temps, succès et progression doivent être `ported` ou `replaced`, jamais `not_applicable`. + +--- + +# Découpage Kanita de l’epic complet + +Kanita doit contenir **un projet maître** `DCW — Portage complet Godot`, puis une liste par tranche ci-dessous et une tâche agent par liste. Chaque tâche contient la checklist TDD indiquée dans sa tranche. Les tranches appartenant à des mêmes fichiers sont séquentielles ; les branches ne sont créées que depuis `main` ou la tête `Review` du vrai bloqueur. + +## Vague A — Fondation de parité (A1–A6) + +### Task A1: Contrat de contenu, import JSON et matrice de parité + +**Files:** +- Create: `data/ascii/`, `scripts/infrastructure/content/content_loader.gd`, `scripts/domain/content/content_catalog.gd`, `docs/parity/ASCII_TEST_MATRIX.md` +- Create: `tests/unit/test_content_loader.gd`, `tests/integration/test_ascii_content_parity.gd` +- Modify: `README.md`, `scripts/verify.sh` + +**Interfaces:** +- Produces `ContentCatalog.load_from_directory(path: String) -> ContentCatalog`. +- Produces `ContentCatalog.get_item(id: StringName)`, `get_enemy`, `get_spell`, `get_loot_table`, `get_npc`, `get_quest`. + +- [ ] Write failing GUT test with fixture JSON asserting that `get_item(&"weapon_rusty_sword")` preserves id, name, category, rarity and damage. +- [ ] Run `./scripts/test-unit.sh`; expect `ContentCatalog` absent. +- [ ] Copy all JSON content and dialogue/event/quest subdirectories from ASCII into `data/ascii/`, preserving ids and UTF-8; implement parser validation with explicit diagnostic for missing required `id`. +- [ ] Run focused test green, then integration test checking every ASCII id has exactly one Godot catalog entry. +- [ ] Add matrix rows for all ASCII test modules and initial owner/target slice. +- [ ] Run `./scripts/verify.sh`, commit `feat: import ASCII content catalog`. + +### Task A2: Core run aggregate, deterministic RNG and event journal + +**Files:** +- Create: `scripts/domain/run/run_state.gd`, `scripts/domain/run/player_action.gd`, `scripts/domain/run/game_event.gd`, `scripts/domain/run/deterministic_rng.gd` +- Create: `tests/unit/test_deterministic_rng.gd`, `tests/unit/test_run_event_journal.gd` +- Modify: `scripts/game/game.gd` + +**Interfaces:** +```gdscript +func DeterministicRng.from_seed(seed: String) -> DeterministicRng +func RunState.append_events(events: Array[GameEvent]) -> void +func RunState.recent_events(count: int) -> Array[GameEvent] +``` + +- [ ] Write red test asserting two RNGs with seed `"TESTSEED-floor1"` produce equal first 20 values and a different seed does not. +- [ ] Implement deterministic local PRNG without using global `randf`/`randi`. +- [ ] Write red test asserting events retain turn, floor, kind and payload in insertion order. +- [ ] Implement run journal and make current HUD log consume `GameEvent.message` instead of ad hoc `TurnResult.message`. +- [ ] Add E2E that executes an action on `Game.tscn` and observes the same event in run log and HUD. +- [ ] Verify and commit `feat: add deterministic run state and events`. + +### Task A3: Presentation event queue and short non-blocking feedback + +**Files:** +- Create: `scripts/presentation/event_presenter.gd`, `scripts/presentation/combat_feedback.gd`, `scenes/overlays/CombatFeedback.tscn` +- Modify: `scripts/game/game.gd`, `scripts/presentation/actor_view.gd`, `scenes/Game.tscn` +- Test: `tests/unit/test_event_presenter.gd`, `tests/e2e/test_feedback_events_e2e.gd` + +**Interfaces:** +```gdscript +func EventPresenter.enqueue(events: Array[GameEvent]) -> void +func EventPresenter.present_next() -> void +signal event_presented(event: GameEvent) +``` + +- [ ] Write red test asserting a `damage_dealt` event produces one queued presentation item and does not mutate run state. +- [ ] Implement queue, 100 ms movement interpolation, 140 ms hit flash, floating damage label and 180 ms death fade using presentation-only nodes. +- [ ] Write red test that completion emits `event_presented` in the original event order. +- [ ] Implement deterministic test mode that completes visual feedback immediately when `Engine.is_editor_hint()` is false and `--test-mode` is present. +- [ ] Add E2E confirming domain HP changes immediately while presentation reports one hit feedback event. +- [ ] Verify/capture and commit `feat: add event-driven combat feedback`. + +### Task A4: Black fog, visual palette and accessibility baseline + +**Files:** +- Modify: `scripts/presentation/map_renderer.gd`, `scripts/check-visual-capture.py`, `scenes/Game.tscn`, `assets/ASSET_REGISTRY.md` +- Test: `tests/unit/test_map_renderer_fog.gd`, `tests/e2e/test_black_fog_e2e.gd` + +**Interfaces:** +- Visible cells render unmodulated. +- Explored cells render black-blue tinted with texture visible only at close view. +- Unknown cells render `Color(0.005, 0.008, 0.02, 1.0)`. + +- [ ] Write red color/luminance test requiring unknown luminance lower than explored luminance and no explored overlay brighter than 0.35 in normalized luminance. +- [ ] Implement black/blue palette and texture-preserving explored tint. +- [ ] Extend capture analyzer to identify visible, explored and unknown sampled pixels without third-party Python packages. +- [ ] Add E2E walking out of sight and assert all three states. +- [ ] Verify/capture and commit `feat: restore black dungeon fog`. + +### Task A5: Input/action router and complete command vocabulary skeleton + +**Files:** +- Create: `scripts/game/action_router.gd`, `scripts/game/input_bindings.gd` +- Modify: `project.godot`, `scripts/game/game.gd`, `README.md` +- Test: `tests/unit/test_action_router.gd`, `tests/e2e/test_input_action_router_e2e.gd` + +**Interfaces:** +```gdscript +func ActionRouter.action_from_input(event: InputEvent) -> PlayerAction +func ActionRouter.submit(action: PlayerAction) -> Array[GameEvent] +``` + +- [ ] Write red tests mapping move, wait, interact, attack, ranged, cast, talk, rest, inventory, character, quest, audience, recap, map and options actions. +- [ ] Register all actions in Godot Input Map; each has keyboard help and is rebindeable through a future settings UI. +- [ ] Route the already implemented move/interact through `ActionRouter`; unsupported actions emit `action_unavailable` event rather than silently doing nothing. +- [ ] Add E2E for keyboard movement/interact and `action_unavailable` from one future command. +- [ ] Verify and commit `feat: add unified player action router`. + +### Task A6: Main menu, creation flow, difficulty and run lifecycle + +**Files:** +- Create: `scenes/menu/MainMenu.tscn`, `scenes/menu/CharacterCreation.tscn`, `scripts/presentation/menu/main_menu.gd`, `scripts/presentation/menu/character_creation.gd` +- Create: `scripts/domain/run/run_settings.gd` +- Test: `tests/unit/test_run_settings.gd`, `tests/e2e/test_new_run_creation_e2e.gd` + +**Interfaces:** +```gdscript +class_name RunSettings +var seed: String +var difficulty_id: StringName +var permadeath: bool +var pet_enabled: bool +``` + +- [ ] Write red test accepting the four ASCII difficulty ids and two death modes. +- [ ] Implement title menu: New Run, Continue, Load Slot, Options, Quit. +- [ ] Implement character creation: name, base archetype, pet choice, seed option, difficulty, classic/permadeath. +- [ ] Create a new `RunState` and generated floor 0/floor 1 only through the new lifecycle seam. +- [ ] Add E2E menu → creation → Game scene → event `game_started`. +- [ ] Verify/capture and commit `feat: add run creation lifecycle`. + +## Vague B — Monde procédural et navigation d’étages (B1–B6) + +### Task B1: Modèle de sol, salles et cartes de données + +**Files:** +- Create: `scripts/domain/world/room_state.gd`, `scripts/domain/world/floor_state.gd`, `scripts/domain/world/tile_state.gd` +- Modify: `scripts/domain/grid_map_state.gd` +- Test: `tests/unit/test_floor_state.gd` + +- [ ] Write red test creating rooms, tile room ids, entrance, exit, chest and ground item dictionaries, then serializing/deserializing the floor state. +- [ ] Implement `FloorState` with typed rooms, entrance/exit, entities, chests, events, explored state and metadata. +- [ ] Replace prototype-only map fields in `GameState` with `RunState.current_floor_state()` adapter while preserving current renderer seam. +- [ ] Verify and commit `refactor: introduce full floor state model`. + +### Task B2: Room placement and connected spanning-tree generator + +**Files:** +- Create: `scripts/domain/world/floor_generator.gd`, `scripts/domain/world/room_graph.gd` +- Test: `tests/unit/test_floor_generator_rooms.gd`, `tests/integration/test_floor_generator_connectivity.gd` + +**Interfaces:** +```gdscript +func FloorGenerator.generate(seed: String, floor_number: int, catalog: ContentCatalog) -> FloorState +``` + +- [ ] Write red test for a seed that requires at least 8 non-overlapping rooms inside an 80×50 map. +- [ ] Implement deterministic room placement with minimum size 5×4 and padding 2. +- [ ] Write red BFS test requiring all room centers connected via the spanning-tree graph. +- [ ] Carve rooms/corridors and connect each new room to its nearest prior room. +- [ ] Test 100 seeds: entry, exit and all room centers are reachable. +- [ ] Verify and commit `feat: generate connected dungeon rooms`. + +### Task B3: Doors, loops, entrance/exit distance and room kinds + +**Files:** +- Modify: `scripts/domain/world/floor_generator.gd`, `scripts/domain/world/room_state.gd` +- Test: `tests/unit/test_floor_generator_doors.gd`, `tests/integration/test_floor_generator_exit_path.gd` + +- [ ] Write red test requiring entrance and exit rooms to differ and exit graph distance to equal the maximum spanning-tree distance. +- [ ] Add room-boundary closed doors for tree corridors; main-route doors must always be openable without keys. +- [ ] Add local loop corridors only between nearby rooms, never required for entrance→exit reachability. +- [ ] Assign `entrance`, `combat`, `treasure`, `trap`, `sanctuary`, `shop`, `mystery`, `puzzle`, `arena`, `narrative`, `refuge`, `guild`, `boss` kinds using ASCII weights and floor gates. +- [ ] Test 100 seeds for a path that ignores only optional locked-loop gates. +- [ ] Verify and commit `feat: add procedural doors and room roles`. + +### Task B4: Population engine for enemies, chests, traps, NPCs and events + +**Files:** +- Create: `scripts/domain/world/floor_populator.gd`, `scripts/domain/world/spawn_rules.gd` +- Test: `tests/unit/test_floor_populator.gd`, `tests/integration/test_floor_population_safety.gd` + +- [ ] Write red test requiring entrance clear, no two blocking occupants on a cell, and no entity/chest/trap on stairs. +- [ ] Implement spawn selection filtered by content `min_floor`, room kind and occupied cells. +- [ ] Populate combat/boss rooms, treasure rooms, trap rooms, shops/guilds/NPC rooms and narrative/event rooms from catalog data. +- [ ] Test deterministic same-seed population and different-seed variation. +- [ ] Test 100 seeds: entrance clear, exit reachable, all placed content valid and reachable when non-secret. +- [ ] Verify and commit `feat: populate procedural floors`. + +### Task B5: Floor 0, descent/ascent and multi-floor state + +**Files:** +- Create: `scripts/domain/world/surface_generator.gd`, `scripts/domain/run/floor_transition.gd` +- Modify: `scripts/domain/run/run_state.gd`, `scripts/game/game.gd` +- Test: `tests/unit/test_floor_transition.gd`, `tests/e2e/test_descend_to_generated_floor_e2e.gd` + +- [ ] Write red test that floor 0 is hand-authored and floor 1 is procedural. +- [ ] Implement floor cache keyed by floor number and deterministic `seed-floorN` generation. +- [ ] Implement stairs up/down transitions, arrival positions, persistent opened chest/enemy/event state for visited floors. +- [ ] Add E2E: menu new run → floor 0 → descend → floor 1 generated → return to floor 0. +- [ ] Verify/capture and commit `feat: add multi-floor dungeon transitions`. + +### Task B6: Time pressure, beds, collapse and staircase gating + +**Files:** +- Create: `scripts/domain/run/floor_deadline.gd` +- Modify: `scripts/domain/run/run_state.gd`, `scripts/domain/world/floor_transition.gd`, HUD scenes +- Test: `tests/unit/test_floor_deadline.gd`, `tests/e2e/test_stair_deadline_e2e.gd` + +- [ ] Write red tests porting ASCII rules for deadline days, sleep day cost, warning, collapse and early stairs refusal. +- [ ] Implement deadline per floor, real-time tick seam and rest tick seam. +- [ ] Gate stairs exactly by configured accessible condition; show the remaining requirement in French UI, never an ambiguous “sortie atteinte”. +- [ ] Add E2E: early stairs blocked with explanatory prompt; deadline condition met; descent succeeds. +- [ ] Verify and commit `feat: add floor time pressure and gated stairs`. + +## Vague C — Combat, IA, magie et états (C1–C6) + +### Task C1: Statistiques complètes, attributs, compétences et conditions + +**Files:** +- Create: `scripts/domain/entities/player_state.gd`, `scripts/domain/entities/attributes.gd`, `scripts/domain/combat/status_effect.gd`, `scripts/domain/combat/condition_engine.gd` +- Test: `tests/unit/test_attributes.gd`, `tests/unit/test_status_effects.gd` + +- [ ] Write red tests porting max HP, focus, effective attributes and condition duration/tick rules. +- [ ] Implement player/enemy stat blocks and all data-backed attributes/skills needed by content. +- [ ] Implement condition application/evaluation mini-language used by perks, dialogue, class and items. +- [ ] Verify and commit `feat: add full attributes and conditions`. + +### Task C2: Melee combat parity, stances, wounds and death + +**Files:** +- Create: `scripts/domain/combat/combat_engine.gd`, `scripts/domain/combat/limb_wounds.gd` +- Modify: `scripts/domain/turn_resolver.gd` +- Test: `tests/unit/test_melee_combat.gd`, `tests/unit/test_limb_wounds.gd`, `tests/e2e/test_melee_feedback_e2e.gd` + +- [ ] Write red tests porting hit, defense, armor, critical, stance and death results from ASCII combat fixtures. +- [ ] Implement structured events `attack_started`, `attack_hit`, `damage_dealt`, `actor_died`, `xp_granted`, `loot_dropped`. +- [ ] Implement arm/leg/torso/head wounds and passive recovery rules. +- [ ] Connect C1 event presenter for real hit/death animations. +- [ ] Verify/capture and commit `feat: port melee combat and wounds`. + +### Task C3: Enemy AI, pathfinding and tactical behavior + +**Files:** +- Create: `scripts/domain/ai/pathfinding.gd`, `scripts/domain/ai/enemy_behaviors.gd` +- Test: `tests/unit/test_enemy_ai.gd`, `tests/integration/test_enemy_pathfinding.gd` + +- [ ] Write red test for deterministic path around a wall/door and no move onto player/ally/blocker. +- [ ] Implement A* or BFS grid pathfinding, aggressive/passive/ranged behavior and vision ranges from enemy data. +- [ ] Test same seed/action state gives same enemy turn events. +- [ ] Add E2E enemy detects, approaches, attacks and dies with feedback. +- [ ] Verify and commit `feat: port tactical enemy AI`. + +### Task C4: Ranged combat, ammunition and targeting + +**Files:** +- Create: `scripts/domain/combat/ranged_combat.gd`, `scenes/overlays/TargetingOverlay.tscn` +- Test: `tests/unit/test_ranged_combat.gd`, `tests/e2e/test_ranged_targeting_e2e.gd` + +- [ ] Write red tests for range, line of sight, ammunition use and invalid target rejection. +- [ ] Implement target selection overlay and data-backed ranged weapons. +- [ ] Present projectile events without changing resolved damage timing. +- [ ] Verify and commit `feat: port ranged combat`. + +### Task C5: Magic, focus, spells and cooldowns + +**Files:** +- Create: `scripts/domain/magic/spell_state.gd`, `scripts/domain/magic/magic_engine.gd`, `scenes/overlays/SpellTargetingOverlay.tscn` +- Test: `tests/unit/test_magic.gd`, `tests/e2e/test_spell_casting_e2e.gd` + +- [ ] Write red tests for focus cost, cooldown, range, target validation and spell damage using `spells.json` fixtures. +- [ ] Implement spell catalog use, learned spell state and focus regeneration. +- [ ] Add targeting, event presentation and HUD focus/cooldown display. +- [ ] Verify and commit `feat: port magic and spell targeting`. + +### Task C6: Traps, terrain, secrets, shrines and quest boards + +**Files:** +- Create: `scripts/domain/world/trap_engine.gd`, `scripts/domain/world/special_interactions.gd` +- Test: `tests/unit/test_traps_and_special_tiles.gd`, `tests/e2e/test_secret_trap_shrine_e2e.gd` + +- [ ] Write red tests for trap trigger/discovery/disarm, secret reveal, shrine and quest-board action events. +- [ ] Implement data-backed traps, perception checks and interaction prompts. +- [ ] Add visual markers that respect FOV/discovery state. +- [ ] Verify and commit `feat: port terrain and special interactions`. + +## Vague D — Objets, économie, inventaire et craft (D1–D6) + +### Task D1: Instances d’objets, inventaire et ramassage + +**Files:** +- Create: `scripts/domain/items/item_definition.gd`, `scripts/domain/items/item_instance.gd`, `scripts/domain/inventory/inventory_state.gd` +- Test: `tests/unit/test_inventory.gd`, `tests/e2e/test_pickup_inventory_e2e.gd` + +- [ ] Write red tests for stackability, instance ids, ground pickup and capacity rules from ASCII fixtures. +- [ ] Implement ground items, pickup action, inventory event and visual ground-item indicator. +- [ ] Add minimal inventory screen usable from action router. +- [ ] Verify and commit `feat: port item instances and inventory`. + +### Task D2: Loot tables, coffre de monde et panneau de récompense + +**Files:** +- Create: `scripts/domain/items/loot_resolver.gd`, `scripts/domain/items/world_chest.gd`, `scenes/ui/LootPanel.tscn` +- Test: `tests/unit/test_loot_resolver.gd`, `tests/e2e/test_world_chest_loot_e2e.gd` + +- [ ] Write red test using `loot_tables.json` fixture that chest opening yields deterministic gold/items/empty entry from seed. +- [ ] Implement `ChestState` with loot table, trap, lock and opened state. +- [ ] Make `chest_opened` events include exact `items`, `gold`, `empty`, `trap` payload; do not replace chest by floor before the result is recorded. +- [ ] Implement modal loot panel and journal entries such as `Coffre ouvert : +12 or, Potion de soin` or `Coffre ouvert : il est vide.` +- [ ] Add E2E opening chest, selecting Take All, inventory update and panel close. +- [ ] Verify/capture and commit `feat: add real chest loot and reward panel`. + +### Task D3: Equipment, comparison, identification and use + +**Files:** +- Create: `scripts/domain/inventory/equipment_state.gd`, `scripts/domain/items/item_identification.gd`, `scenes/ui/InventoryPanel.tscn` +- Test: `tests/unit/test_equipment.gd`, `tests/unit/test_identification.gd`, `tests/e2e/test_equip_use_item_e2e.gd` + +- [ ] Write red tests for equip slots, stat recompute, unidentified display, auto reveal on use/equip and drop. +- [ ] Implement equipment UI with detail and comparison panel. +- [ ] Implement consumable use, ally target selection hooks and identification action. +- [ ] Verify and commit `feat: port equipment and item identification`. + +### Task D4: Gold, shops, colonies and safe-room rest cost + +**Files:** +- Create: `scripts/domain/items/economy.gd`, `scenes/ui/ShopPanel.tscn` +- Test: `tests/unit/test_economy.gd`, `tests/e2e/test_shop_rest_e2e.gd` + +- [ ] Write red tests for colony multiplier, buy/sell validation, safe rest cost and insufficient gold. +- [ ] Implement shop catalog from NPC data, buy/sell and room rest interactions. +- [ ] Add E2E entering merchant dialog → shop → purchase → inventory/gold update. +- [ ] Verify and commit `feat: port shops and safe-room economy`. + +### Task D5: Crafting, recipes and alchemy + +**Files:** +- Create: `scripts/domain/items/crafting_engine.gd`, `scenes/ui/CraftingPanel.tscn` +- Test: `tests/unit/test_crafting.gd`, `tests/e2e/test_crafting_e2e.gd` + +- [ ] Write red tests for inputs, min floor, missing materials and output quantity using `recipes.json`. +- [ ] Implement recipe availability, craft action and inventory mutation. +- [ ] Verify and commit `feat: port crafting`. + +### Task D6: Full item-content import and generated content performance + +**Files:** +- Modify: content loader/catalog, loading scenes +- Test: `tests/integration/test_bulk_content_loading.gd`, `tests/e2e/test_large_catalog_menu_e2e.gd` + +- [ ] Write red test requiring all generated content IDs load and category/rarity/slot constraints hold. +- [ ] Implement pagination/search/virtualized list behavior in item/spell/achievement UI. +- [ ] Measure cold import and menu opening on Linux release build; record budget in README. +- [ ] Verify and commit `perf: support full ASCII generated content catalog`. + +## Vague E — Narratif, quêtes, PNJ et groupe (E1–E5) + +### Task E1: Dialogues JSON, conditions and effects + +**Files:** +- Create: `scripts/domain/narrative/dialogue_engine.gd`, `scripts/domain/narrative/dialogue_state.gd`, `scenes/ui/DialoguePanel.tscn` +- Test: `tests/unit/test_dialogue.gd`, `tests/e2e/test_npc_dialogue_e2e.gd` + +- [ ] Write red tests loading a dialogue JSON, filtering choices by condition and applying an effect. +- [ ] Implement NPC interaction, choice UI, conditions/effects and event journal. +- [ ] Add E2E merchant/guide dialogue choice. +- [ ] Verify and commit `feat: port data-driven dialogues`. + +### Task E2: Narrative events, puzzle state and quest boards + +**Files:** +- Create: `scripts/domain/narrative/event_engine.gd`, `scripts/domain/narrative/event_state.gd`, `scenes/ui/EventPanel.tscn` +- Test: `tests/unit/test_events.gd`, `tests/e2e/test_event_puzzle_e2e.gd` + +- [ ] Write red tests for one-shot event trigger, choices and persistent trigger state. +- [ ] Implement event JSON dispatch, terminal/note/vending/puzzle panels and event completion events. +- [ ] Verify and commit `feat: port world narrative events`. + +### Task E3: Quest manager and quest journal + +**Files:** +- Create: `scripts/domain/narrative/quest_state.gd`, `scripts/domain/narrative/quest_manager.gd`, `scenes/ui/QuestPanel.tscn` +- Test: `tests/unit/test_quests.gd`, `tests/e2e/test_quest_lifecycle_e2e.gd` + +- [ ] Write red tests for accept, update on kill/item/descent, complete, reward and abandon with no reward. +- [ ] Implement quest data import, tracker HUD and quest journal. +- [ ] Verify and commit `feat: port quest lifecycle`. + +### Task E4: Pet companion and companion behavior + +**Files:** +- Create: `scripts/domain/entities/companion_state.gd`, `scripts/domain/ai/companion_behaviors.gd`, `scenes/ui/CompanionPanel.tscn` +- Test: `tests/unit/test_companion.gd`, `tests/integration/test_companion_support.gd`, `tests/e2e/test_pet_companion_e2e.gd` + +- [ ] Write red tests for shared XP, follow/defend/support stance, damage interception and companion death constraints. +- [ ] Implement pet creation choice, follow AI and command UI. +- [ ] Verify and commit `feat: port pet companion`. + +### Task E5: Recruitable crawlers and unlimited party + +**Files:** +- Create: `scripts/domain/entities/party_state.gd`, `scripts/domain/ai/party_turn_engine.gd`, `scenes/ui/PartyPanel.tscn` +- Test: `tests/unit/test_party_system.gd`, `tests/e2e/test_recruit_party_e2e.gd` + +- [ ] Write red tests for recruit dialogue effect, placement near player, party turn ordering and blocked-cell avoidance. +- [ ] Implement recruitable crawler state and party UI. +- [ ] Verify and commit `feat: port crawler party system`. + +## Vague F — Progression, réussite et métajeu (F1–F6) + +### Task F1: XP, levels, attributes and skills + +**Files:** +- Create: `scripts/domain/progression/experience.gd`, `scripts/domain/progression/skill_tree.gd`, `scenes/ui/CharacterPanel.tscn` +- Test: `tests/unit/test_progression.gd`, `tests/e2e/test_level_up_e2e.gd` + +- [ ] Write red tests for XP split, level threshold, attribute/skill point spend and invalid overspend. +- [ ] Implement character panel allocation UI. +- [ ] Verify and commit `feat: port XP and character growth`. + +### Task F2: Perks, race, archetype, class and hero evolution + +**Files:** +- Create: `scripts/domain/progression/perk_engine.gd`, `scripts/domain/progression/class_engine.gd`, `scenes/ui/ProgressionChoicePanel.tscn` +- Test: `tests/unit/test_perks.gd`, `tests/unit/test_race_class.gd`, `tests/unit/test_hero_classes.gd`, `tests/e2e/test_floor_three_choice_e2e.gd` + +- [ ] Write red tests for level-3 selection gates, compatibility, recommendation and hero condition evaluation. +- [ ] Implement mandatory creation/level-3 choices, perks and later hero/elite notifications. +- [ ] Verify and commit `feat: port classes races perks and evolutions`. + +### Task F3: Achievements, coffrets fan and titles + +**Files:** +- Create: `scripts/domain/meta/achievement_manager.gd`, `scripts/domain/meta/title_engine.gd`, `scenes/ui/AchievementPanel.tscn` +- Test: `tests/unit/test_achievements.gd`, `tests/unit/test_titles.gd`, `tests/e2e/test_achievement_reward_e2e.gd` + +- [ ] Write red tests for trigger conditions, hidden achievement reveal, reward chest and title refresh. +- [ ] Implement achievement toast, journal history and reward claim UI. +- [ ] Verify and commit `feat: port achievements titles and rewards`. + +### Task F4: Audience, followers, sponsors and episodes + +**Files:** +- Create: `scripts/domain/meta/audience_state.gd`, `scripts/domain/meta/recap_log.gd`, `scenes/ui/AudiencePanel.tscn`, `scenes/ui/RecapPanel.tscn` +- Test: `tests/unit/test_audience.gd`, `tests/unit/test_recap.gd`, `tests/e2e/test_audience_episode_e2e.gd` + +- [ ] Write red tests for spectacle score, follower thresholds, sponsor unlock and episode interval. +- [ ] Implement UI for audience/sponsors and recap timeline. +- [ ] Verify and commit `feat: port audience sponsors and recap`. + +### Task F5: Factions, wars, moderation and Syndicate + +**Files:** +- Create: `scripts/domain/meta/faction_war.gd`, `scripts/domain/meta/moderation.gd`, `scripts/domain/meta/syndicate.gd`, `scenes/ui/FactionPanel.tscn` +- Test: `tests/unit/test_factions.gd`, `tests/unit/test_syndicate.gd`, `tests/e2e/test_moderation_event_e2e.gd` + +- [ ] Write red tests for faction kill counters, flags, moderation strike/penalty and deterministic verdict text. +- [ ] Implement faction dashboard and moderation/Syndicate notification panels. +- [ ] Verify and commit `feat: port faction war and system moderation`. + +### Task F6: Death, permadeath and narrative resurrection + +**Files:** +- Create: `scripts/domain/run/death_engine.gd`, `scenes/ui/DeathPanel.tscn` +- Test: `tests/unit/test_death_resurrection.gd`, `tests/e2e/test_death_mode_e2e.gd` + +- [ ] Write red tests for classic death, permadeath end run and qualified rare resurrection. +- [ ] Implement death screen, resurrection narrative result and slot policy. +- [ ] Verify and commit `feat: port death and resurrection`. + +## Vague G — Sauvegarde, UI complète, audio, polish et sortie (G1–G6) + +### Task G1: Save/load versionné et migration depuis le format ASCII + +**Files:** +- Create: `scripts/infrastructure/save/save_repository.gd`, `scripts/infrastructure/save/save_migrator.gd`, `scenes/ui/SaveLoadPanel.tscn` +- Test: `tests/unit/test_save_repository.gd`, `tests/integration/test_ascii_save_migration.gd`, `tests/e2e/test_save_load_e2e.gd` + +- [ ] Write red test round-tripping RunState with multiple visited floors, items, quests, party and meta state. +- [ ] Implement 5 named slots under Godot user data with schema version. +- [ ] Import a representative ASCII JSON save into migration fixture; unsupported keys must be reported, never silently dropped. +- [ ] Add E2E save → process restart seam → load → same player/floor/inventory/quest state. +- [ ] Verify and commit `feat: add versioned saves and ASCII migration`. + +### Task G2: Complete HUD, minimap, menus, controls and accessibility + +**Files:** +- Create: `scenes/ui/Minimap.tscn`, `scripts/presentation/minimap.gd`, `scenes/ui/OptionsPanel.tscn`, `scenes/ui/HelpPanel.tscn` +- Test: `tests/unit/test_minimap.gd`, `tests/e2e/test_full_ui_navigation_e2e.gd` + +- [ ] Write red minimap test for camera crop, FOV visibility and hidden threats. +- [ ] Implement compact HUD, expandable log, minimap, all panels from action router, remappable controls, font/UI scaling and color-blind-safe feedback markers. +- [ ] Verify/capture and commit `feat: complete graphical UI and minimap`. + +### Task G3: Audio actual playback and settings + +**Files:** +- Modify: `scripts/infrastructure/audio/audio_library.gd`, `scenes/Game.tscn`, options UI +- Create: `scripts/infrastructure/audio/audio_import_manifest.gd` +- Test: `tests/unit/test_audio_playback.gd`, `tests/e2e/test_audio_settings_e2e.gd` + +- [ ] Write red test for imported safe `AudioStream` manifest mapping ambient context and SFX events without external arbitrary decoder reads. +- [ ] Implement optional user audio import/setup flow into `user://audio`, volume buses and safe Godot playback. +- [ ] Maintain silent fallback when no audio is present. +- [ ] Verify and commit `feat: add safe optional audio playback`. + +### Task G4: Full presentation pass: animations, VFX, UI sound and readable dark art + +**Files:** +- Modify: `scripts/presentation/event_presenter.gd`, actor/map views, all core UI scenes +- Create: `scripts/presentation/door_chest_feedback.gd`, `scripts/presentation/loot_feedback.gd` +- Test: `tests/e2e/test_presentation_event_sequence_e2e.gd`, visual capture tests + +- [ ] Write red test asserting combat, door, chest, loot, trap, spell, quest and death event kinds each map to one presentation event. +- [ ] Implement short non-blocking effects, popups, animation states, UI notifications and dark palette consistency. +- [ ] Capture scripted reference scenes and compare structural pixel metrics without snapshot brittleness. +- [ ] Verify and commit `feat: complete graphical feedback pass`. + +### Task G5: Release packaging, Linux/Windows smoke checks and documentation + +**Files:** +- Create: `export_presets.cfg`, `scripts/build-linux.sh`, `scripts/build-windows.sh`, `docs/PLAYING.md`, `docs/CONTENT_AND_MODDING.md` +- Modify: `README.md` +- Test: `tests/scripts/test_export_scripts.sh` + +- [ ] Write red shell test requiring export scripts to fail with an explicit message when Godot export templates are absent. +- [ ] Configure Linux x86_64 and Windows x86_64 exports. +- [ ] Build Linux artifact and smoke launch it under Xvfb; build Windows artifact where export templates permit and validate files/manifest without claiming Windows runtime execution on Linux. +- [ ] Document controls, installation, save path, optional audio, assets credits, modding data and known limitations. +- [ ] Verify and commit `build: add desktop exports and player documentation`. + +### Task G6: Full parity release candidate and regression gauntlet + +**Files:** +- Modify: `docs/parity/ASCII_TEST_MATRIX.md`, `scripts/verify.sh`, `README.md` +- Create: `scripts/run-parity-gauntlet.sh`, `docs/RELEASE_CHECKLIST.md` +- Test: integration and E2E suites across prior tasks + +- [ ] Write red script test requiring a nonzero exit if any parity matrix row is `blocked` or unowned. +- [ ] Run Godot full unit/integration/E2E suite from clean worktree, visual captures, save/load roundtrip and generated-floor seed gauntlet. +- [ ] Run ASCII reference suite without modifying its repository; record comparison versions/results. +- [ ] Review all release checklist rows: complete content import, UI screens, saves, endgame, assets, audio fallback, exports and licenses. +- [ ] Tag release candidate only after every matrix row is `ported`/`replaced`/justified `not_applicable`; commit `chore: prepare full port release candidate`. + +--- + +## Kanita execution policy + +1. Create the master Kanita project only after user approval of this master plan. +2. Create one list per task A1–G6, exactly one agent task in each list. +3. Put the task’s microsteps into one Kanita checklist. A task cannot move to `Review` before every checklist item is checked. +4. Every task metadata contains absolute slice/plan path, `blocked_by`, required test runner, PR URLs, review proof and owner. +5. Branch naming: `slice/-`, e.g. `slice/b2-connected-floor-generator`. +6. Each task begins from `main` or a true reviewed dependency; never merge code that changes the same domain model from parallel slices without an explicit integration slice. +7. The master board starts with A1 only. B1 blocks on A1–A2; C1/D1/E1/F1 can fan out after the content/run contracts they consume are in Review; G6 blocks on every prior release-critical slice. + +## Self-review of this plan + +- **Coverage:** the plan explicitly maps every source subsystem listed under `DCWASCII/dcw/`, every data family under `DCWASCII/dcw/data/`, and the test-suite families from `DCWASCII/tests/` to a Godot target and parity matrix. The initial prototype systems are not considered completion criteria. +- **No placeholders:** every task has files, produced/consumed contract or concrete behavior, a red test, implementation direction, green verification and commit action. +- **Consistency:** `RunState`, `FloorState`, `GameEvent`, `PlayerAction`, `ContentCatalog`, deterministic seed and presentation queue are established before slices consuming them. The only source of game mutation is `resolve_action` and domain services. +- **Known scope risk:** this is a large multi-month personal project. The plan uses independently playable vertical slices so the game remains demonstrable and adjustable after every Kanita review rather than waiting for a single final rewrite. + +## Definition of Done — Full Godot port + +The port is complete only when: + +1. All data families and meaningful game systems from DCWASCII are executable in Godot. +2. A new game can be created, explored over multiple deterministic procedural floors, saved, loaded and completed/ended under its difficulty/death rules. +3. All player-facing actions documented in ASCII have a graphical equivalent or a documented intentional replacement. +4. The parity matrix is complete and all critical test behavior is ported/replaced with evidence. +5. Unit, integration, E2E, visual capture and clean-worktree import checks pass. +6. Linux export smoke test passes; Windows export artifact is generated and documented. +7. DCWASCII remains unchanged and all asset licenses are recorded.