Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Need for Speed: Underground 2 in the browser

A fan project that runs the PC game Need for Speed: Underground 2 (2004) in Google Chrome and Firefox. The game's x86 code is translated to C ahead of time and compiled to WebAssembly. Direct3D 9 runs on WebGPU and the sound on Web Audio. You bring your own copy of the game.

Based on NFSU2Recomp by Talha Müderrisoğlu, the original x86 → C static recompiler for NFSU2. This project was forked from its MIT-licensed version of 16 October 2026 and uses only code from that version.

Not affiliated with or endorsed by Electronic Arts. This repository contains none of the game's code or data.

The start page: Play, the controls, your saves and Online

What you need

  • The game: your own PC copy, patched to v1.2 (North America), with this exact SPEED2.EXE (other versions will not work): 4,800,512 bytes, SHA-256 f9dd86c054878ce6276beb07c1fd61874f7a1e4bf1f241b084c65b73e24168a7.
  • To build: an Apple Silicon Mac (the tested setup) or Linux, Python 3, Node.js 20 or newer, Rust (rustup), and wasi-sdk 34 for that system unpacked into deps/. On Windows, build in WSL 2 with the clone in the Linux file system (~/nfsu2-web): under /mnt/c it builds much slower.
  • To play: the latest Google Chrome, or Firefox where it has WebGPU (Windows, macOS).

Build

python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
web/gen.sh "/path/to/Need for Speed Underground 2/SPEED2.EXE"   # translate the game's code to C (into gen/)
web/build.sh                                                    # compile it to out/web/nfsu2.wasm

The generated C and the compiled module are made from the game, so they are never committed (.gitignore).

Play

web/start.sh --data "/path/to/Need for Speed Underground 2"

Open http://localhost:8080/ in Chrome or Firefox and press Play. The start page has the settings, your saves and the controls. The player's guide is docs/web/PLAYING.md. The game plays in any of its thirteen languages, in Brazilian Portuguese, in Polish, in Turkish, in Hungarian or in Ukrainian; the dubbed voices and movies and the Portuguese, Polish, Hungarian and Ukrainian text come from mods, the Turkish text is this repository's own translation (tools/lang/turkish.json, with a mod's fonts), as language packs. The menus and HUD can be redrawn at four times their size, from a mod as a texture pack.

To play with friends, run the server behind HTTPS (other PCs need a secure context): web/deploy/ has a Docker setup. Everyone who plays from the same server can meet in free roam.

How it works

  • tools/: a Python lifter (Capstone) turns every function of SPEED2.EXE into C.
  • runtime/: Windows, Direct3D 9, DirectSound and DirectInput, reimplemented. runtime/web/ holds the browser parts.
  • web/src/: the page. It runs the game's threads as workers on one shared memory, draws with WebGPU and plays sound through an AudioWorklet.
  • web/server-rs/: the server, in Rust: serves the page, the module and your game folder, and connects players for multiplayer.

The same tree still builds the native macOS version (./gen.sh, ./build.sh && ./link.sh, ./run.sh).

Credits

Based on Talha Müderrisoğlu's NFSU2Recomp (its MIT version, see the top), the static recompilation of NFSU2 for Apple Silicon, which in turn follows the method of N64: Recompiled and XenonRecomp. The language packs are built from KyoriAsh's Multi 13 languages mod (with Lee-Ryo's Thai support, whose patch runtime/language.c follows), from TraduMix's and MixMods' Brazilian Portuguese translation (Fyro, Beater, Kerlyston F.; Junior_Djjr, SideWinder, Elyzandro), from PLProjekt's Polish translation (Daniel Graszka, MaDeR, Marcin Piech, Nati, Mateusz Wilkowski, alter), from VileStuff's English Subtitles Fixed, from muntazam's Turkish translation (its fonts), from GameHunter's Hungarian translation (L_zooltan) and from Clark X.'s Ukrainian translation. The texture pack is built from LunicAura106's Upscaled HUD. Built with the help of Claude Code.

License

MIT (LICENSE). Need for Speed and Need for Speed: Underground 2 are trademarks of Electronic Arts Inc.

关于 About

No description, website, or topics provided.

语言 Languages

C34.5%
Rust25.5%
JavaScript13.0%
TypeScript12.2%
Objective-C5.1%
Python4.5%
C++2.7%
Shell1.3%
CSS0.8%
HTML0.3%
Dockerfile0.0%
PowerShell0.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
699
Total Commits
峰值: 370次/周
Less
More

核心贡献者 Contributors