Tremfusion.net

Building from source

From TremFusion

(Redirected from BuildingFromSource)

WARNING: This page is outdated. Please ask on the IRC channel for directions.

Building from source is a very good idea. Basically, you download it from the hg (Mercurial) repository, then do 'make' in the root directory. Easy, huh?

Contents

[edit] Building on Linux

Honestly, who wouldn't want to build on Linux? It makes life so much easier. Go ahead and open a console.

[edit] Getting the code

To copy the repo in Mercurial, do:

hg clone http://tremfusion.net/hg/tremfusion
cd tremfusion
hg update -C trem-compat

And that should get the latest trem-compat repository. If everything goes right you'll see output like this:

$ hg clone http://tremfusion.net/hg/tremfusion
requesting all changes
adding changesets
adding manifests
adding file changes
added 175 changesets with 1701 changes to 1135 files (+6 heads)
580 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd tremfusion
$ hg update -C trem-compat
over 9000 files updated, 134 files merged, 2 files removed, 0 files unresolved

After that, you should have a new directory in whatever directory you performed the command. The new directory will be named 'tremfusion'.

Whenever you want to update your repository run this command in the tremfusion directory:

hg pull -u

[edit] Dependencies

You'll need the following dev libraries

  • SDL
  • OpenAL
  • Ogg-Vorbis
  • Freetype
  • Ncurses

You can get them by doing the following on Ubuntu:

sudo apt-get install libsdl1.2-dev libopenal-dev libogg-dev libvorbis-dev libfreetype6-dev libncurses5-dev

at the console. Or substitute your favorite package manager. Or download SDL and OpenAL and build it yourself from source. Whatever.

[edit] Building

Go into the 'tremfusion' directory and run 'make'

$ make
make[1]: Entering directory `/home/eli/TheMerge/trunk'

Building Tremulous in build/release-linux-x86_64:
  PLATFORM: linux
  ARCH: x86_64
  COMPILE_PLATFORM: linux
  COMPILE_ARCH: x86_64
  CC: cc

...
<snip tons of output from make
...
Q3ASM build/release-linux-x86_64/base/vm/ui.qvm
make[2]: Leaving directory `/home/eli/TheMerge/trunk'
make[1]: Leaving directory `/home/eli/TheMerge/trunk'
$

Now you've got a new directory called 'build'. This will contain a directory based on your architecture. Mine says 'release-linux-x86_64' due to my totally awesome 64-bit OS. Go into that directory and you'll find several files.

  • base - contains the cgame, game and ui libraries that determine most of the game logic. The final qvms are found in base/vm
  • client - contains object files
  • ded - more object files
  • tools - contains tools for making qvms
  • tremded.x86[_64] - the dedicated server binary
  • tremulous.x86[_64] - the client binary

[edit] Setting up the game

If you run the client binary at this point, you'll see output like this:

tremfusion 0.0.0_HG166 linux-x86_64 Jun 30 2008
----- FS_Startup -----
Couldn't load default.cfg

What this indicates is that the game was trying to load default.cfg, which is the default configuration file. That couldn't be found because the game doesn't have access to it. How do you give the game access to it? You use a pk3.

To give the game acces to that files you have to copy 1.1.0 pk3 to your tremfusion folder, that's on your base folder(if the tremfusion folder is not there create it).

To do that you have to exec this

mkdir ~/.tremulous/tremfusion
cp /usr/share/games/tremulous/base/data-1.1.0.pk3 ~/.tremulous/tremfusion
cp /usr/share/games/tremulous/base/data-1.1.0.pk3 ~/.tremulous/tremfusion

Now you can run the game with

cd build/release-linux-x86[_64]/
./tremulous.x86_64

And you should see something that looks a lot like vanilla Tremulous 1.1.0. That'll change. Soon.

If you have problems, check out our IRC channel at freenode #tremfusion

[edit] Building on Windows

This may change soon, as we may get a proper MSVC project file done for TremFusion. Or there may be one done. We'll see.

For now, get an HG client. I would recommend TortoiseHG. Download and install that, or another HG client of your choice. Then, clone our repository. If you are using TortoiseHG (and I'll assume you do for the rest of this guide) right click somewhere in the windows explorer where you want to create the build area, select TortoiseHG and select Clone a Repository. Looks like this:

Image:clone_repo.png

You'll get a new dialog. You'll want settings that look like this, or at least pretty close, depending on whether or not you want it to create a 'main' directory (like I do here) for the build dir, or whether you just want to use the current directory.

Image:clone_repo_settings.png

After that it will process for a while and download everything. Should look kinda like this:

Image:clone_repo_downloaded.png

So, now you'll have all our source code either in the current directory, or in the 'main' directory, if you did it exactly like me. If you navigate to that directory you'll find a subdir called 'misc'. Under that is another directory called 'msvc'. In there is a Microsoft Visual Studio 2005 (MSVS) solution file. Open that with Microsoft Visual Studio by double-clicking on it, or by opening MSVS and using the Open menu/button.

Before you can build the solution, you'll need to make sure you have the proper dependencies in your build path. TremFusion requires the following libraries:

  • SDL.lib
  • SDLmain.lib
  • OpenGL32.lib

SDL and SDLmain come from the SDL site. OpenGL32.lib usually comes with MSVS. To add SDL.lib and SDLmain.lib you need to either install the pre-built binaries or build your own following the instructions on the SDL site, then add the directory where the files can be found to your library directories. Or add the libs to a directory already being used by MSVS. I prefer adding library directories, personally, so that's what we'll do here.

  • In MSVS go to the menu and click Tools->Options. You'll get a window like what you see below. Select Projects and Solutions->VC++ Directories. Then change 'Show directories for:' from Executables to 'Library files'. Add the directory where SDL.lib is.

Image:MSVS_add_include_dir.png

You'll also need the header files that go along with SDL. Those should have come with your SDL distro, or with the source code you built. Add the header directory much the same way as you added the library above, but change 'Show directories for"' from 'Library files' to 'Include files'. Duh.

  • Add the include file directory for SDL.h and SDLmain.h

You'll want to change the configuration from 'Debug' to 'Release' to make sure you get the best possible build. Now you can go ahead and build the solution file by right-clicking on 'tremfusion' and clicking 'build solution'. Viola. Thank STFU-Ender for making such an easy-to-use solution file.

Your new program should be located in misc\msvc\release or misc\msvc\debug, depending on how you built it (Debug or Release).

Before you can run it, you'll need to get the SDL.ll from our Releases page.

Also, if you want to download maps with libcurl (and you do, trust me, 100x speedup anyone?) you'll need libcurl-3.dll and zlib1.dll in the same directory as where you run the program. It's an issue we're looking in to...