[[TOC]] The current release of the game is aimed at developers and not at 'normal' users. As such, the following instructions assume a reasonable level of technical proficiency. If you encounter difficulties, please post on the [http://www.wildfiregames.com/forum/index.php?showforum=312 forum]. == General prerequisites == You'll need: * An adequately high-spec computer - several gigabytes of free disk space, preferably at least 1GB of RAM for compiling, a fast CPU unless you want to spend ages waiting for the compiler, etc. Modern graphics hardware is also recommended, though the game can run (slowly) on fairly old devices (!GeForce 4, Intel 945GM, etc). * Up-to-date system software (Windows service packs, graphics driver updates, etc). * Some technical proficiency. We try to make the build process as smooth and painless as possible, but it's designed to be followed by programmers - if you just want to play the game, wait for a pre-packaged installer instead. == Windows == Windows XP and Vista are the main supported versions; 2000 and 7 may work too. === Acquiring the code === The game's code, data and build environment are stored on a Subversion server. The recommended way to get an up-to-date copy is with TortoiseSVN: * Download and install [http://tortoisesvn.net/ TortoiseSVN]. (Make sure you reboot when it asks you to.) * Use TortoiseSVN to check out `http://svn.wildfiregames.com/public/ps/trunk/`. This may take a while, and will use around 700MB of disk space. Make sure it's in a path that does not contain any space characters. * '''Note:''' The SVN server is currently very busy, and is likely to return "503 Service Unavailable" errors. You might want to wait a few days before downloading all the code. (Linux users should see below for a quicker way to download the code.) The [http://tortoisesvn.net/docs/release/TortoiseSVN_en/index.html TortoiseSVN manual] has information on [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-checkout.html checking out], as well as [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-update.html updating] and [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-patch.html creating patches]. (This is the read-only public SVN URL. If you have commit access, you need to use `http://svn.wildfiregames.com/svn/ps/trunk/` instead.) === Setting up the build environment === The game must be compiled with Microsoft Visual C++. If you already have Visual C++ 2005 or 2008 installed, make sure you have SP1 and then continue. Otherwise, you can get the free Express edition: * Download and install [http://www.microsoft.com/express/ Visual C++ 2008 Express Edition]. (You can skip the optional Silverlight and SQL Server components.) (If you have the old VC++ 2005 Express, you need to install the separate [http://www.microsoft.com/express/2005/platformsdk/default.aspx Platform SDK] (steps 1-3).) The Visual Studio project/solution files are automatically generated from the source files: * Run `build/workspaces/update-workspaces.bat`. * Open `build/workspaces/vc2008/pyrogenesis.sln`. (If you have VC++ 2005, use the `vc2005` directory instead.) Now you should be able to build the code from within Visual Studio, using "Build Solution" (F7). === Running === Run the game with F5 inside Visual Studio (assuming "pyrogenesis" is set as the startup project, which is default). If you want to run it outside the debugger, run `binaries/system/pyrogenesis_dbg.exe`. To run the (currently quite minimal) automated tests, run the "test" project. (Right click on "test" and "set as !StartUp Project" and F5; or right click, "Debug", "Start new instance"). In VS's debug output window, ignore any "first-chance exception" messages; it should say ".......OK!" if it succeeded. === Keeping up to date === After you've set everything up, the process for staying up to date is: * [http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-update.html Update] the root directory of the checkout. * Close the solution in Visual Studio if you've got it open. Run `update-workspaces.bat` again. (This is only needed if any source files have been added or removed. If you forget to run this, you'll probably get build errors about missing symbols.) * Build again. == Linux, OS X == This is much less streamlined than the process for Windows. But you're cooler than a Windows developer, so you should be able to cope. * Install various standard tools and development libraries: * GCC (at least 4.1, preferably 4.3) * Subversion * NASM * There is a [http://sourceforge.net/tracker/?func=detail&aid=2821249&group_id=6208&atid=106208 bug] in NASM 2.06 on x86_64, so you might want to try a different version if you get errors. * SDL * Boost * zlib * libpng * libxml2 * OpenGL * OpenAL * libogg * libvorbis * cryptopp * !SpiderMonkey (1.6, threadsafe) (sometimes called libjs) * wxWidgets (probably called wxgtk on Linux) (optional, but required for the editor tools) * gamin (Linux only) * BFD (typically called something like binutils-dev) (Linux only) * enet * DevIL * and maybe some other things? * For '''Ubuntu''' the following might help: ''sudo apt-get install build-essential libsdl1.2-dev zlib1g-dev libpng12-dev libjpeg62-dev libgamin-dev nasm libwxgtk2.8-dev libboost-dev libboost-signals-dev libboost-filesystem-dev libopenal-dev libalut-dev libvorbis-dev libogg-dev libcrypto++-dev binutils-dev libnspr4-dev libdevil-dev libenet-dev libxml2-dev'' * For '''OS X''', please see [http://trac.wildfiregames.com/wiki/BuildInstructions#OSX detailed section here after]. * You'll need a multi-threaded build of !SpiderMonkey. If you have a single-threaded version, you should get some compiler errors and you might need to compile the right version yourself (see below). * `svn co http://svn.wildfiregames.com/public/ps/trunk/` (or `http://svn.wildfiregames.com/svn/ps/trunk/` if you have commit access) * '''Note:''' The SVN server is currently very busy, and is likely to return "503 Service Unavailable" errors. You might want to wait a few days before downloading all the code. Alternatively, download and extract http://os.wildfiregames.com/ps-snapshot-r6953.tar.gz (300MB) or http://os.wildfiregames.com/ps-snapshot-r6953.tar.7z (140MB, 7-Zip) then run `svn up`. (The snapshot requires Subversion 1.5 or higher. It will break badly if you try it on Windows.) * `( cd trunk/libraries/fcollada/src && make )` * `cd trunk/build/workspaces` * `./update-workspaces.sh` (you'll have to repeat this step each time a source file is added or removed) * `cd gcc` * `make -j3` (where `3` is the number of parallel builds to run, and could perhaps be one plus the number of CPU cores available) * If you encounter any build errors, look for an existing bug report or report a new bug. * `( cd ../../../binaries/system && ./pyrogenesis_dbg )` === OS X === Follow this steps to install under OS X: * Install Apple's XCode for your system : see your Mac OsX install DVD or go to [http://connect.apple.com Apple's Developer Connection Site] This provides the necessary tools to compile programs * Install Macports : [http://www.macports.org/install.php MacPorts] This is the easiest way to install all the dependencies needed by 0ad. * `sudo port install gcc43` You need this gcc version because the one provided by Apple is gcc 4.0.1 which will fail in compiling 0ad. Note that gcc 4.1 will fail also (don't know about gcc 4.2). You'll also have to make symlinks in the /opt/local/bin/ directory to link the gcc command to gcc-mp-43 or OS X will use the default system gcc (so 4.0.1) : sudo ln -s /opt/local/bin/gcc-mp-43 gcc Make also symlinks for g++ and c++ * `sudo port install` the following packages : ** boost ** libsdl ** spidermonkey ** xercesc ** wxWidgets ** ffmpeg ** libxml2 * As mentionned in the help file : "You also need to install DevIL manually. It depends on some libraries downloaded through MacPorts above, so get those first. Next, obtain DevIL 1.6.8 RC2 from http://openil.sourceforge.net/download.php. Then extract the archive, and run ./configure, make, and sudo make install." - I downloaded 1.7.8 which is the latest version and it seems to work as well. * Install the [http://enet.bespin.org/ enet library] for networking. * Right, you're almost ready to compile 0ad : you need to patch Apple's OpenAL (/System/Library/Frameworks/OpenAL.Framework/alc.h : replace all ALCvoid by void (except first one which is a typedef) * Now get the last revision of the game : `svn co http://svn.wildfiregames.com/public/ps/trunk/` (or `http://svn.wildfiregames.com/svn/ps/trunk/` if you have commit access) * Recompile FCollada : `cd ''path-to-0ad''/libraries/fcollada/src && make` (where path-to-0ad is obviously the place you put the game folder) * then compile the game : ** `cd trunk/build/workspaces` ** `./update-workspaces.sh` (you'll have to repeat this step each time a source file is added or removed) ** `cd gcc` ** `make -j3` (where `3` is the number of parallel builds to run, and could perhaps be one plus the number of CPU cores available) ** If you encounter any build errors, look for an existing bug report or report a new bug. I still get a last error, but it seems harmless. * Finally, launch the game : ` cd ../../../binaries/system && ./pyrogenesis_dbg` === Known problems and solutions === * If you get linker errors like '''`multiple definition of '(anonymous namespace)::_1'`''', particularly when using GCC 4.1, try running `./update-workspaces.sh --without-pch` and then `cd gcc; make clean` and rebuild. * If you get '''Performance warning: your graphics card does not support compressed textures''' when starting the game, it is an issue with [http://dri.freedesktop.org/wiki/S3TC S3TC texture compression]. You might be able to solve it by installing the `libtxc_dxtn` library, in a distro-specific way. === Installing thread-safe !SpiderMonkey === On Linux: * `wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.60.tar.gz` * `tar -xzf js-1.60.tar.gz` * `cd js/src` * `JS_THREADSAFE=1 INCLUDES=-I/usr/include/nspr OTHER_LIBS=-L/usr/lib make -f Makefile.ref` * `make -f Makefile.ref export` * `cd ../../dist/Linux_All_DBG.OBJ` * `sudo cp lib/* /usr/lib` * `sudo mkdir /usr/include/js` * `sudo cp include/* /usr/include/js` * `sudo ldconfig` On '''OS X''', you can just install it from !MacPorts, it already has thread-safe patches. On '''Gentoo''', you could use the system library (with the `threadsafe` flag) instead: * `echo dev-lang/spidermonkey threadsafe >> /etc/portage/package.use` * `emerge -av spidermonkey`