Tony Hawk's Underground 2, compiled for the browser
Tony Hawk's Underground 2 for PC, running at 60 fps in Chrome and on an iPhone. It isn't emulated. The game's own C++ is compiled to WebAssembly and drawn with WebGPU. This is what that took, over two days.
The port started as a request from a friend. João framed it as a test: how fast are browsers today? Run an old PC game in the browser and compare it with the original. He set one rule in his first message:
emulation is not fair since we will not be using the most optimal code and give a fair chance to the browser

Not a remake
At first João expected to have to reimplement the game, reverse engineering whatever it took with open-source tools, among them rea, a decompiler MCP. His first chat with Claude found no reimplementation of THUG2, and Claude wouldn’t remake the game. It offered to make an original skateboarding game instead.
He opened a new chat a few minutes later, and it found what the first one had missed. The community decompilation of THUG2 PC has rewritten the whole game in C++, one function at a time, and that same day it reached all 8,529 functions. That saved most of the work. The game’s code already existed and only had to be compiled for the browser.
How it fits together
- 32-bit on both sides. The decomp is C++ for Microsoft’s compiler and 32-bit Windows. wasm32 is 32-bit too, with 4-byte pointers and the same byte order, so the game’s structures and data files keep their layout. A native Mac build can’t do that, because macOS only runs 64-bit code.
- Windows, faked. Headers stand in for Win32, Direct3D 9, DirectInput and DirectSound. The game’s x87 inline assembly, mostly sines and cosines, became plain C++.
- Direct3D 9 on WebGPU. The old fixed-function pipeline and the game’s own pixel shaders are turned into WGSL, one shader for each combination of render states.
- Sound. DirectSound’s buffers and the Bink music and voice streams are mixed on a thread and played by an AudioWorklet. The Bink audio decoder was written for this and checked against FFmpeg’s.
Where João steered
pokeMiniGram had to be read out of the ROM and rebuilt one game at a time. This one took far less from João: high-level instructions, some tips on how he wanted it done, and testing on the Mac, the Windows PC and his iPhone. That came to about twenty messages over two days. Claude wrote the code. The turns that came from him:
- The method. No emulator, so the browser runs the best code it can be given.
- The phone. As soon as the game ran, it had to work in his phone’s browser too. That meant HTTPS on the home network, with a certificate authority of its own, because WebGPU and threads need it. It also meant touch controls and a page that sends its log back to the Mac.
- The performance. More on that below.
What the copy protection took
The retail THUG2.exe is protected by SafeDisc. Its code and most of its data are encrypted on disk, and it won’t start on Windows 10 or 11. The code doesn’t matter, because the decomp replaces it. The data does. The game reads tables at fixed addresses: script functions, member function tables, input mappings. The protection was never decrypted, patched or bypassed. The port reads only the exe’s unprotected, read-only section, and the rest was rebuilt from the decomp’s source, table by table.
Performance
The game runs on a thread of its own and records each frame’s Direct3D calls. The page’s thread draws them with WebGPU, at most two frames behind. João has made games before, so the problems were easy for him to spot:
- Hitches the first time something came into view. He saw the frame rate drop and hang while exploring a freshly loaded map. Every new combination of render states built its WebGPU pipeline the first time it was seen, and the frame waited for it. Pipelines are now built in the background, and a draw is skipped until its pipeline is ready.
- Songs in pieces. “Why so many files?” Big files had been cut into parts for Cloudflare, so a song arrived as a run of small downloads. João: “Well that is stupid. And wastes a lot of time.” Files now come whole.
- Sound that froze the game. The game opens songs and voice lines on its own threads while it holds the stream lock, so a download there stopped everything. They now download in the background, and only the stream waits.

After the fixes, the game runs on João’s iPhone 17 at its 60 fps cap, “no problem”. The page’s log from the phone puts the game’s own work at 3.5 to 10 ms of each 16.7 ms frame. Chrome on the Windows PC holds the same cap. The first load is slower, because each file is fetched the first time the game reads it, and the Training level takes about 14 seconds to load cold. After that the files come from the browser’s cache.
One known cost is still in the build. Function-pointer casts are emulated, so every indirect call carries extra arguments. It hasn’t been measured yet, and that comes before any benchmark.
On Cloudflare
For testing, the build also ran from a private site on Cloudflare’s free plan. It was a test bench for João’s own devices, not a release. The game’s files were never public: a small Worker turned away every request for them that didn’t carry his key.
Where it stands

The Training level plays with sound in Chrome on the Mac and the Windows PC, and in Safari on the Mac and the iPhone. A few small bugs are left. João thinks that with time and more play it can become like the original. Still to do: every other level, Firefox, WebGL2 as a second renderer, and the movies, since there’s no Bink video decoder yet.
The port is open source: Loosemond/thug2-web on GitHub. It holds no game files, and no build of the game is published: it runs from your own copy of the game, on your own machine. The project has no ties to Activision or Neversoft, who own the game.
The benchmark, the point of the whole thing, hasn’t run yet. It needs a baseline. A native build of the same source needs 32-bit x86, so Linux or Windows rather than the Mac, and the original exe won’t start on a modern Windows.