Architecture
DMTE is a four-module modular monolith. No cycles, no platform leakage into libraries.
Dependency graph
Section titled “Dependency graph”MouseTrainer.Domain → (nothing) Shared primitives, RNG, run identityMouseTrainer.Simulation → Domain Deterministic loop, modes, mutators, levelsMouseTrainer.Audio → Domain Cue system, asset verificationMouseTrainer.MauiHost → all three Composition root, MAUI platform hostDomain is the leaf. MauiHost is the only composition root. Simulation and Audio depend only on Domain, never on each other.
Key design principles
Section titled “Key design principles”Determinism is constitutional
Section titled “Determinism is constitutional”Same seed produces the same simulation and the same score, always. The engine avoids DateTime.Now, Random, and platform-dependent floats in the hot path. All randomness comes from a seeded xorshift32 RNG.
Protocol-grade identity
Section titled “Protocol-grade identity”MutatorId, ModeId, and RunId are permanent identifiers. Once created, they are frozen forever. FNV-1a 64-bit hashing with canonical parameter serialization ensures the same seed + mode + mutators always produces the same RunId on every platform.
Warnings are errors
Section titled “Warnings are errors”Library projects use <TreatWarningsAsErrors>true</TreatWarningsAsErrors>. The MAUI host opts out only for SDK-generated warnings that are outside the project’s control.
Domain module
Section titled “Domain module”The leaf module provides shared primitives:
- Events —
GameEvent(record struct with Type, Intensity, Arg0, Arg1, Tag),GameEventType(None, HitWall, EnteredGate, DragStart, DragEnd, ComboUp, LevelComplete, Tick) - Input —
PointerInput(cursor position and button state) - Runs —
RunDescriptor,RunId,MutatorId,MutatorSpec,MutatorParam,ModeId,DifficultyTier - Scoring —
ScoreComponentId(GateScore, ComboBonus, MissPenalty) - Utility —
DeterministicRng(xorshift32),Fnv1a(64-bit hashing),Leb128(variable-length encoding)
Simulation module
Section titled “Simulation module”The deterministic simulation engine:
- Core —
DeterministicLoop(60Hz fixed timestep with accumulator),DeterministicConfig,FrameResult,IGameSimulation - Levels —
LevelBlueprint,ILevelGenerator,LevelGeneratorRegistry - Modes — Game mode implementations (e.g., ReflexGates)
- Mutators —
IBlueprintMutator,MutatorPipeline,MutatorRegistry, six built-in mutators - Replay —
ReplayRecorder,ReplayVerifier,ReplayEnvelope,InputTrace,InputSample,InputSpan - Session —
SessionController(Ready/Playing/Results state machine),SessionModels,ScoreBreakdown
Audio module
Section titled “Audio module”Audio cue system with asset verification:
- Assets —
AssetManifest,AssetVerifier,IAssetOpener - Core —
AudioDirector,AudioCue,AudioCueMap,IAudioSink