A while ago the OpenTomb developers accepted my contribution that allowed the engine to be compiled under Linux.
This was not too hard, since the engine only depends on cross-platform libraries and uses GCC to compile on Windows. It mainly consisted of a CMake script and a few code fixes.
The CMake script already contains a very brief explanation on how to compile on the command-line.
This post provides a more detailed step-by-step guide to get everything up and running for development on Linux.
Tested with:
- Arch Linux
- Latest OpenTomb commit as of 20140216
- Latest config files from OpenTomb binary archive
Requirements:
- SDL2 installed (tested with 2.0.1)
- zlib installed (tested with 1.2.8)
- Mercurial installed (tested with 2.9)
- CMake 2.8 installed (tested with 2.8.12)
- QtCreator installed (tested with 3.0.1)
- Game assets of TombRaider 1-5 (tested with GOG version)
Get the source code
Choose a directory and clone the OpenTomb source code repository:hg clone http://hg.code.sf.net/p/opentomb/code opentomb-code
Compile using QtCreator
- Start up QtCreator and select
File -> Open File or Project
. - Navigate to your cloned repository directory and open
CMakeLists.txt
.
- Choose a build directory. Make sure it is located outside of the repository. The default build directory suggested by QtCreator (e.g.
opentomb-code-build
) is usually just fine.
- Provide CMake with the arguments
-DCMAKE_BUILD_TYPE=Debug
(if you plan to develop) or-DCMAKE_BUILD_TYPE=Release
(if you just want to run the engine). - Select
Unix Generator
as the generator and clickRun CMake
. This should successfully create a Makefile if the required libraries are installed. ClickFinish
.
- Hit
Ctrl+B
to start compilation. This can take a while to complete and creates the OpenTomb executable inside the build directory.
Pro tip: faster compilation
Add -j2
or -j4
(depending on how many CPU cores you have) into Projects -> Build & Run -> Build Steps -> Details -> Additional arguments
.
Add config files
Extract the files form the OpenTomb binary archive (engine.7z) into the build directory. The important files/directories are: data, save, scripts, VeraMono.ttf, ascII.txt, config.lua.
Add game assets
Copy game files from the original Tomb Raider games into the corresponding data
subdirectory like you would on Windows. E.g. copy all “*.TR2” levels from the Tomb Raider 2 data directory into opentomb-code-build/data/tr2/data
.
To get audio, copy MAIN.SFX
, too.
Final touch
Modify cvars.game_level
in config.lua to match an existing level file, e.g. data/tr2/data/WALL.TR2
. Keep in mind, that file paths in Linux are case sensitive.
Now you should be able to launch the game using the file browser or from within QtCreator via Ctrl+R
.