Skip to content

A modern re-implementation of the classic DOS game Duke Nukem II

License

Notifications You must be signed in to change notification settings

pratikone/RigelEngine

 
 

Repository files navigation

Rigel Engine Build Status Windows build status Join the chat at https://gitter.im/RigelEngine/community GitHub All Releases

What is Rigel Engine?

This project is a re-implementation of the game Duke Nukem II, originally released by Apogee Software in 1993. RigelEngine works as a drop-in replacement for the original executable: It reads the original data files and offers the same experience (with some improvements), but runs natively on modern operating systems, and is written in modern C++ code with a completely new architecture under the hood. It is similar to projects like Omnispeak or Commander Genius, which do the same thing for the Commander Keen series of games.

There was never any source code released for the original game, so this project is based on reverse-engineering the original executable's assembly code. Video captures from DosBox are used to verify re-implemented behavior. See my blog post to learn more about the process.

Here's a video showcasing the project:

Current state

Gameplay-wise, RigelEngine is feature-complete: All four episodes of the game (shareware and registered version) are fully playable and on par with the original game.

The project overall is far from finished, though. There are still some pieces missing to reach full parity with the original game (configurable controls/key bindings, a few visual effects, some screens in the menu, demo playback). On top of that, more modern enhancements and usability improvements are planned.

Supported platforms

RigelEngine runs on Windows, Linux, and Mac OS X.

It also runs on the Raspberry Pi, but that's work in progress as there are still some issues to be sorted out. See build instructions.

Android and iOS versions might happen someday, but there are no concrete plans at the moment.

System requirements

RigelEngine is not very demanding, but it does require OpenGL-capable graphics hardware. Either OpenGL 3.0 or OpenGL ES 2.0 can be used, depending on what's chosen at compile time. To build in GL ES mode, pass -DUSE_GL_ES=ON to CMake.

Most Desktop/laptop graphics cards support OpenGL 3.0 nowadays. However, some older integrated GPUs might only support OpenGL 2. For these systems, using GL ES can be an option as well. This has been confirmed to work on Ubuntu 18.04 on an older laptop.

Differences to the original Duke Nukem II

See list of differences.

Contributing

Contributions to RigelEngine are very welcome! Please have a look at the contribution guide before making a PR.

There is a growing body of documentation on the Wiki, to help with getting into the code base. A good place to start is Architecture Overview

If you are looking for some easy tasks to get started, take a look at issues labeled good first issue.

Running RigelEngine

In order to run RigelEngine, the game data from the original game is required. Both the shareware version and the registered version work. When launching RigelEngine for the first time, it will show a file browser UI and ask you to select the location of your Duke Nukem II installation. The chosen path will be stored in the game's user profile, so that you don't have to select it again next time.

It's also possible to pass the path to the game files as argument on the command line, which can be handy during development.

Acquiring the game data

The full version of the game (aka registered version) is not available currently, but you can still download the freely available shareware version, e.g. from archive.org.

If you already have a copy of the game, you can also point RigelEngine to that existing installation.

The only files actually required for RigelEngine are:

  • NUKEM2.CMP (the main data file)
  • NUKEM2.F1, .F2, .F3 etc. up to .F5 (intro movie files)

Currently, the game will abort if the intro movies are missing, but they aren't mandatory for gameplay, and I'm planning to make them optional in the future.

If there are existing saved games, high score lists, or settings found in the game files, RigelEngine imports them into its own user profile when running for the first time.

Command line options, debugging tools, more info

You can find more info that didn't quite fit in this README over on the Wiki. For example, you'll find info on how to activate the built-in debugging tools, a list of bugs in the original version that have been fixed in Rigel Engine, etc.

Getting binaries

Pre-built binaries for Windows are provided with each Release. You can also grab a build of the latest master branch by going to AppVeyor, clicking on "Configuration: Release", and then clicking on "Artifacts".

Thanks to @mnhauke, there is now also a Linux package for OpenSUSE Tumbleweed.

I'm planning to provide binaries for OS X, Ubuntu/Debian, and Raspberry Pi in the future, but right now, you need to build the project yourself on these platforms.

Building from source

Get the sources

First of all, get the sources:

# Clone the repo and initialize submodules:
git clone git@github.com:lethal-guitar/RigelEngine.git
cd RigelEngine
git submodule update --init --recursive

A note about warnings as errors

By default, warnings during compilation are treated as errors. This behavior can be changed by passing -DWARNINGS_AS_ERRORS=OFF to CMake when configuring. If you plan to work on RigelEngine, I'd recommend leaving this on, as you might otherwise have your build fail on CI despite it building successfully locally.

On the other hand, if you only want to use RigelEngine, but there are no pre-built binaries for your platform, disabling warnings as errors is recommended.

To build from source, a C++ 17 compatible compiler is required. The project has been built successfully on the following compilers:

  • Microsoft Visual Studio 2019 (version 16.1.6 or newer)
  • gcc 8.1.0
  • clang 7.0.0

Slightly older versions of gcc/clang might also work, but I haven't tried that.

CMake version 3.12 or newer is required in order to generate build files.

The project depends on the following libraries:

  • SDL >= 2.0.4
  • SDL_mixer >= 2.0.1
  • Boost >= 1.65

The following further dependencies are already provided as submodules or source code (in the 3rd_party directory):

  • entityx Entity-Component-System framework, v. 1.1.2
  • Speex Resampler (taken from libspeex)
  • DBOPL AdLib emulator (taken from DosBox)
  • Catch testing framework

In order to be able to install all required dependencies from the system's package manager, a fairly recent distro is required. I have successfully built the project using the following instructions on Ubuntu 19.04 and 19.10. Building on Ubuntu 18.04 is also possible, but it requires a few more steps.

For other distros (not based on Debian), the same instructions should work as well, with only the package installation command needing adaptation, as long as all necessary dependencies are available at recent enough versions.

# Install all external dependencies, as well as the CMake build system:
sudo apt-get install cmake libboost-all-dev libsdl2-dev libsdl2-mixer-dev

# Configure and build (run inside your clone of the repo):
mkdir build
cd build
cmake .. -DWARNINGS_AS_ERRORS=OFF
make -j8

# NOTE: The -j<NUM_PROCESSES> argument to 'make' enables multi-core
# compilation, '8' is a good number for a 4-core machine with hyperthreading.
# You may want to tweak this number depending on your actual CPU configuration.
#
# If you plan to develop RigelEngine, I recommend dropping the
# -DWARNINGS_AS_ERRORS part - see the note about warnings as errors above.

# Now run it!
./src/RigelEngine

Ubuntu 18.04 almost provides everything we need out of the box, aside from CMake and gcc. Fortunately, we can install gcc 8 alongside the system default of gcc 7, and it's available in the package manager. CMake, however, has to be built from source or installed via a PPA.

# Install all external dependencies, and gcc 8. CMake will be built from source.
sudo apt-get install g++-8 libboost-all-dev libsdl2-dev libsdl2-mixer-dev

# Now we need to install a newer version of CMake. If you already have CMake
# installed, you can uninstall it by running:
#
# sudo apt purge --auto-remove cmake
#
# If not, proceed directly with the following:
mkdir ~/temp
cd ~/temp
wget https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4.tar.gz
tar -xzvf cmake-3.15.4.tar.gz
cd cmake-3.15.4

./bootstrap
make -j8 # adjust depending on number of CPU cores in your machine
sudo make install

# Now, when you run cmake --version, it should say 3.15. You can delete the
# ~/temp folder.

# Now we can build. Navigate to where you've cloned the repo, then:
mkdir build
cd build

# Now we need to tell CMake to use gcc 8 instead of the system default
# (which is 7). You only need to do this when running CMake for the first time.
export CC=`which gcc-8`
export CXX=`which g++-8`

# Finally, we can configure and build as usual (see above).
cmake .. -DWARNINGS_AS_ERRORS=OFF
make -j8 # adjust depending on number of CPU cores in your machine

# Now run it!
./src/RigelEngine

On Fedora, the following command installs all required dependencies:

sudo dnf install cmake boost-devel boost-program-options boost-static SDL2-devel SDL2_mixer-devel

Note the additional boost-static package - without it, there will be linker errors.

This also assumes that make, gcc and gcc-c++ are already installed.

⚠️ Note that Raspberry Pi support is still work in progress, and there are some issues.

To build on the Pi itself, I recommend Raspbian (aka Raspberry Pi OS) Buster. Older versions like Stretch don't have recent enough versions of CMake, Boost and Gcc.

Installing the dependencies on Buster works exactly like on Ubuntu.

When building, you need to enable OpenGL ES Support:

mkdir build
cd build
cmake .. -DUSE_GL_ES=ON -DWARNINGS_AS_ERRORS=OFF
make

To get playable performance, I had to run the game outside of the Desktop environment (X server). To do that, switch to a new terminal using Ctrl+Alt+F1 and launch the game there.

❗ Currently, the project needs to be built using clang installed via Homebrew - it does not build successfully using Apple's clang.

Note that you'll need Xcode 10 and OS X Mojave (10.14) if you want to use clang 8. In the past, I have successfully built the project on OS X Sierra (10.12) when using clang 7 (brew install llvm@7), and I'm not aware of any reason why the project shouldn't build on clang 7 anymore. However, I'm building with clang 8 these days, so it's possible that something broke.

Here's how you would install all dependencies as well as clang 8 via Homebrew and build the project using it:

# You might need to run brew update
brew install llvm@8 cmake sdl2 sdl2_mixer boost

# Set up environment variables so that CMake picks up the newly installed clang -
# this is only necessary the first time
export rigel_llvm_path=`brew --prefix llvm@8`;
export CC="$rigel_llvm_path/bin/clang";
export CXX="$CC++";
export CPPFLAGS="-I$rigel_llvm_path/include";
export LDFLAGS="-L$rigel_llvm_path/lib -Wl,-rpath,$rigel_llvm_path/lib";
unset rigel_llvm_path;

# Now, the regular build via CMake should work:
mkdir build
cd build
cmake .. -DWARNINGS_AS_ERRORS=OFF
make

❗ Currently, only 64-bit builds are possible.

First, you need to install CMake if you don't have it already. You can grab it from the Kitware website, I went for the Windows win64-x64 Installer variant.

For getting the dependencies, I strongly recommend using vcpkg:

vcpkg install boost-program-options:x64-windows boost-algorithm:x64-windows sdl2:x64-windows sdl2-mixer:x64-windows --triplet x64-windows

Then pass CMAKE_TOOLCHAIN_FILE=C:/path/to/your/vcpkgdir/scripts/buildystems/vcpkg.cmake when invoking CMake.

mkdir build
cd build

# Remember to replace <vcpkg_root> with the path to where you installed vcpkg!
cmake .. -DWARNINGS_AS_ERRORS=OFF -DCMAKE_TOOLCHAIN_FILE=<vckpkg_root>/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_GENERATOR_PLATFORM=x64

# This will open the generated Visual Studio solution
start RigelEngine.sln

Rigel Engine can be built to run on a web browser using Emscripten. Note that this is still work in progress, as there are some issues to resolve.

Refer to Emscripten's README for instructions on how to install and activate Emscripten. You can verify the installation by running the emcc command. If it executes then everything is configured correctly.

The instructions to build are the same as above, except for the CMake part:

emcmake cmake .. -DWARNINGS_AS_ERRORS=OFF -DWEBASSEMBLY_GAME_PATH=<path-to-duke2-folder>
make

This will produce a couple of files in the <path-to-cmake-build-dir>/src folder. To run the game, you need to run a web server to host the files in that folder, and then open Rigel.html in your browser. Just opening Rigel.html directly will not work, as the web page needs to load the wasm code and data, which most browsers don't allow when using the local file:/// protocol.

The easiest way to host the files is using Python. In the CMake build directory, run:

# Python 2
python -m SimpleHTTPServer

# Python 3
python3 -m http.server

This will host the game at localhost:8000/src/Rigel.html.

About

A modern re-implementation of the classic DOS game Duke Nukem II

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 96.7%
  • CMake 3.3%