aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


docs/browser-alternatives.md (13043B)


Browser execution alternatives

Historical assessment: the maintained client now uses the 14.9.1 C reconstruction. The alternative runtime checkouts and their experimental edits were discarded with local/. They are not dependencies of the current build.

Assessment recorded on 2026-10-12. This is a source-based feasibility comparison, not a performance benchmark or a claim that an alternative runs AO. No changes were made to the Rust prototype or Go server during this investigation.

Recommendation

Test a current Boxedwine browser JIT build before committing to implementing the entire Windows runtime around Theseus. Wine-Assembly is a second worthwhile execution experiment. Neither is proven to run our AO target, so there is not yet enough evidence to abandon the Rust work.

Recomp-kit is a useful static recompilation reference, but its inspected runtime does not remove AO's main compatibility problems. rev.ng is useful for recovering functions and types; it does not supply a browser Windows environment.

The choice depends on the intended result. Running the original client in a tab fits the fidelity goal well and can avoid rebuilding its engine. A translated client gives us more control over execution and host integration, but generated register-and-memory code is still not recovered, maintainable C++ source. Either approach leaves the Go server and reconstruction of server-owned content necessary.

AO requirements that distinguish these approaches

The installed target is 13.2, with 13.24 still the provisional historical cutoff. See versions-and-patches.md. This investigation followed ordinary imports from the current client-target/Clientr.exe:

Comparison

Project What it supplies AO-specific assessment
rev.ng Binary lifting, decompilation to C, type recovery and editable models Useful analysis tool; still needs a PE/Windows/browser runtime and graphics/network adapters
Boxedwine x86 execution, Linux syscall emulation and actual Wine libraries Strongest candidate for reducing Windows compatibility work; browser graphics and performance need an AO test
Wine-Assembly WAT x86 interpreter, Win32 compatibility layer, real DLL loading and browser rendering D3D7 and relocation implementations already exist; socket bridge, missing APIs and CPU performance need investigation
recomp-kit Static x86-to-C translation, guest runtime, Windows/DirectX adapters and WebGPU target More host infrastructure than Theseus, but concrete D3D7, networking and relocation gaps remain

rev.ng

rev.ng supports PE/COFF input and PDB/CodeView information. It uses QEMU as a lifter and LLVM for analysis, and emits C designed to be recompilable. Its documentation explicitly distinguishes lifting from emulation. Its tool host is Linux x86-64, with WSL documented for Windows.

My inference: it could help recover a bounded asset parser, collision routine or protocol function and its data structures. Compiling emitted C to WASM would not by itself implement imported Windows APIs, DLL initialization, Direct3D or socket transport. It should be evaluated as a companion analysis tool rather than a replacement browser runner.

Sources: project overview, supported binary formats, host requirements.

Boxedwine

Inspected source revision: 65467424603484756a73308412f40b906d28b650.

The source has browser release, jit, multiThreaded and multiThreadedJit targets. The JIT emits WASM blocks and supports persisted/offline optimized caches. The Emscripten build enables OpenGL support; the source contains WebGL context, shader, buffer and presentation handling. It also has a WebSocket gateway that can connect to host TCP services, including localhost.

Actual Wine is the important advantage: its Windows DLLs supply mature PE, CRT, C++ runtime and DirectX behavior that a custom host layer must otherwise reimplement. The cost is executing Wine and its userspace dependencies as well as the game, plus shipping a Wine filesystem. Browser GL coverage and Wine's rendering backend must work together; WebGL source presence is not an AO result.

Our previous AO test used the 26R1 web release, not this source build. After adding its missing Wine mswsock.dll.so, original 11.0 reached graphics startup and failed because the release lacked usable OpenGL support. That result is documented in browser-porting.md. It does not demonstrate that the current JIT/WebGL implementation fails in the same way.

The current source was subsequently built and tested with the complete Wine 11 filesystem and installed AO 13.2. It entered Omni Training and rendered the original world and character through the local server. Indoor walking and sitting worked, with warm samples around 22-24 presentation calls per second. Outdoor walking with the complete NPC population now works after fixing a Boxedwine JIT stack-synchronization bug. Warm outdoor rendering is still only about 3-5 FPS.

Sources: browser build and JIT targets, Emscripten build flags, WebGL implementation, network gateway.

Wine-Assembly

The former vgrichina/wine-assembly repository redirects to vgrichina/berrry-wine. Inspected revision: 0304a8549df15567b458d3a3c318609aa515e2ca.

Despite its name, this is its own Win32 reimplementation with a WAT x86 interpreter, not actual Wine compiled to WASM. It loads real DLLs with relocations and has thread and exception infrastructure.

Source inspection found real implementations for DirectDrawCreateEx requesting IDirectDraw7, IDirect3D7 device creation, vertex buffers, D3D7 lighting and DrawIndexedPrimitive / DrawIndexedPrimitiveVB. Its DX2-7 WebGL backend receives transformed triangles from WAT. Transformation and lighting therefore still run on the CPU side. The repository records graphics tests for other 3D games, with both successes and rendering discrepancies; these are upstream results, not tests performed here.

Its Winsock implementation currently connects virtual room peers, explicitly excluding host LAN/Internet sockets. We would need a transport bridge to the Go server. In the inspected API registry, AO's named imports AcceptEx, TransmitFile, WSAIoctl, WSAAccept, WSAJoinLeaf, gethostbyaddr, getprotobynumber and htonl are absent. This is a name inventory, not proof of which calls execute or of what supplying real DLLs could resolve.

All three named DirectDraw imports are registered. Among AO's 44 named WS2_32 imports, 38 are registered. Those figures measure names only: implementations can be incomplete, and import counts must not be presented as compatibility percentages. The loader also implements Winsock ordinal mappings, so treating ordinal imports as automatically missing would be incorrect. Real MSVCRT loading likewise means its exports cannot be assessed solely against the shim registry.

The README describes interpreter throughput as roughly a 1997-class machine and says heavier 3D titles are not yet full speed. That is the author's estimate; AO frame time has not been measured. This project is a plausible startup and rendering experiment, with CPU throughput a material uncertainty.

Sources: overview and performance caveat, D3D7 handlers, DirectDraw factory, WebGL backend, socket implementation.

recomp-kit

Inspected revision: eb32cc42623e0e9e868b9d27423a57d5a5cba56b.

It translates x86 instructions to C, compiles a guest runtime around them, and has an Emscripten/WebGPU browser target. It also has an interpreter fallback for undiscovered code. Populous: The Beginning is its first supported game.

The runtime includes cooperative guest scheduling, auxiliary translated DLLs, import/export linking and SEH code. Some runtime README descriptions lag the implementation: SEH and auxiliary DLL support should not be dismissed just because an older paragraph says they are absent.

Three verified gaps are particularly relevant:

  1. dx/ddraw.cpp::DirectDrawCreateEx validates IID_IDirectDraw7 and then returns DDERR_UNSUPPORTED. Names for D3D7 interfaces in dx/com.cpp are diagnostic labels, not implementations. Direct3D2/WebGPU support is not a D3D7 adapter.
  2. The WS2_32 entries in runtime/misc.cpp have null handlers. Networking is explicitly out of scope there; these calls are not working sockets.
  3. runtime/loader.cpp::load_aux_module requires preferred image bases and explicitly lacks relocation support. That cannot directly load AO's 31 overlapping DLLs. Mapping and dispatch across rebased images would need work.

It may offer useful renderer and scheduler implementation ideas, but adopting it would mean a substantial AO compatibility port rather than simply feeding it our executable. There is no demonstrated reason yet to discard Theseus for it.

Sources: architecture, DirectDraw implementation, socket entries, image loader, browser target.

Experiment that would decide whether to switch

Use the same installed 13.2 client and Go server for each execution candidate. Launch windowed, bypassing the patcher, with local assets and server addresses. Require all of the following before treating a runner as viable:

  1. Finish actual DLL/CRT initialization and reach login or character selection.
  2. Connect through a browser transport bridge and enter the same training zone.
  3. Render terrain, character heads, textures and NPCs correctly; walk and turn.
  4. Measure startup, sustained frame time, memory and input response during a comparable route. A triangle sample or a successful DLL initializer is not sufficient evidence of game performance.

Prioritize current Boxedwine JIT, then Wine-Assembly if its startup gaps are bounded. Keep the Rust prototype available while gathering that evidence. Even if a runner succeeds, decide separately whether it should be the final browser client or a fidelity reference for a more editable reconstruction.

The ignored source checkouts are under local/references/browser-reference/. The isolated compare_ao_imports.py experiment there writes ao-wine-assembly-imports.json with the current target hash, import closure, overlapping image bases and named API inventory. These are local investigation artifacts, not project runtime dependencies.