samiulhossain
02

Empire at War Multi-Threaded Engine

engine · 2026

Empire at War is single-core bound, so I'm rebuilding the engine core to run across all of them — deterministic, mod-compatible, proven by tests.

Problem

The 2024 64-bit remaster still runs its simulation on one thread — measured live at 40–75% of a single core while the rest sit idle. Big battles crawl, and every mod inherits it.

What I built

A deterministic, multithreaded reimplementation of the EAW simulation core running on real game data: 3D pathfinding, two-phase parallel combat, events/timers, taskforces, planets, perception-driven AI, and the documented Lua mod surface. 16 test suites stay green, and sim_tool --compare proves identical outcomes at any worker count — 2.39x speedup at 1,520 units/side. The strategy leans on documented formats (.meg archives, Lua/XML surface) plus targeted binary analysis, with full mod compatibility (Thrawn's Revenge, EAW Remake) as a hard requirement. Patch DLL first, full engine later.

Highlights

  • Deterministic at any worker count — proven by sim_tool --compare
  • Two-phase parallel combat and 3D pathfinding on real game data
  • 2.39x speedup at 1,520 units/side
  • Perception-driven AI and the documented Lua mod surface
  • 16 test suites green across the engine core
eaw-multithread-engine/stack.toml

# eaw-multithread-engine - parallel sim core

lang = "c++"

target = "eaw 2024 64-bit remaster"

core = "deterministic multithreaded sim"

combat = "two-phase parallel"

proof = "16 suites, sim_tool --compare"

speedup = "2.39x @ 1,520 units/side"

mods = "thrawn's revenge, eaw remake compatible"