Skip to content

Ghostmonday/deterministic-fighting-game

Repository files navigation

Deterministic Multiplayer Simulation Engine

A game-agnostic, renderer-agnostic, deterministic simulation engine with rollback netcode, replay validation, and fixed-point math.

No floats. No platform-dependent rounding. No hardcoded game logic. Same inputs → same state, every machine, every frame.


Architecture

engine/DeterministicSim.Engine/     ← Pure engine core
  src/
    Core/                           ← GameState, InputFrame, StateHash, ISimulationStep
    Math/                           ← FixedMath, Fx, AABB
    Net/                            ← RollbackController, UdpTransport, AuthoritativeServer

modules/fighting-game/              ← Optional fighting game module (proof-of-concept)
  src/                              ← Game-specific: CombatResolver, Simulation, CharacterDefs
  tests/

adapters/                           ← Renderer/engine adapters
  fighting-game-godot/              ← Godot 4 adapter for fighting game demo

examples/                           ← Runnable examples/demos
  fighting-game-demo/godot/         ← Godot 4 fighting game demo (proof-of-concept)

tools/                              ← Developer tools
  stress-runner/                    ← Headless determinism stress tester
  scripts/                          ← Build/test scripts
  deterministic-validator/          ← Replay validation tools

tests/                              ← Project-wide tests
  unit/engine/                      ← Pure engine unit tests
  unit/rollback/                    ← Rollback controller tests
  unit/determinism/                 ← Determinism verification tests
  modules/fighting-game/            ← Fighting game module tests

docs/                               ← Documentation
  engine-specs/                     ← Engine API and design specs

archive/review-needed/              ← Files pending archival review

Core Properties

Property Description
Deterministic Fixed-point integer math (Fx.SCALE = 1000). Same inputs → same outputs across platforms.
Game-agnostic Engine has zero knowledge of fighting games, FPS games, or any specific genre. Game logic lives in modules.
Renderer-agnostic Engine produces pure state snapshots. Rendering is handled by adapters.
Rollback-native Ring buffer with configurable frame depth. Rollback + resimulation on late input.
Replay-native Every tick produces a deterministic state hash. Replays are just re-simulated input sequences.
Zero allocations in hot path Pre-allocated buffers. No GC pressure during simulation.

Key Interfaces

Build & Test

# Build engine
dotnet build engine/DeterministicSim.Engine/

# Run tests
dotnet test tests/DeterministicSim.Engine.Tests.csproj

Status

The engine core is structurally extracted and compiling. Fighting game content has been moved to modules/fighting-game/ and examples/fighting-game-demo/. The old monolithic Simulation.Tick is replaced by the pipeline architecture.

Next: Wire ISimulationStep implementations, implement game-specific state hashing, and complete the fighting game module adapter.

License

MIT

About

Deterministic 60 FPS rollback netcode engine (120-frame buffer, FNV-1a hashing). Godot + C#.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors