{
  "id": 1817447,
  "title": "Build a deterministic browser game engine",
  "url": "https://urgent.news/2026/08/18/build-a-deterministic-browser-game-engine",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-18T21:58:59.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/pathprotocol/build-a-deterministic-browser-game-engine-50j0"
  },
  "original_language": "en",
  "account": "In crafting the open-source browser game Path Protocol, I was guided by a single guiding principle: levels must replay identically so scores are comparable. This requirement made determinism not an option but the very core of the product. If two players run the same level and physics drifts, the leaderboard becomes meaningless.\n\nTo ensure this, the game loop separates the simulation clock from the render clock. The simulation clock runs at a fixed 60 Hz step with an accumulator, guaranteeing the same level plays identically regardless of the monitor's refresh rate or system load. Rendering happens at the rate the browser allows but never alters the game state.\n\nThe level layout is seeded, producing the same start position, targets, pickups, and hazards each time the same seed is used. No randomness leaks into the simulation, keeping scores consistent across plays.\n\nOwnership-wise, the engine remains framework-neutral, not importing React, Three.js, or the DOM. It focuses solely on movement, collision, scoring, and targets. React handles menus, HUD, and authoring UI, while Three.js manages presentation. This separation made the engine easy to test in a headless environment using Vitest, asserting that a given input always produces a given outcome.\n\nCollision and scoring live in explicit contracts, defined in JSON rather than visual assets. This prevents mixed-up collision geometry or drifting scoring formulas. The scoring formula resides in a single module, ensuring consistency across community-authored levels.\n\nAI assisted by accelerating the iteration between idea, code, tests, and documentation. Yet, defining deterministic rules, collision boundaries, scoring ownership, persistence, and security remained a deliberate human task. The AI was a fast pair-programmer, not a replacement for architecture.\n\nFor a first look into this deterministic game engine's test suite, I'd start with the fixed-step simulation's ability to always produce the same outcome given the same input, ensuring no unexpected drift in physics. This validates the core promise of replayability across all levels.",
  "summary": "I built an open-source browser precision game called Path Protocol — 100 levels, a Theme Workshop for authoring your own courses, MIT licensed. Along the way, one constraint shaped every architectural decision: levels must replay identically so scores are comparable. That single requirement turns determinism from a nice-to-have into the product itself. If two players run the same level and the…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}