Skip to content
nolffanPublic

About

No One Lives Forever 2: A Spy in H.A.R.M.'s Way source code

Topics

Resources

Stars

46 stars

Watchers

6 watching

Forks

Repository files navigation

nolf2src

No One Lives Forever 2: A Spy in H.A.R.M.'s Way, built from source.

The game code is Monolith's own public source release (version 1.3, the game's last update), compiled with the compiler Monolith used, Visual C++ 6, under Wine. Where the release differs from what the retail 1.3 game shipped, the retail code is reconstructed from the retail binaries, in place, and marked RETAIL:. The engine, which the release leaves out, is rebuilt from the LithTech Jupiter engine source, taken back to the 2002 engine NOLF2 shipped with (docs/engine/PLAN.md). The aim, as for nolfsrc (the first game), is two builds:

  • legacy: the 1.3 game as it shipped, rebuilt so that it compiles back to the retail binaries byte for byte, as far as that can be done;
  • modern: the same source with fixes and new features (NOLF2SRC_MODERN; docs/MODERN.md), and no RAD binary: its Bink player is ours, on FFmpeg.

Compiling back to the retail bytes means compiling the retail game's bugs as well. The ones found so far are listed in docs/RETAIL_BUGS.md; their fixes go behind NOLF2SRC_MODERN, into the modern build only, so the legacy build keeps matching the retail one.

The main menu A ninja runs across a Japanese courtyard at night, seen over a crossbow A cut-scene: the Serenity Valley trailer court sign under a storm sky A katana fight with Isako in a trailer A cut-scene in a night street: "Oh, hello, Cate." A cut-scene: a briefing at UNITY headquarters A cut-scene: catwalks over a lava cave A street in Calcutta, seen over a pistol

Documentation

To play: docs/INSTALL.md. Everything else -- the modern build, the retail bugs, the build, the engine's reconstruction -- is listed in docs/README.md.

Progress

How much of each binary compiles to exactly the bytes of the retail game, function by function: the table, and how the scoring works and what it leaves out, are in progress/README.md. Which compiler built each binary, and the evidence, is progress/COMPILERS.md.

Building

No game data of the discs is in this repository. The build takes the game's data (and the Bink and Microsoft runtime, the only binaries not built from source) from the retail game, which the build installs from your own images of its two discs and of the 1.3 update's installer (bring your own: see below). The repository holds only this retail data (assets/README.md): the data of Sierra's free 1.3 update and of its two free map packs (assets/rez/, assets/game/, assets/mappack001/, assets/mappack002/), the retail icon that our Lithtech.exe is compiled with (assets/art/, 8 KB), and the release build's ServerDir.dll (assets/serverdir/), our own build, for a build without the LithTech Jupiter SDK.

You need Linux with Docker, the submodules, and your own images:

  1. Fetch the submodules: git submodule update --init. ext/tools/ is the build's scripts, tests and byte-matching tools, shared with the NOLF and Contract J.A.C.K. reconstructions; ext/toolchains/ is the compilers; ext/lithtools/ is our LithTech tools, whose lithrez packs the 1.3 update's data, assets/, into nolf2src.rez, and the map packs into MapPack001.rez and MapPack002.rez; ext/ffmpeg is the modern build's Bink player's decoder.
  2. Put your images in isos/ (a hard link is good: ln <image> isos/), or set NOLF2_ISOS=<directory>: the two discs of the European release (a .iso, a .bin with its .cue, or a .zip of one), the 1.3 update's installer (nolf2-update_1x3.exe), and the CD of the LithTech Jupiter SDK (build 51), whose source ServerDir.dll is built from. make progress also needs the multiplayer demo's installer (nolf2_mpdemo_en.exe). The first build installs the game from them into out/retail/ and checks every file. See docs/BUILDING.md, "What you need".
  3. Run
make            # out/nolf2-legacy-release/ and its -private / -public .tar.gz
make debug      # out/nolf2-legacy-debug/: symbols, NOLF2SRC_DEBUG
make modern     # out/nolf2-modern-release/: NOLF2SRC_MODERN (docs/MODERN.md)
make test       # play it under Xvfb: main menu, new game, the first level
make test TEST_GAME=out/nolf2-modern-release   # the same, on a variant
make help       # everything else

make NODISCS=1 [debug|modern|modern-debug] builds any of them without your images, as CI does: every binary is the same, but the game directory, out/<name>-nodiscs/, has no game data and does not play; its public archive, out/<name>-public.tar.gz, installs from the discs as the one of a normal build does. make progress-ci then checks the build against the hashes in progress/hashes/, without the retail game.

make modern also needs the ext/ffmpeg submodule (FFmpeg, pinned to a release; git submodule update --init ext/ffmpeg): build/ext.sh builds the modern build's binkw32.dll on it, with Zig (in the build image). Each game directory has linux-run.sh, which starts the game with the host's Wine through NOLF2.exe. Modern builds start immediately with the launcher's saved settings and wait until Lithtech.exe exits; open NOLF2Launcher.exe for the interactive launcher. Legacy builds open the launcher: click Play. To go straight into a level when testing a build, use ext/tools/playtest.sh (make test and make shell; its header has the options). linux-server.sh runs the dedicated server NOLF2Srv.exe (under xvfb-run without a display; docs/INSTALL.md, "A dedicated server").

build/build.mk builds Monolith's workspace as Developer Studio would: ext/tools/dsp2mk.py reads TO2.dsw and the project files and writes the rules, compile for compile. docs/BUILDING.md describes the build step by step.

Credits

This project builds on the work of others:

  • Monolith Productions, for No One Lives Forever 2 and for releasing its source code (version 1.3), which src/Game/, src/Engine/sdk/ and src/libs/ are; and, with LithTech, Inc. (later Touchdown Entertainment), for the LithTech Jupiter engine: src/Engine/runtime/ is its source, back-ported to 2002 (docs/LICENSE_NOTES.md).
  • StenApp for generously sharing his invaluable, in-depth knowledge of all things NOLF and LithTech.
  • NOLF 2 Modernizer by HeyThereCoffeee (haekb): https://github.com/haekb/nolf2-modernizer. Many of the modern build's fixes and features were found and designed there; docs/MODERN.md names the Modernizer change behind each one. The modern build reimplements them rather than copying its code (docs/MODERN.md, "Rules for this work").
  • nolfsrc, the same project for the first game: the method, the tools and guides, the Bink player, and many of the modern build's designs (each item that follows one says so).
  • FFmpeg (https://ffmpeg.org), on which the modern build's Bink player is built.
  • Wine and Proton, which run the game on Linux and the Steam Deck.
  • redump.org, for the verified disc images the installers check against.

About

No One Lives Forever 2: A Spy in H.A.R.M.'s Way source code

Topics

Resources

Stars

46 stars

Watchers

6 watching

Forks

Releases

Contributors

Languages