This Appendix gives information on how to build and install Knights from the source code.
For Linux a Makefile is provided. Most users should just be able to type "make" followed by "make install" to build and install respectively.
Before compiling, make sure you have the necessary dependencies installed. The game requires Boost, SDL, libcurl, Freetype and Fontconfig. On Debian systems the following packages will satisfy the requirements:
If you only want to build the server (and not the game itself) then you only need the first three of the above.
Also, make sure that you have at least version 1.35 of Boost. Some Linux distributions come with older versions, which will not work with Knights. Also, if your Boost is installed in a non-standard location, you may need to edit CPPFLAGS and/or BOOST_LIBS to get it to build.
You can install only parts of the game by using the following:
By default the game installs the "knights" and "knights_server" executables to /usr/local/bin/, data files to /usr/local/share/knights/, and documentation files to /usr/local/share/doc/knights/. The default install directory can be changed by setting the PREFIX variable, e.g. to install in your home directory use "make PREFIX=$HOME" and "make install PREFIX=$HOME". (The PREFIX should agree between the make and make install commands, otherwise the game will not work!)
For finer control of installation directories, use the following variables:
It is possible to build a version without sound support by editing the Makefile and adding "-DDISABLE_SOUND" to the CPPFLAGS. This might be useful if you are having trouble getting sound to work on your system.
The Makefile also supports "make uninstall" (but make sure you pass the correct PREFIX or DIR variables, e.g. "make uninstall PREFIX=$HOME", if you changed these from their default values).
If you are developing, you may like to know that the Makefile is generated automatically from the Visual Studio project files (see makemakefile.py in the python directory). The Makefile also uses the "Advanced Auto-Dependency Generation" technique described here: http://web.archive.org/web/20080123214633/make.paulandlesley.org/autodep.html.
Most Windows users will use the pre-packaged installer, however if you want to try building the game from source code, then read on.
Project and solution files for Visual Studio are included. (You can get the Visual Studio Express Edition for free from Microsoft.)
Before building, certain dependencies must be obtained. These are:
Extract the Knights source code to a directory of your choice. Then extract the above dependencies as follows:
You should now have a directory structure as follows:
knights_010_src\ curl\ docs\ include\ ... freetype\ builds\ devel\ ... SDL\ docs\ include\ ... SDL.dll ...
Now you can build Knights as follows:
If you want to run Knights.exe from within the IDE then you will need to edit the project settings for KnightsMain: go to Debugging under Configuration Properties and change Command to $(SolutionDir)/Knights.exe (or $(SolutionDir)/Knights_Debug.exe for the Debug build). This is because the game looks in its own directory for the "knights_data" folder at startup, so running it from the standard Debug or Release locations won't work. You will also need to set the StartUp Project to KnightsMain.
The server is built by the KnightsSvrMain project and is named KnightsSvrMain.exe by default.
If you want to build the installer you must install Inno Setup. Then go to the knights_010_src directory and issue the following command:
"c:\program files\inno setup 5\iscc" /O"." /F"knights_010_installer" installer.iss
This will build the "knights_010_installer.exe" in the current directory.
The Scons build files, present in earlier versions of Knights, have now been removed and are no longer supported.