Skip to content

Architecture

codingncaffeine edited this page May 3, 2026 · 2 revisions

Architecture

Solution layout

src/
  SiegeFX.Core       class library — file format parsers, no UI
  SiegeFX.Tools      unified `siegefx` CLI (tank info/list/extract, raw info/decode)
  SiegeFX.Browser    WPF asset explorer (debug aid)
  SiegeFX.Runtime    game / engine host (Silk.NET window + GL + input + loop)

Core has zero rendering or platform dependencies and is intentionally MIT-clean. Everything else can import it; nothing in Core imports back.

Subsystem map

Subsystem Lives in Notes
Tank reader (.dsres / .dsmap) Core/Assets/Tank zlib decompress, LZO deferred (rare in DS1)
Texture pipeline (.raw → bitmap) Core/Assets/RawImage, Core/IO/Png Hand-rolled minimal PNG encoder; .raw is bottom-up
GAS parser Core/Gas Tolerates [[ effect_script ]] blocks as opaque
Skrit VM Core/Skrit Lex → parse → bind → compile → state-machine runtime
Static meshes (.sno, .asp) Core/Assets/Sno, Core/Assets/Asp SNO walkable-face flags drive nav
Skeletal animation (.prs) Core/Assets/Prs Bone skin weights, CPU pose then GPU skin
World streaming Core/World Door-graph BFS, cross-region stitching
Actor / brain / combat Core/Actors Wander/Chase/Attack states, melee + spell, XP awards
Pathfinding + nav Core/Nav A* on SNO walkable mesh; NavFollower is the position oracle
Spells Core/Actors/PlayerSpellbook, Core/Assets/SpellTemplate, Core/Assets/SpellCatalog Two-slot hotbar + 10 placed; mana/cooldown; cast effects compile through SfxScriptStoreSfxRuntime → particle sink
Save / load Core/Save JSON via System.Text.Json, atomic temp+replace, schema versioned
Renderer Runtime/Render Silk.NET 2.23 OpenGL, VAO/VBO, custom shaders
HUD / UI Runtime/Render (TextRenderer, BarRenderer, InventoryPanel, MenuButton) Bitmap-font glyph atlas, screen-down ortho
Audio Runtime/Audio/AudioEngine OpenAL Soft via Silk.NET, 3D positional, graceful-fail
SFX VM (sfx_script) Core/Sfx/SfxScriptStore, Core/Sfx/SfxRuntime Compiles DS1 [effect_script*] blocks to an IR and ticks them headlessly; same VM drives the live renderer and the siegefx sfx run audit
Particle backend Runtime/Render/ParticleSystem (impl of Core/Sfx/IParticleSink) GL-billboard system; primitives: Fire / Smoke / Steam / Spark / Lightning / Projectile / Cylinder / Sray / Fireb / Glow halo

Cross-cutting design choices

No platform-specific code in Core. The Browser (WPF) and Runtime (Silk.NET window) own their own platform glue. Core runs anywhere .NET 8 runs.

One source of truth for actor position. NavFollower.Position is private-set; external mutation goes through Teleport. Save load uses this. Avoids desync with the path-trace state.

Floats stored, ints displayed. STR/DEX/INT auto-grow in fractional ratios per formulas.gas. Display layer rounds; storage layer never does. Over many levels, the fractional drift is what makes a Melee build actually scale.

Multiclass is universal. Every PC has all four skills + a single XP pool. The "class" in the manual is a starting kit, not a runtime role lock.

Audio is graceful-fail. Missing device or missing sample logs and continues. Never crashes the game.

Save schema is a public contract. From v0.14.0 onward, bumping CurrentSchemaVersion requires a migration path in SaveStore.Load, not silent acceptance.

Where to start reading

  1. Runtime/Render/RenderHost.cs — owns the window, GL context, input, main loop. The orchestrator.
  2. Core/Actors/Actor.cs + ActorBrain.cs — what an actor is and how it decides what to do.
  3. Core/Nav/NavFollower.cs — how an actor moves.
  4. Core/Gas/* — the data layer everything feeds off of.
  5. test-all.bat — every shipped phase has a verification entry; reading the menu top-to-bottom is the fastest tour of what works.

Clone this wiki locally