Game as the Core mod: data-driven content and localization

The whole game is now described by Mods/Core — the first consumer of
the engine's new MrGameEng.Mods module:

- textures/ moved to Mods/Core/Textures; atlases are built at game
  start from the merged texture tree of all active mods into Cache/
  (gitignored, incremental) instead of being committed, and the
  GameAssets atlas handles are gone with them
- terrain, plants and pawns are JSON defs (Mods/Core/Defs) with parent
  inheritance; scenes read TerrainDef/PlantDef/PawnDef instead of
  hardcoded arrays, and the TerrainKind enum is retired
- HUD strings come from Mods/Core/Languages (ru default, en fallback)
  through LanguageManager; the language switches at runtime
- new console commands: mods, lang [code], defs [type]; atlas now
  inspects the runtime-built cache
- bump engine: MrGameEng.Mods module and the explicit-sources
  AtlasBuilder overload

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Leonid Pershin
2026-06-11 21:51:46 +03:00
co-authored by Claude Fable 5
parent 218973ae60
commit 8b531bcd7e
4266 changed files with 723 additions and 54164 deletions
+16 -11
View File
@@ -16,7 +16,9 @@ Game design docs live in `docs/` and are written in **Russian**. Engine rules li
```
engine/ mrgameeng git submodule (own repo, own CLAUDE.md)
src/LittleSim the game (net8.0); references engine projects directly
docs/ концепт, симуляция, roadmap (Russian)
Mods/Core the game's own content as a mod: About, Defs, Languages, Textures
Cache/ runtime-built atlases (gitignored)
docs/ концепт, симуляция, моды, roadmap (Russian)
LittleSim.sln game + engine sources + engine tests — one window for everything
```
@@ -29,18 +31,19 @@ dotnet run --project src/LittleSim -c Release # measure perf in Release only
dotnet test LittleSim.sln # runs the engine test suites
```
## Texture atlases
## Content and mods
Source images live in `textures/` (committed); the game only loads packed atlases from
`src/LittleSim/Assets/Atlases` (also committed — the asset generator emits
`GameAssets.Atlases.*` handles for them). After changing `textures/`, rebuild with:
All game content is data in mods (`MrGameEng.Mods`): the game itself ships as the
`Core` mod. `Mods/Core/Defs` holds JSON defs (terrain, plants, pawns — see
`docs/mods.md`), `Mods/Core/Languages/{ru,en}` holds UI strings (default language is
`ru`), `Mods/Core/Textures` holds source images. New mechanics get defs + localization
keys, not hardcoded arrays; UI strings go through `LanguageManager`, never inline.
```
dotnet run --project engine/tools/MrGameEng.AtlasTool -c Release -- textures src/LittleSim/Assets/Atlases --group-depth 2
```
Rebuilds are incremental (unchanged groups are skipped). Region keys are paths relative
to `textures/` without extension: `atlas.GetRegion("things/plant/treeoak/TreeOakA")`.
Atlases are built **at game start** from the merged texture tree of all active mods
into `Cache/Atlases` (incremental: unchanged groups are skipped, a clean first run
takes ~20 s). Region keys are paths relative to `Textures/` without extension:
`atlases.GetRegion(device, "things/plant/treeoak/TreeOakA")`. Console commands:
`mods`, `lang [code]`, `defs [type]`, `atlas [name]`.
## Submodule workflow
@@ -57,4 +60,6 @@ Never commit a pointer to an unpushed engine commit.
- Simulation/presentation split: simulation systems mutate components only;
rendering reads them. No draw calls or UI from simulation systems.
- ECS-first per the engine: plain `struct : IComponent` data, logic in systems.
- Content as data: numbers, textures and balance live in `Mods/Core/Defs`, user-facing
strings in `Mods/Core/Languages` — code only defines systems and def classes.
- Every new mechanic gets a dev-console command for testing (`regen`, `timescale`, …).