This project is my attempt to remake Betrayal at Krondor using OpenGL.
It started out as a fun project to learn about graphics programming, but I've spent the vast majority of the time reverse engineering and reimplementing the game mechanics instead!
The game is mostly playable (with many rough edges), excluding combat. The engine can also use substitute textures for the graphics, so modders can produce hi-res texture packs for the game. Improving the 3D graphics will probably land at the end of the roadmap at this point as matching as close as possible the original game behaviour is much more addictive.
I've started documenting how Betrayal at Krondor works on this blog.
Here's a very quick look at some gameplay.
See the issues page to see what remains.
This project would not have been possible without Guido de Jong's original work on xbak (http://xbak.sourceforge.net/).
I have used the late Eysteinn Björnsson's wonderful BaK Help Web extensively as a reference. This website is currently hosted at https://dimwood.net/krondor.html by vga256. I've also archived the contents on github.
You will need a copy of Betrayal at Krondor for the game data files. These can be found on the web pretty easily.
Building this project requires CMake, SDL2, OpenGL, glew, and freeglut.
I use some features of C++23, so a more recent gcc or clang will be required to compile the code. You can check the CI to see what versions I am currently using.
I've provided pre-built binaries for Windows. You can get the latest release here. I've only tested this on my own system, so if it is missing DLLs or there are other issues please report an issue
Follow the setup instructions below. Unzip the release zip and run the main3d
binary.
This project uses cmake. It can be built easily with
mkdir build; cd build;
cmake ..
make
The relevant binaries will be placed in your build directory.
You can build on Windows by opening the project in Visual Studio.
You may need to manually download some of the dependencies (freeglut, glew, and SDL2) and modify the CMakeLists.txt to point to them.
Due to Apple's deprecation of OpenGL Mac is not currently supported. It may compile and run if the required dependencies are installed and with some massaging of the CMake files.
BaKGL needs to find a number of different files in order to run with the game's original data. These are searched for in the bak main directory.
On UNIX systems this will be $HOME/bak
, under Windows it will be %APPDATA%\bak
. I will hereafter refer to this directory as $BAK_MAIN_DIR
for both platforms.
In order to play around with the project you will need the original game data files.
You will specifically need the following files from your game:
krondor.001
krondor.rmf
frp.sx
startup.gam
BaKGL will look in either the current directory from which you ran the executable, or $BAK_MAIN_DIR/data
for the game data files, so please copy them to the appropriate folder.
Make sure you check the case of the filenames in the folder where you installed BaK, if they are capitalised you will need to rename or copy them to lowercase.
Save files will be searched for in the $BAK_MAIN_DIR/GAMES
directory, you can copy your old saves directory to this location. Alternatively, if you have no saves, the game will create this folder when you save your first game.
The main application is main3d
. You can run this in the terminal in linux, select it as the target in Visual Studio, or double click the binary if using pre-built binaries.
build $ ./main3d
Start a new game from the main menu as normal, and enjoy :)
You can specify a config file to customise BaKGL. By default it will be loaded from $BAK_MAIN_DIR/config.json
. You can also specify a config file by command line:
$ ./main3d -c path/to/config.json
An example config.json
is included in the main directory of the repo.
BaKGL supports replacing the original game image files with your own.
In the config.json
file, specify the path to your mod directory using the /Paths/GraphicsOverrides
key. This directory should contain your custom graphics files in PNG format.
On Windows I had to escape the path:
"GraphicsOverrides": "C:\\Users\\xavieran\\AppData\\Roaming\\bak\\mod_base"
The game will look in this mod directory for files that match the names of the original game assets. For example, if the game would normally load ACT002.BMX
, you can place a replacement file, called ACT002.PNG
, in the graphics overrides directory. The game will use your custom file instead of the original one. You should make sure your replacement file has the same aspect ratio as the original file or it will look stretched when rendered in game.
Some BMX files may contain multiple images, for example the inventory icons file (INVSHP0.BMX
). For these, the game will look for a subdirectory named after the base file and use an indexed image.
If the original file is INVSHP0.BMX
and the game needs the first image , it will search for a file named INVSHP0.BMX/0.PNG
in your graphics mod directory.
I've provided an application to export all images from the game into a directory structure suitable for use as a template for modding. You can run it like so:
build $ ./image_extractor -r krondor.001 -i krondor.rmf -o mod_dir
You can use this as the basis for graphical mods. Use this directory as the /Paths/GraphicsOverrides
key. Replace the PNG files in this directory structure with higher resolution ones as you make them.