Add core content definitions

This commit is contained in:
2026-04-21 19:47:25 +02:00
parent d4b3c221b2
commit efcc1ba209
74 changed files with 1196 additions and 13 deletions

View File

@@ -17,13 +17,13 @@ This slice does not implement gameplay movement, enemy spawning, weapons, or the
- [x] (2026-04-21 17:04Z) Read repository rules, Windows rules, `PLANS.md`, `DESIGN.md`, `CODE.md`, `SLICE1.MD`, current Godot scripts, and `godot/project.godot`.
- [x] (2026-04-21 17:04Z) Verified that Slice 1 has committed a bootable Godot shell with `Menu` and `Smoke` debug boot modes.
- [x] (2026-04-21 17:04Z) Created this Slice 2 ExecPlan.
- [ ] Implement C# content definition types and validation result types.
- [ ] Implement sample content registry and intentionally broken validation fixtures.
- [ ] Add C# test project to the solution and cover registry validation behavior.
- [ ] Add Godot content browser scene, content browser boot mode, and headless validation-only exit path.
- [ ] Run formatting for touched C# files with `jb cleanupcode --build=False`.
- [ ] Validate with .NET tests, .NET build, Godot solution build, and headless content browser boot.
- [ ] Commit the completed slice.
- [x] (2026-04-21 17:32Z) Implemented C# content definition types and validation result types.
- [x] (2026-04-21 17:32Z) Implemented sample content registry and intentionally broken validation fixtures inside tests.
- [x] (2026-04-21 17:32Z) Added C# test project to the solution and covered registry validation behavior.
- [x] (2026-04-21 17:32Z) Added Godot content browser scene, content browser boot mode, and headless validation-only exit path.
- [x] (2026-04-21 17:32Z) Ran formatting for touched C# files with `jb cleanupcode --build=False`.
- [x] (2026-04-21 17:32Z) Validated with .NET tests, .NET build, Godot solution build, and headless content browser boot.
- [x] (2026-04-21 17:32Z) Commit the completed slice.
## Surprises & Discoveries
@@ -36,6 +36,12 @@ This slice does not implement gameplay movement, enemy spawning, weapons, or the
- Observation: There are no existing gameplay content definitions or tests in the repository.
Evidence: `rg --files` shows only bootstrap, menu, debug smoke scripts and scenes under `godot/`; there is no `tests/` directory.
- Observation: Referencing the Godot C# project from the xUnit project made the Godot source generator run in the test project.
Evidence: the first `dotnet test SideScrollerGame.sln` pass printed `CS8785: Generator 'ScriptPathAttributeGenerator' failed ... Property 'GodotProjectDir' is null or empty`. Adding `GodotProjectDir` and `CompilerVisibleProperty Include="GodotProjectDir"` to the test project removed the warning.
- Observation: `.\godot --headless --path godot --build-solutions --quit` generated `.cs.uid` files for every new C# script, including plain content definitions.
Evidence: after the Godot build, `rg --files godot\scripts godot\scenes` listed `.uid` files beside all new content and validation C# files. These are kept because Godot generated them for the project scan.
## Decision Log
- Decision: Implement Slice 2 definitions as plain C# records and small enums inside the existing Godot C# project first, not as Godot `Resource` assets.
@@ -54,9 +60,52 @@ This slice does not implement gameplay movement, enemy spawning, weapons, or the
Rationale: The jam topic is unknown. Stable ids such as `mission.test`, `enemy.serial`, and `weapon.primary.basic` prove system wiring without committing to a visual or story theme.
Date/Author: 2026-04-21 / Codex.
- Decision: Keep content definitions inside the Godot C# project for Slice 2 and configure the test project so the Godot source generator has `GodotProjectDir`.
Rationale: The Godot project reference worked after the generator property was made visible to the compiler. This preserves the planned `godot/scripts/content/` layout and avoids introducing an extra class library before the content model needs to be shared outside Godot.
Date/Author: 2026-04-21 / Codex.
## Outcomes & Retrospective
Not started. When this slice is completed, update this section with the exact files created, commands run, validation output, and any remaining risks.
Implemented the core content definition layer under `godot/scripts/content/`, including definitions, registry lookup, validation messages, validation rules, and theme-neutral sample content. Added `tests/SideScrollerGame.Content.Tests/` with xUnit coverage for valid sample content, registry lookup, duplicate ids, missing mission clusters, missing cluster enemies, empty behavior tracks, and invalid difficulty multipliers. Added `ContentBrowser` as a debug boot mode and created `godot/scenes/debug/ContentBrowser.tscn` for in-engine content inspection and headless validation.
Validation completed:
dotnet test SideScrollerGame.sln
Passed! - Failed: 0, Passed: 8, Skipped: 0, Total: 8
dotnet build SideScrollerGame.sln
Build succeeded.
0 Warning(s)
0 Error(s)
.\godot --headless --path godot --build-solutions --quit
Exited successfully.
.\godot --headless --path godot -- --debug-boot=content-browser --content-validate-only
Debug boot: ContentBrowser
Seed: 1
Loaded content definitions:
behavior.enemy.parallel
behavior.enemy.serial
camera.test.path
cluster.opening
collectible.points.small
collectible.squadron.orbit
difficulty.easy
difficulty.hard
difficulty.normal
enemy.parallel
enemy.serial
layer.background.stars
layer.foreground.clouds
mission.test
squadron.orbit
weapon.primary.basic
weapon.secondary.vertical
weapon.special.bomb
Content validation succeeded
Remaining risk: the content browser visual layout was validated through headless boot and compilation, not manually inspected in the editor window.
## Context and Orientation