I recently discovered that Seven Kingdoms: Ancient Adversaries had gone Open Source! This innovative RTS was one of my primary sources of sleep depravation when I was in high school. I remember lugging my computer (tower, CRT monitor, all of it) over to my friend’s house by foot, linking our machines with a home made serial cable, and playing the whole night through.
While the objective of the game, conquest, is hardly original, the game made great use of diplomacy, economy, loyalty and even espionage to offer gameplay mechanics all together different from the usual “gather gold, build army, swarm opponent” methodology.
The game’s source code was (most kindly) released by Enlight Software in 2009 and now lives over at 7kfans.com. Those guys have done an excellent job of modernising the code, and it now runs on both Windows and Linux systems.
I decided to grab the source and build it, for a number of reasons:
- I have an interest in game development, and this offers an opportunity to peek inside the code of a game I already know. Most of all I am eager to see how the game’s Artificial Intelligence is implemented!
- It offers the opportunity to polish up on a number of my rusty or underdeveloped skills. The source is in a git repository, which I rarely use (I mainly use SVN). I miss playing around in Linux and those skills are oxidising fast. Furthermore, the code is in C++ which I have never really used, so this is a great chance to learn.
- It’s a way for me to get familiar with open source projects – maybe I could even contribute a patch or two.
Building from source is hard if you haven’t done it before
I underestimated the complexity of downloading and building this code – mostly because it is something I have never done before. Also, my current Ubuntu installation has barely been used, and I haven’t done any development on it at all. So I was going to need to install a lot of tools.
The 7kfans guys offer a wiki page to get you started on the code, but I suspect they have been doing this a while, and I would have appreciated a more thorough guide. So, now that I have figured it out and got the game running (yay!), I am writing this guide for the reference of anyone else who wants to try.
I cannot guarantee that these steps will always be required, and I also cannot guarantee that these steps will always be sufficient. However, this is what it took for me to get the game built on a (practically) virgin Ubuntu 12.04 netbook.
If I missed something, or if I’m hopelessly confused without realising it, please enlighten me in the comments below!
Getting the source code
sudo apt-get install git-core
Switch to the folder where you want the source, and clone the source code repository using:
git clone git://www.7kfans.com/7kaa.git
Getting all the dependencies ready
It took me some trial and error, but here are the dependencies I needed to install for the build to work. Remember that I started with a machine that didn’t even have a compiler on it, so if you’ve used your machine for development before, you likely have a couple of these already.
First off, you’ll need a C++ compiler:
sudo apt-get install g++
The project uses Autoconf to generate the configuration scripts for the build:
sudo apt-get install autoconf
sudo apt-get install libsdl1.2-dev sudo apt-get install libopenal-dev sudo apt-get install libsdl-net1.2-dev
Lastly, you’ll need the Make utility to put it all together:
sudo apt-get install make
Running the build
Run the following script in the root folder of the source tree:
This script removes any previous configuration and runs Autoconf to generate configurations for the impending build operation, and to perform some other wizardry that I still have to figure out.
autogen.sh will leave you with a configure script, which you can optionally run to check that you are in fact ready for the build:
Check towards the end of the output to see if anything is missing. If there is something, please post the solution below, so I can add it here!
Finally, you can type make to compile the source, and if you are happy that it compiles, the following will both compile and install the game:
sudo make install
And you’re done! Type 7kaa to launch the game, and grab a beer (or coffee, if you are so inclined) to celebrate!