Skip to content

Architecture

DMTE is a four-module modular monolith. No cycles, no platform leakage into libraries.

MouseTrainer.Domain → (nothing) Shared primitives, RNG, run identity
MouseTrainer.Simulation → Domain Deterministic loop, modes, mutators, levels
MouseTrainer.Audio → Domain Cue system, asset verification
MouseTrainer.MauiHost → all three Composition root, MAUI platform host

Domain is the leaf. MauiHost is the only composition root. Simulation and Audio depend only on Domain, never on each other.

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.

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.

Library projects use <TreatWarningsAsErrors>true</TreatWarningsAsErrors>. The MAUI host opts out only for SDK-generated warnings that are outside the project’s control.

The leaf module provides shared primitives:

  • EventsGameEvent (record struct with Type, Intensity, Arg0, Arg1, Tag), GameEventType (None, HitWall, EnteredGate, DragStart, DragEnd, ComboUp, LevelComplete, Tick)
  • InputPointerInput (cursor position and button state)
  • RunsRunDescriptor, RunId, MutatorId, MutatorSpec, MutatorParam, ModeId, DifficultyTier
  • ScoringScoreComponentId (GateScore, ComboBonus, MissPenalty)
  • UtilityDeterministicRng (xorshift32), Fnv1a (64-bit hashing), Leb128 (variable-length encoding)

The deterministic simulation engine:

  • CoreDeterministicLoop (60Hz fixed timestep with accumulator), DeterministicConfig, FrameResult, IGameSimulation
  • LevelsLevelBlueprint, ILevelGenerator, LevelGeneratorRegistry
  • Modes — Game mode implementations (e.g., ReflexGates)
  • MutatorsIBlueprintMutator, MutatorPipeline, MutatorRegistry, six built-in mutators
  • ReplayReplayRecorder, ReplayVerifier, ReplayEnvelope, InputTrace, InputSample, InputSpan
  • SessionSessionController (Ready/Playing/Results state machine), SessionModels, ScoreBreakdown

Audio cue system with asset verification:

  • AssetsAssetManifest, AssetVerifier, IAssetOpener
  • CoreAudioDirector, AudioCue, AudioCueMap, IAudioSink