fracture

taking a 2012 html5 demo and modernizing it the way i've modernized enterprise systems for 25 years

In 2012, Mozilla shipped BrowserQuest — an HTML5 technology demo. A multiplayer RPG running in the browser, built to prove that the web could handle real-time games. It worked. Then Mozilla archived it.

It was a vertical slice: just enough code to prove the concept. No persistence beyond localStorage. No tests. No security. No observability. No separation of concerns. The kind of prototype that ships to prove a point, not to run in production.

That's the same starting point as most legacy enterprise systems I've worked on. Something that worked once, never got the supporting infrastructure it needed, and now needs to scale. So I built those systems.

2012 browserquest

  • JavaScript, no types
  • 0 tests
  • Vertical slice prototype, no supporting systems
  • No persistence (localStorage only)
  • All message handling in one file
  • console.log debugging
  • No security, no rate limiting

2025 fracture

  • 217 TypeScript source files (52k LOC)
  • 3,161 tests across 65 test files
  • 19 handler/service modules (SRP)
  • SQLite persistence with auto-save
  • MessageRouter + 13 dedicated handlers
  • OpenTelemetry tracing, Pino structured logging
  • Rate limiting, spawn protection, anti-exploit validation

the approach

The same process that works on enterprise software. It works on games too.

1

understand before changing

Read every file. Map the dependency graph. Identify what the prototype does and what it's missing. The original had no module boundaries, no error handling, and no separation between game logic and transport. Figure out what production systems it needs before writing any code.

2

safety net first

3,161 tests before refactoring anything. When I extracted the combat system, every interaction was verified. When I built the aggro policy engine, tests caught edge cases I'd have shipped as bugs.

3

refactor incrementally

No big rewrites. Extract a module, test it, ship it. The MessageRouter was one change. Each handler module was one change. The CombatTracker was one change. At every step the game kept running.

4

make the architecture earn its keep

Every abstraction solved a real problem. The SpatialManager exists because the aggro tick was O(n×m) and needed spatial partitioning. The AggroPolicy exists because safe zones, density caps, and level scaling were scattered across three files. The EventBus exists because mob death needed to notify five decoupled systems.


ai as infrastructure, not gimmick

Three layers of AI integration that demonstrate contemporary understanding — not just using AI, but engineering systems around it.

ai-augmented development

Built with Claude as a development partner. Not copy-paste from ChatGPT — iterative architectural discussion, test-driven extraction, incremental refactoring with an AI that understands the full codebase context. This is how AI changes software engineering: not by replacing engineers, but by making one engineer ship what used to take a team.

ai as product feature

8 specialized AI services power the game world. NPCs generate contextual dialogue through Venice AI (llama-3.3-70b). A narrator system provides voice-synthesized commentary via Fish Audio TTS. Mobs have ambient thought bubbles. Quests are generated dynamically. A Town Crier reports world events. The AI layer is fully decoupled — the game runs fine without API keys.

ai infrastructure

Production AI integration means handling failure gracefully. Circuit breaker pattern (closed → open after 5 failures → half-open recovery). Retry with exponential backoff. Error classification (timeout, auth, rate_limit, server_error, network). Latency histogram with sliding window. The game survives API outages without players noticing.


systems at a glance

combat system

Hate-based aggro ranking, party XP sharing, kill streaks, 4 skills (phase shift, power strike, war cry, whirlwind), stun mechanics, leash distance.

zone progression

6 zones from village safe haven to endgame lava fields. Per-zone loot modifiers, rarity scaling, level-gated difficulty. 172×314 tile map.

fracture rifts

Endgame infinite-depth dungeon runs. 8 stacking modifiers (fortified, empowered, cursed…). Dynamic difficulty scaling. 100-entry leaderboard.

observability

Pino structured logging (50 modules). OpenTelemetry traces on message routing, persistence, AI calls. SigNoz + Grafana dashboards. Log-trace correlation.

multiplayer infra

Socket.IO with 105 message types. Spatial partitioning for zone broadcasting. Per-message rate limiting. SQLite persistence with 60s auto-save.

test discipline

3,161 tests, 65 test files. Vitest with v8 coverage. Tests written before refactors. Coverage thresholds enforced.


tech stack

TypeScript 5.8 Node.js Socket.IO 4 SQLite Venice AI (llama-3.3-70b) Fish Audio TTS OpenTelemetry Pino SigNoz Grafana Vitest nginx Docker Compose

fracture isn't an isolated experiment

A pattern of AI-related projects, not a one-off.

  • venice-dev-tools — SDK for Venice AI API
  • deep-research-privacy — privacy-first AI research combining Venice AI with Brave private search
  • ai lens (on this site) — resume page that uses AI to reframe experience for different audiences
  • codetest — 968 tests across Rust, Zig, Go, Perl, Python, and TypeScript/React, each exercise matched to the language that fits the problem (source)
  • emergent, venicecrush — terminal-based autonomous coding agents
  • 20+ Venice AI ecosystem projects — SDKs, bots, monitors, research tools across Rust, TypeScript, PHP, and Python