Krig is a cross-platform, open source game engine with accompanying demo game (by the same name).
Original game music created and provided by Shawn Zabel (https://github.com/zabelsr).
All music created from the original song Beyond Compare
: https://github.com/srobbibaro/krig-assets/blob/master/krig3/music/beyond_compare_full.ogg
At this time, Krig is known to build and run on a number of *nix operating systems.
The following configurations are known to work:
- 32/64-bit Debian-based Linux distributions
- 32-bit Debian-based Linux distributions (VM with hardware acceleration)
- 64-bit Debian-based Linux distributions (VM without hardware acceleration)
- Mac OSX Yosemite and El Capitan
Other distributions and configurations should work, but have not been verified.
The Krig Game Engine has a Vagrant project which helps automate setup of the development environment. For information, see: https://github.com/srobbibaro/krig-game-engine-vagrant
Install the following packages:
- lua5.1
- lua5.1-dev
- libalut-dev
- libvorbis-dev
- libglu1-mesa-dev
- libpng-dev
- freeglut3
- freeglut3-dev
- g++
For example:
$ apt-get install lua5.1 lua5.1-dev libalut-dev libvorbis-dev libglu1-mesa-dev libpng-dev freeglut3 freeglut3-dev g++
If you prefer to work with an IDE, you can optionally install CodeBlocks:
For example:
$ apt-get install codeblocks
Install Homebrew to help with package installation.
Install Homebrew Cask to help with application installation.
Install the following application:
- xquartz
For example:
$ brew install caskroom/cask/brew-cask
$ brew cask install xquartz
If you prefer to work with an IDE, you can optionally install CodeBlocks:
$ brew cask install codeblocks
Install the following packages:
- freeglut
- freealut
- libvorbis
- lua51
For example:
$ brew install freeglut freealut libvorbis lua51
If freeglut cannot be installed, you may need to install it like so:
$ brew install homebrew/x11/freeglut
Install GCC:
$ brew tap homebrew/versions
$ brew install gcc48
Create links to required header files:
$ ln -s /System/Library/Frameworks/OpenAL.framework/Headers/ src/AL
$ ln -s /System/Library/Frameworks/OpenGL.framework/Headers/ src/GL
Create links to required library files:
$ sudo ln -s /System/Library/Frameworks/OpenAL.framework/OpenAL /usr/local/lib/libopenal.a
$ sudo ln -s /System/Library/Frameworks/OpenGL.framework/OpenGL /usr/local/lib/libGL.a
$ sudo ln -s /System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib /usr/local/lib/libGLU.a
After the required packages have been installed, the project can be built using the provided makefile.
To build the main executable, run: $ make
or $ make build
.
After the required packages have been installed, launch Code::Blocks and load the krig.cbp project file. Krig should now build with Code::Blocks.
Krig can also be compiled (using Code::Blocks) from the command line.
For example:
$ codeblocks --build krig.cbp
To build the main executable in debug mode, run: $ make build-debug
.
Note: You may need to run $ make clean
prior to running the above command for it
to build the executable properly.
You can also change the setting in source, if you prefer:
The DEBUG
flag is located in src/constants.h and is disabled by default (set to 0).
To enable debug mode, set this value to 1. Debug mode will output debug messages to
stdout in the console. Additionally, some information about the current level
will be output directly to the play screen (for example: player position, camera position,
and FPS). Additionally, the state of debug flag can be queried from game scripts
to provide debug-specific behavior.
#define DEBUG 0
The MSG_LVL
setting found in src/constants.h is used with the DEBUG
flag and controls
the volume of debug information output to stdout. By default, this value is set
to 0 which will output minimal debug. This number can be set higher to see an
increasingly larger number of messages.
Be careful - higher numbers will output a lot of information!
Note: When you build with $ make build-debug
a mid-range setting of 2
is assigned.
#define MSG_LVL 0
To build the main executable in debug mode, run: $ make build-edit
.
Note: You may need to run $ make clean
prior to running the above command for it
to build the executable properly.
You can also change the setting in source, if you prefer:
The EDIT
flag is located in src/constants.h and is disabled by default (set to 0).
When the EDIT
flag is enabled (set to 1), Krig will launch in edit mode. This mode is
designed to aid in level creation. Edit mode gives users the ability to move around
the level freely, manipulate the terrain, and experiment with certain level-specific
variables which can be tweaked on the fly.
#define EDIT 0
The FULL_SCREEN
flag is located in src/constants.h and is disabled by default (set to 0).
When the this flag is enabled (set to 1), Krig will launch in full screen rendering.
Full screen rendering is not compatible with the EDIT
flag and will be ignored when
EDIT
is also enabled.
#define FULL_SCREEN 0
Krig can be run from the command-line using a number of different methods.
The Krig executable is created in the base project directory and is named krig.
You must supply the path to the game to run as the first argument. The Krig
Game Engine comes with a demo game in the root directory, krig3
.
For example:
$ ./krig krig3
The run-demo
make target will also run the above command. For example:
$ make run-demo
Optionally the game can be run from within CodeBlocks, but the game directory krig3
must be specified for it to run properly.
Unit tests can be run with the following command:
$ make run-tests
Doxygen documentation is built (in the html
directory) using the following command:
$ make doc
The lua
programming language is used to script games for the Krig Game Engine. The
engine provides an API designed to handle common game writing tasks. For example,
there are functions which add objects to a level, provide these objects properties,
and notify the script of important events, such as object collisions.
See the API documentation for game scripting details.