DEV Community

Virtastic
Virtastic

Posted on Originally published at virtastic.app

Jagged Alliance 2, running in your browser

If you own Jagged Alliance 2, you can now play it in a browser. Point
ja2.virtastic.app at the folder your copy already lives in and it runs: the full
campaign, full tactical combat, mouse and keyboard, sound intact. Nothing to install, and your
game files never leave your machine.

What it's built on

This is Stracciatella, the open-source
reimplementation of the Jagged Alliance 2 engine. The same relationship as our Morrowind port to
OpenMW: a community project already rebuilt the engine from scratch, and our job was getting that
engine to run in a browser instead of on a desktop. Full credit to the Stracciatella team. We
recompiled their engine to WebAssembly; the engine itself is theirs.

The ja2-web launcher in a browser, offering to load your own Jagged Alliance 2 data folder

The launcher. You point it at the Data folder your copy already lives in, and the files are read locally.

What it took

The shape of the problem was familiar from OpenMW: an engine written for a desktop event loop,
a desktop filesystem, and desktop audio, none of which a browser gives you for free. Sound became
Web Audio. The UI and mouse-driven tactical combat run exactly as they do on desktop, translated
onto browser input events. And like OpenMW, it's a "bring your own data" port: Jagged Alliance 2's
game data is commercial, so the launcher points at your own legally-owned copy and reads it
straight off disk. Nothing is uploaded anywhere.

The A.I.M. mercenary hiring site running inside the game, in a browser

A.I.M., the in-game mercenary hiring site, complete with its 1999 web design. All of it runs client-side.

One detail worth calling out: it keeps running in a background tab. Browsers throttle inactive
tabs hard, which is normally the right call, and normally invisible unless your game depends on a
turn timer or an AI that needs to keep thinking while you've alt-tabbed away. Jagged Alliance 2
does. The port accounts for that, so switching tabs mid-mission doesn't leave the game stuck or
desynced when you come back.

The Jagged Alliance 2 title screen rendered in a browser

The original title screen, unchanged, in a browser.

Try it

Play it in your browser if you own the game, read the source on
GitHub, and if you hit a bug, tell us or drop
it in the Discord.

This is our second full release after OpenMW.
More are on the way.

Top comments (0)