Reverse engineering the 1997 game "Carmageddon"
Go to file
Dethrace Engineering Department 65bc16a129
Support for compiling with MSVC 4.20 for binary matching (#465)
* fix some global vars

* make sound support optional

* removes LOG_TRACE calls

* now compiles under msvc 4.2

* removes unused functions, adds ignored functions to report

* bump BRender dependency

* adds docker container for running msvc 4.2

---------

Co-authored-by: Jeff Harris <jeff@1amstudios.com>
2025-07-30 13:27:18 +12:00
.github/workflows Support multiple platform drivers (#444) 2025-05-03 23:44:46 +02:00
cmake Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00
docker Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00
docs Ini file and fallback directories (#462) 2025-07-19 21:32:55 +12:00
lib Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00
packaging Adds proper MacOS bundle and icons for Windows builds (#381) 2024-07-05 09:12:19 +12:00
src Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00
test Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00
tools Adds original 3dfx rendering path (#434) 2025-03-31 18:44:38 +13:00
.clang-format Vehicle damage (#116) 2022-04-01 10:52:09 +13:00
.gitignore Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00
.gitmodules Update BRender-v1.3.2 a submodule (#392) 2024-07-14 23:00:12 +12:00
CMakeLists.txt Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00
CONTRIBUTING.md Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00
LICENSE Create LICENSE 2019-11-18 11:42:18 -08:00
NOTES.md Feature/groove animations (#59) 2021-09-14 12:00:21 +12:00
README.md Ini file and fallback directories (#462) 2025-07-19 21:32:55 +12:00
reccmp-project.yml Support for compiling with MSVC 4.20 for binary matching (#465) 2025-07-30 13:27:18 +12:00

README.md

Dethrace

Workflow Twitter Discord Carmageddon server

Dethrace is an attempt to learn how the 1997 driving/mayhem game Carmageddon works behind the scenes and rebuild it to run natively on modern systems.

Progress

(Follow us on Discord or Twitter to get notified of updates!)

Last updated March 2025

  • 94% of functions implemented
  • Latest screenshot:
Screenshot 2024-05-27 at 8 44 10 AM

Building

Dependencies

Dethrace using CMake to build, and SDL2 at runtime. The easiest way to install them is via your favorite package manager.

OSX:

brew install SDL2 cmake

Linux:

apt-get install libsdl2-dev cmake

Clone

Dethrace uses git submodules, so we must pull them after the inital clone:

git clone https://github.com/dethrace-labs/dethrace
cd dethrace
git submodule update --init --recursive

Build

Dethrace uses cmake

To generate the build files:

mkdir build
cd build
cmake ..

Once cmake has generated the build files for your platform, run the build. For example:

make

Running the game

Dethrace does not ship with any content. You'll need access to the data from the original game. If you don't have an original CD then you can buy Carmageddon from GoG.com.

dethrace also supports the various freeware demos:

Dethrace generally expects to be placed into the top level Carmageddon folder. You know you have the right folder when you see the original CARMA.EXE there. If you are on Windows, you must also place SDL2.dll in the same folder.

Configuration INI file

Alternatively, you may configure a different Carmageddon directory and settings by providing a dethrace.ini file.

CD audio

Dethrace supports the GOG cd audio convention. If there is a MUSIC folder in the Carmageddon folder containing files Track02.ogg, Track03.ogg etc, then Dethrace will use those files in place of the original CD audio functions.

Screenshot 2024-09-30 at 8 31 59 AM

Background

Watcom debug symbols for an earlier internal build were discovered named DETHRSC.SYM on the Carmageddon Splat Pack expansion CD release. The symbols unfortunately did not match any known released executable, meaning they were interesting but not immediately usable to reverse engineer the game.

This is what it looked like from the Watcom debugger - the names of all the methods were present but the code location they were pointing to was junk:

watcom-debugger

We are slowly replacing the original assembly code with equivalent C code, function by function.

Is "dethrace" a typo?

No, well, I don't think so at least. The original files according to the symbol dump were stored in c:\DETHRACE, and the symbol file is called DETHSRC.SYM. Maybe they removed the "a" to be compatible with 8.3 filenames?

Changelog

From the beginning until release

Credits

  • CrayzKirk (did the first manual matching up functions and data structures in the DOS executable to the debugging symbols and proved it was possible!)
  • The developer at Stainless Software who left an old debugging .SYM file on the Splat Pack CD ;)

Dethrace is released to the Public Domain. The documentation and function provided by Dethrace may only be utilized with assets provided by ownership of Carmageddon.

The source code in this repository is for non-commerical use only. If you use the source code you may not charge others for access to it or any derivative work thereof.

Dethrace and any of its' maintainers are in no way associated with or endorsed by SCi, Stainless Software or THQ Nordic.