Building the source of Seven Kingdoms Ancient Adversaries on Ubuntu Linux

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

The code is in a git repository here, with instructions over here. If you don’t have git on your system, install it with:

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

The code uses the SDL and OpenAL libraries for cross platform sound, graphics and network support:

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:

./autogen.sh

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:

./configure

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! Smile

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!

Advertisements
This entry was posted in General Technical and tagged , , , , . Bookmark the permalink.

7 Responses to Building the source of Seven Kingdoms Ancient Adversaries on Ubuntu Linux

  1. Suzanne says:

    Yay Pieter! Welkom in die blog-heelal 🙂 Ek het nou nie baie verstaan in hierdie post nie, maar ek het dit nietemin gelees 🙂

  2. Wallace Williams says:

    Hello,

    Is there a way I can edit the game files without having to recoding the entire game?

  3. Artur says:

    There was need to install libenet-dev library too… There is no autogen.sh script anymore, just configure

  4. Will says:

    Hi Pieter,

    I’m a huge 7kaa fan who has tried (and failed) many times to run it on OSX. I am now trying to run it on Ubuntu using VirtualBox. Your steps worked great until “Running the build.” Full disclosure: I have no experience compiling, coding, etc. I stumbled this far. Here’s what I get:

    wreid87@wreid87-VirtualBox:~$ /home/wreid87/7kaa/autogen.sh
    + rm -rf aclocal.m4 autom4te.cache config.guess config.h.in config.sub configure depcomp install-sh missing
    + rm -f ABOUT-NLS config.rpath m4/codeset.m4 m4/fcntl-o.m4 m4/gettext.m4 m4/glibc2.m4 m4/glibc21.m4 m4/iconv.m4 m4/intdiv0.m4 m4/intl.m4 m4/intldir.m4 m4/intlmacosx.m4 m4/intmax.m4 m4/inttypes-pri.m4 m4/inttypes_h.m4 m4/lcmessage.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/lock.m4 m4/longlong.m4 m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/progtest.m4 m4/size_max.m4 m4/stdint_h.m4 m4/threadlib.m4 m4/uintmax_t.m4 m4/visibility.m4 m4/wchar_t.m4 m4/wint_t.m4 m4/xsize.m4 po/Makefile.in.in po/Makevars.template po/Rules-quot po/boldquot.sed po/en@boldquot.header po/en@quot.header po/insert-header.sin po/quot.sed po/remove-potcdate.sin
    + test ” == clean
    + autopoint -f
    /home/wreid87/7kaa/autogen.sh: line 17: autopoint: command not found
    + aclocal -I m4
    /home/wreid87/7kaa/autogen.sh: line 19: aclocal: command not found
    + autoheader
    /home/wreid87/7kaa/autogen.sh: line 20: autoheader: command not found
    + autoconf
    /home/wreid87/7kaa/autogen.sh: line 21: autoconf: command not found
    + automake –add-missing
    /home/wreid87/7kaa/autogen.sh: line 22: automake: command not found
    wreid87@wreid87-VirtualBox:~$ /home/wreid87/7kaa/configure
    bash: /home/wreid87/7kaa/configure: No such file or directory
    wreid87@wreid87-VirtualBox:~$

    Any ideas? I’m so close (I think)! And thanks so much for posting this.

    Will

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s