PlaneShift Compiling Guide

Welcome to the PlaneShift Compiling Guide, please follow the instruction below carefully.

Table of Content

Source Revisions
Working Directory
Install Tools
Download Source Code
Compile the Code
Get the Server Running (optional)
Get the NPC Server Running
Mini Scripts (optional)
Get the Client Running
Common problems / Troubleshooting
Getting Help
Credits

Select your Configuration

IMPORTANT: Select from the dropdown below your OS, compiler, target (user or developer), and build type. This will change the instructions below.



Choose "User" if you want to compile the client to be compatible with the current public server.
Choose "Developer" if you want to develop on latest code, which is most likely not compatible with the public server. You will compile also a local server.

MinGW32 is a free, open source compiler with an associated toolset that can be used for compiling Win32 executables. In conjunction with other free or open source software the majority of PlaneShift can be compiled under Windows without having to purchase any compiler or other licenses.

This guide lists the steps necessary to download all the tools and compile PlaneShift. This guide was written using MS Visual Studio 2015 community edition. Most steps should be identical for MSVS 2010, 2012 and 2013. If you are planning to use an even older version of MSVS, it is recommended you obtain an older version of this guide from: the SVN Additionally, this guide can be used for both 32 and 64 bit compilations, but it should be noted that most projects default to 32, and for most normal users, 32 bit is strongly recommended as some projects don't have a 64 bit compile target. If you want to compile on 64 bit, be sure to compile all projects on 64 bit, and likewise obtain 64 bit versions of all other programs (like mysql). You cannot mix 32 and 64 bit.

This guide gives a fairly detailed description on how to get a working client up and running in Linux. It gives instructions on how to get all the required tools and how to check out the source code and configure it. At the end there you will have a PlaneShift client and a PlaneShift updater application, and if you want also the server.

This guide gives a fairly detailed description on how to get a working client up and running in FreeBSD. It gives instructions on how to get all the required tools and how to check out the source code and configure it. At the end there you will have a PlaneShift client and a PlaneShift updater application, and if you want also the server.

This guide gives a very basic description on how to get a working client up and running on a Mac. It gives instructions on how to get to check out the source code and configure it. At the end there you will have a PlaneShift client and a PlaneShift updater application, and if you want also the server.

Here is a basic Mac guide based on the linux guide, for more specifics refer to PSDocs, a user maintained guide.

There is no Mac static build guide at this time

Last Update

This guide has been updated by UPDATE_AUTHOR, the UPDATE_DATE.

Source Dates:

Make sure you get the correct dates required for the version of PS you are building.
Note that different versions of PS require different CS and PS revisions.
after those listed here may not be compatible with the public server.

Currently compatible with Laanx:
CAL3D SVN revision: CAL3D_SOURCE_REV
CS SVN revision: CS_SOURCE_REV
+ for windows only manually apply 39918 as patch to fix startup crashes

Currently compatible with Laanx:
CAL3D SVN revision: CAL3D_SOURCE_REV
CS SVN revision: CS_SOURCE_REV
+ for windows only manually apply 39918 as patch to fix startup crashes
Planeshift Stable revision: PS_Laanx

Currently compatible with trunk of PS:
CAL3D SVN revision: CAL3D_SOURCE_REV_HEAD
CS SVN revision: CS_SOURCE_REV_HEAD
+ for windows only manually apply 39918 as patch to fix startup crashes

Set Working Directory

The first step is to create your development directory. If you want to choose a specific directory, you can do that, however this guide will assume you use:

$HOME/development/

Many people get confused here because they copy and paste commands which contain this path. $HOME is a system environment variable that will always point to your users home directory.

$HOME/development/

Many people get confused here because they copy and paste commands which contain this path. $HOME is a system environment variable that will always point to your users home directory.

C:\development\

$HOME/development

$HOME is a system environment variable that will always point to your users home directory.
Note that in MinGW/MSYS paths are written as follows:

/c/development/

Install Tools

Microsoft Visual Studio

MSVS Community edition can be obtained from visualstudio.com It requires an account, but you can make a new one for free during installation. C++ is not a standard option in MSVS anymore, so be sure to select it during "custom" setup, or you'll need to add it later.

MinGW32 and MSYS

The MinGW package contains the compiler, header and lib files.
The MSYS package contains the shell and make utility.
The MSYSDTK package contains autoconf, automake, libtool, autogen, guile, SVN, openssl, openssh, inetutils, perl and vim.
Because autoconf and automake will be outdated, we will manually update them.
Also, With MinGW version 4.1.0.0, some of the BinUtils included are broken by default so we're fixing that.

First, we'll get MinGW and a few necessary dependencies.
Note: These are the minimum required packages for the MinGW build.
Go here: http://prdownloads.sourceforge.net/mingw/ and fetch:

MinGW [bin] MinGW-5.1.4.exe
MSYS [bin] MSYS-1.0.10.exe
MSYS DTK [bin] msysDTK-1.0.1.exe
GDB [bin] gdb-5.2.1-1.exe (Optional)
MSYS Autoconf [bin] msys-autoconf-2.59.tar.bz2
MSYS Automake [bin] msys-automake-1.8.2.tar.bz2
BinUtils [bin] binutils-2.17.50-20060824-1.tar.gz

Run the exe files in the order they were downloaded to install the compiler. Select 'Full' type for the MinGW installation.
The installation program should also add an icon for MSYS to your start menu.
Click the "MSYS" icon and it should open up a shell window. Type "exit" to close the shell window again.

Unzip the conf/make utilities in c:\msys\1.0\, then unzip the BinUtils to the c:\mingw directory as follows:
Unzipping the tar.bz2 archives needs to be done through the MSYS command-line by changing directory with the cd command to where you downloaded the files. Then, run the following commands:

tar -xjf msys-autoconf-2.59.tar.bz2 -C /c/msys/1.0
tar -xjf msys-automake-1.8.2.tar.bz2 -C /c/msys/1.0
tar -xzf binutils-2.17.50-20060824-1.tar.gz -C /c/MinGW

This allows MSYS to setup the MinGW paths correctly.
Download the following dependencies from the same site, but do not install these yet. Their install instructions are included below.
From explorer, create and place these dependencies into C:\msys\1.0\src. Also, create the C:\msys\1.0\local directory.

wget-1.9.1-mingwPORT.tar.bz2

The following dependencies use a scripted system to download and install them, built into their files.
For the unanswered questions below, just press enter to accept the default (in parentheses).
The following commands are to be run in the MSYS shell.

Installing wget

The input listed by the mingwPORT.sh script assumes that there is a file called wget-1.9.1.tar.gz in /usr/src, but the file you do have is wget-1.9.1-mingwPORT.tar.bz2.
There seems to be two solutions to this problem, you can choose the one your prefer the most:
1)Download the file from here and put it in /usr/src before running the mingwPORT.sh script
2)Just copy the prebuilt wget instead of compiling it instead of typing "mingwPORT.sh" (see the command list below) to run the script type "cp wget.exe /mingw/bin" and then continue as indicated.

$ cd /usr/src
$ tar -jxvf wget-1.9.1-mingwPORT.tar.bz2
$ cd wget-1.9.1/mingwPORT
$ ./mingwPORT.sh
Download file? (Yes) No
Unarchive file? (Yes)
Archive file type? (tar.gz)
Archive file? (wget-1.9.1.tar.gz)
Archive file path? (/tmp) /usr/src
Source path? (/usr/src/wget-1.9.1)
Installation directory? (/mingw)
CFLAGS (-O3 -s -mms-bitfields -march=i686)

Set Environment Variables

Right-Click My Computer on your desktop and choose Properties. Under Advanced choose Environmental Variables. Click New under either User (this user only) or System (set variable for all users of this computer) variables depending on how you want it setup. If you choose System, you will have to log off to make the changes.

Variable Name: CRYSTAL (all caps)
Variable Value: C:\development\cs

Before compiling each time in MinGW, you will also need to enter at the MSYS prompt:

export CRYSTAL=/c/development/cs

Client spellchecker

On linux only there is the possibility to enable a spellchecker, which will highlight the words he cannot find in the dictionary when you type in the chat. Please note this plugin will be compiled only if you have hunspell installed on your system. The build program checks for hunspell and if present it adds the spellchecker plugin to the build.

Autoconf and Libtool

To configure the solutions before compilation you will need Autoconf and Libtool. You can find those in your package manager.

gcc and g++

To compile the sources you will need gcc and g++. You can find those in your package manager.

Jam

You will need a tool called Jam. Jam is a replacement for make. It's a bit easier to maintain and create custom builds. If you do not already have Jam, you can find it at ftp://ftp.perforce.com/jam/ - install it system wide. You can also use your distro's package manager to install it.

cURL

To build the updater, you need the libcURL library. This is library that is used for HTTP protocol. It is what the updater application uses to update the client. It can be obtained at http://curl.haxx.se/. You can also use your distro's package manager to install it.

SVN

CS and PlaneShift use SVN for their source repositories, so you'll need that too.
You can find the software at: http://subversion.tigris.org/
A GUI is available at: http://esvn.umputun.com/ You can also use your distro's package manger to install it.

Jam

You will need a tool called Jam. Jam is a replacement for make. It's a bit easier to maintain and create custom builds. If you do not already have Jam, you can find it at ftp://ftp.perforce.com/jam/ - install it system wide. You can also use FreeBSD ports to install it.

# cd /usr/ports/devel/jam
# make install clean

SVN

CS and PlaneShift use SVN for their source repositories, so you'll need that too.
You can find the software at: http://subversion.tigris.org/
A GUI is available at: http://esvn.umputun.com/ You can also use FreeBSD ports to install it.

# cd /usr/ports/devel/subversion
# make install clean

cURL

If you want to download the updates from the server, this is required.
To build the updater, you will need to build cURL first, as MinGW does not have a compatible libcURL library available for download. This is the library that is used for the HTTP protocol. It is what the updater application uses to update the client. It can be obtained at http://curl.haxx.se/. Since you are building cURL, go ahead and get the latest version available. Do not get a binary. For this example, we will be using curl-7.15.5.tar.bz2. Place the file in /usr/src.
Make sure to read all the available support options available for cURL. The updater only uses a small subset of them, but feel free to install more if you have other uses for it.
      curl version: 7.15.5
      Host setup: i686-pc-mingw32
      Install prefix: /usr/local
      Compiler: gcc
      SSL support: no (--with-ssl / --with-gnutls)
      zlib support: enabled
      krb4 support: no (--with-krb4*)
      GSSAPI support: no (--with-gssapi)
      SPNEGO support: no (--with-spnego)
      c-ares support: no (--enable-ares)
      ipv6 support: no (--enable-ipv6)
      IDN support: no (--with-libidn)
      Build libcurl: Shared=yes, Static=yes
      Built-in manual: no (--enable-manual)
      Verbose errors: enabled (--disable-verbose)
      SSPI support: no (--enable-sspi)
      ca cert path: no

$ tar -jxvf curl-7.15.5.tar.bz2
$ cd curl-7.15.5
$ ./configure
$ make
$ make install

cURL

To build the updater (and thus pslaunch), you need the libcURL library. This is the library that is used for the HTTP protocol which the updater application uses to connect to a repository for updating the client.

Get curl from: curl.haxx.se, pick the Source Archive, not any package. (curl-7.48.0.zip)
Unzip it in your development folder, (in a folder called curl-7.48.0 or something similar) and find the "winbuild" folder.

From Visual Studio click in the menu on Tools -> Visual Studio Command Prompt.
If you cannot find the command prompt there, check this msdn article to find it.
Change the prompt to your winbuild folder using cd c:\development\curl-7.48.0\winbuild
Then type: nmake /f Makefile.vc mode=dll (add MACHINE=x64 as parameter to compile in 64bit instead of 32.)
Your output should be in a folder called "curl-7.48.0\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl" (exact name may vary). Copy the contents of that folder (the \lib \bin and \include folders) into a newly made folder in your development folder called: curl (c:\development\curl).

SVN client

PS, CS and CAL3d use SVN for their source repositories, so you will need an SVN client.
The SVN client for Windows is TortoiseSVN. Pick 32 or 64 bit depending on what CPU/OS you currently have, this is not depending on wether you are compiling planeshift on 32 or 64 bits.

Note: This section is incomplete and untested, but contains the Gentoo specific build information that was previously in the manual.

Due to the number of dependencies needed, if you wish to read the homepage listing, or dependency description please select Linux's generic dropdown selection.

via portage:
#emerge ftjam
#emerge subversion
#emerge curl

Note: This section is incomplete and untested, but contains the Slackware specific build information that was previously in the manual.

Due to the number of dependencies needed, if you wish to read the homepage listing, or dependency description please select Linux's generic dropdown selection.

BOTH of these above commands are assuming you do not need a server, if you do please follow directions in the mysql section for installing other required packages before moving on to building to save you time.

Note: This section is incomplete and untested.

Due to the number of dependencies needed, if you wish to read the homepage listing, or dependency description please select Linux's generic dropdown selection.

libtool may need to be installed via

yast install libtool

BOTH of these above commands are assuming you do not need a server, if you do please follow directions in the mysql section for installing other required packages before moving on to building to save you time.

Make sure the universe repository is enabled.
Fetch all the required packages using the following command:

# sudo apt-get --assume-yes install libjpeg-dev x11proto-gl-dev autoconf jam bison flex-old automake1.9 libcurl4-openssl-dev libmng-dev libmikmod2-dev libogg-dev libvorbis-dev zlib1g-dev libpng12-dev build-essential libtool libglu1-mesa-dev xserver-xorg-dev libxt-dev libopenal1 libopenal-dev subversion zlibc libfreetype6-dev libfreetype6 libasound2-dev alsa-oss libxxf86vm-dev libxext-dev x11proto-xext-dev libspeex-dev libxcursor-dev

In case you are using intrepid, we can fetch all the required packages using the following command:

# sudo apt-get --assume-yes install libjpeg-dev x11proto-gl-dev autoconf jam bison flex-old automake1.9 libcurl4-openssl-dev libmng-dev libmikmod2-dev libogg-dev libvorbis-dev zlib1g-dev libpng12-dev build-essential libtool libglu1-mesa-dev xserver-xorg-dev libxt-dev libopenal1 libopenal-dev subversion zlibc libfreetype6-dev libfreetype6 libasound2-dev alsa-oss libxxf86vm-dev libxext-dev x11proto-xext-dev libspeex-dev libxcursor-dev

ALL of these above commands are assuming you do not need a server if you do please follow directions in the mysql section for installing other required packages

Note: This section is incomplete and untested, but contains the Debian specific build information that was previously in the manual.

Due to the number of dependencies needed, if you wish to read the homepage listing, or dependency description please select Linux's generic dropdown selection.

via apt-get: #apt-get install libcurl3-dev

via apt-get: #apt-get install jam subversion build-essential libfreetype6-dev libasound2-dev

If you are using Debian testing (which uses X.Org), then you need xlibmesa-gl-dev instead of xlibmesa-glu-dev.

Debian: #apt-get install xlibmesa-glu-dev

Testing: #apt-get install xlibmesa-gl-dev

Also, if you have flex, bison or automake other than automake1.8 installed, they should be uninstalled. They would conflict with the older versions flex-old, bison1.35 and automake1.8 needed to compile PlaneShift.

#apt-get install libtool bison-1.35 flex-old autoconf automake1.8

#apt-get install libmng-dev libmikmod2-dev libogg-dev libvorbis-dev zlib1g-dev libpng12-dev libjpeg62-dev python2.6-dev libspeex-dev BOTH of these above commands are assuming you do not need a server if you do please follow directions in the mysql section for installing other required packages

nVidia Toolkit

Since Crystal Space needs it (independently from your graphic card, so even if you have an ATI card), you should download from www.nvidia.com the nvidia-toolkit. Download the appropriate version for your architecture—either x86 or x86-64. Make sure to use the appropriate file based on your chipset. To install the file, place it in the root directory and use the following commands, then delete the tar.gz file.

# wget -c http://developer.download.nvidia.com/cg/Cg_2.2/Cg-2.2_February2010_x86.tgz
# sudo mv Cg-2.2_February2010_x86*.tgz /
# cd /
# sudo tar -zxvf Cg-2.2_February2010_x86*.tgz
# sudo rm Cg-2.2_February2010_x86*.tgz

If you are a x86_64 system do the following

# wget -c http://developer.download.nvidia.com/cg/Cg_2.2/Cg-2.2_February2010_x86_64.tgz
# sudo mv Cg-2.2_February2010_x86*.tgz /
# cd /
# sudo tar -zxvf Cg-2.2_February2010_x86*.tgz
# sudo rm Cg-2.2_February2010_x86*.tgz

tar -zxvf Cg-2.2_February2010_x86*.tgz
tar -zxvf Cg-2.2_February2010_x86*.tgz
tar -zxvf Cg-2.2_February2010_x86*.tgz
If you are on Hardy or Intrepid you can (ubuntu version 8 or better)

# sudo apt-get install nvidia-cg-toolkit

Otherwise you MUST do this

# wget -c http://developer.download.nvidia.com/cg/Cg_2.2/Cg-2.2_February2010_x86.tgz
# sudo mv Cg-2.2_February2010_x86*.tgz /
# cd /
# sudo tar -zxvf Cg-2.2_February2010_x86*.tgz
# sudo rm Cg-2.2_February2010_x86*.tgz

If you are a x86_64 system do the following if the apt-get line above did not work

# wget -c http://developer.download.nvidia.com/cg/Cg_2.2/Cg-2.2_February2010_x86_64.tgz
# sudo mv Cg-2.2_February2010_x86*.tgz /
# cd /
# sudo tar -zxvf Cg-2.2_February2010_x86*.tgz
# sudo rm Cg-2.2_February2010_x86*.tgz

Via portage: # emerge nvidia-cg-toolkit

To build on OSX you need to Install Xcode which you can get from here. This guide also recomends you to install fink. You can get fink from here. If you wish to make universal builds, you need to install darwinports instead. Note: Do not use darwinports if you are using fink. It can cause conflicts if they both have the same package installed.
Open a terminal window and set the required environment variables for fink by issuing the following command:
# /sw/bin/pathsetup.sh
# source /sw/bin/init.sh


Configure fink (Optional) We are going to configure fink to download and install packages from source only. (no binary packages)
This step is optional, but has a better success rate for installing the fink dependencies.
# fink configure

Provided below are the questions and the standard recommended answers for the configuration:
Password:
OK, I'll ask you some questions and update the configuration file in '/sw/etc/fink.conf'.
In what additional directory should Fink look for downloaded tarballs? []
Which directory should Fink use to build packages? (If you don't know what this means, it is safe to leave it
at its default.) []

Should Fink try to download pre-compiled packages from the binary distribution if available? [y/N] n
(1)     Quiet (do not show download statistics)
(2)     Low (do not show tarballs being expanded)
(3)     Medium (will show almost everything)
(4)     High (will show everything)

How verbose should Fink be? [4] 4

Proxy/Firewall settings
Enter the URL of the HTTP proxy to use, or 'none' for no proxy. The URL should start with http:// and may
contain username, password, and/or port specifications. Note that this value will be visible to all users on
your computer.
Example, http://username:password@hostname:port
Your proxy:  [none]
Enter the URL of the FTP proxy to use, or 'none' for no proxy. The URL should start with http:// and may
contain username, password, and/or port specifications. Note that this value will be visible to all users on
your computer.
Example, http://username:password@hostname:port
Your proxy:  [none]
Use passive mode FTP transfers (to get through a firewall)? [Y/n] y

Mirror selection
All mirrors are set. Do you want to change them? [y/N] n

Writing updated configuration to '/sw/etc/fink.conf'...

You need to install Ftjam which you can get from here. You also need to install the following packages from Fink
fink -y -v install libjpeg freetype freetype-shlibs freetype2 freetype2-dev freetype2-shlibs libogg libvorbis0 libvorbis0-shlibs libmng2 libpng3 autoconf2.5 automake1.9 libtool wget curl


Download SVN with SSL support from Fink with the following command:

fink -y -v install svn-client

Setup Environment Variable for SVN
Because SVN will be installed into a directory that isn't in the PATH by default, there are two options. Please decide which you prefer using.
Option #1 - Storing the path permanently
This option allows you to store the path once, and follow this guide "as-is".
Create or modify your profile. Your profile stores commands that will be invoked every time you open a new terminal session.
The single-user instructions allow you to modify only your terminal session. The multi-user instructions modify the terminal session of everyone when they open a terminal.

Bash Users Only - Please use either Single or Multiple User Instructions. This is the default shell for MacOSX.
You can use other shells, but the instructions here are only for bash.

Single User Instructions: # nano ~/.profile

Multiple User Instructions: # nano /etc/profile

Paste the following lines into the file (for either Single or Multiple User Instructions).
Note: To exit nano, press Ctrl-X, then y to save the file, then enter to save to same location. # the path is initially set to "/bin:/sbin:/usr/bin:/usr/sbin"

export PATH=$PATH:/sw/bin/

For additional information please read the recommended bash tutorial.
Option #2 - Using a path to run the svn command
If you prefer NOT to store environment variables permanently, you can run the svn command as follows: # /sw/bin/svn co ...
Simply add /sw/bin/ to the start of every svn command in this guide to find and run the command.

You also need to install Nvidia's Cg Toolkit from here.

You will also need to install and build speex. The current version of speex in fink will not work for our needs so we need to build it ourselves.
You need to download the latest source code from http://www.speex.org/downloads/ It should be atleast version 1.2beta3
Once you have downloaded the tar unzip it into a folder. In terminal cd into the folder you just unzipped it into.
As it says in the install.txt file you will need to

./configure

After you have configured if you see the following message you can ignore it safely

You don't seem to have the development package for libogg (libogg-devel) installed. Only the Speex library (libspeex) will be built (no encoder/decoder executable)
You can download libogg from http://downloads.xiph.org/releases/ogg/
Type "make; make install" to compile and install Speex

Next you will need to

make

then

sudo make install

Server Databases

Required only if you want to compile also the PlaneShift Server

MySQL:
If you have the intentions to run the server you have to install MySQL as well. PlaneShift uses MySQL version 5.5.

For your distro install the mysql package and the -dev package, It might be named mysql-dev or libmysqlclient-dev or something similar.

If after building if you see that mysql was not found when running the server and you get the following error:

WARNING: could not load plugin 'planeshift.database.mysql'

make sure you have the dev package installed, if it was not installed, ./autogen.sh, ./configure, and recompile the server again, according to the documentation below.

for Hardy (ubuntu version 8 or better) via apt-get: # sudo apt-get --assume-yes install libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl mysql-client-5.5 mysql-server-5.5 libmysqlclient-dev

If after building if you see that mysql was not found when running the server and you get the following error:

WARNING: could not load plugin 'planeshift.database.mysql'

make sure you have libmysqlclient-dev installed, if it was not installed, ./autogen.sh, ./configure, and recompile the server again, according to the documentation below.

via portage: #emerge mysql

You need to make sure you have libmysqlclient-dev and mysql-server installed for your server to run correctly

If after building if you see that mysql was not found when running the server and you get the following error:

WARNING: could not load plugin 'planeshift.database.mysql'

make sure you have libmysqlclient-dev installed, if it was not installed, ./autogen.sh, ./configure, and recompile the server again, according to the documentation below.

install from ports:
# cd /usr/ports/databases/mysql50-server
# make install clean
# cd /usr/ports/databases/mysql50-client
# make install clean

Note: This section is incomplete and untested, but contains the FreeBSD specific build information.

We need to install mysql. In order to do this we need to use fink.

fink -y -v install mysql mysql-client mysql15-dev mysql15-shlibs

If after building if you see that mysql was not found when running the server and you get the following error:

WARNING: could not load plugin 'planeshift.database.mysql'

make sure you have mysql15-dev installed, if it was not installed, ./autogen.sh, ./configure, and recompile the server again, according to the documentation below.

From the download page, select the Community Server option. You will end up in another page where you should select one of the available Windows downloads between Windows (x86) ZIP/Setup.EXE and the Without Installer version. Notice that if you are trying to compile on 64 bit, you will need the 64 zip/installer. It is recommend to select the "Without Installer version", since you only have to unzip the file in c:\ and rename the folder (which should resemble mysql-5.5.xx) to simply mysql. At the end of these steps, you should have: c:\mysql\

Also, we need to create MinGW compatible libraries from the standard Microsoft compatible libraries that ship with MySQL. Read the FAQ for mingw32 under the section "How can an MSVC program call a MinGW DLL, and vice versa?" You will find reimp here: http://wyw.dcweb.cn/reimp_new.zip
You will have to compile it as an exe is not provided anymore, create and extract the contents of the zip into C:\msys\1.0\src\reimp, open an msys prompt then do the following:

cd /usr/src/reimp/src
make
cp reimp.exe /c/mingw/bin
cd /c/mysql/lib/debug
reimp -d libmysql.lib
dlltool -k -d LIBMYSQL.def -l libmysqlclient.a
rm LIBMYSQL.def
mv libmysqlclient.a ..

Download Source Code

Cal3D

We need to build cal3d from source before we can start on Crystal Space. Cal3d is a library that is used for handling skeleton systems. This is a very nice system and can allow for fluid transformations between animations. This needs to be built/installed first because when we configure Crystal Space it has to find the cal3d libraries so it can know to build the sprcal3d plugin.

Cal3D Home

$HOME/development$ svn co -r CAL3D_SOURCE_REV svn://svn.gna.org/svn/cal3d/trunk/cal3d cal3d

Crystal Space (CS)

Crystal Space 3D SDK is the engine that we use for rendering and sound.

$HOME/development$ svn co -r CS_SOURCE_REV http://svn.code.sf.net/p/crystal/code/CS/trunk cs

$HOME/development$ svn co -r CS_SOURCE_REV_HEAD http://svn.code.sf.net/p/crystal/code/CS/trunk cs

PlaneShift

Lastly, download our source:

$HOME/development$ svn co https://svn.code.sf.net/p/planeshift/code/trunk planeshift

$HOME/development$ svn co -r PS_Laanx https://svn.code.sf.net/p/planeshift/code/trunk planeshift

$HOME/development$ svn co https://svn.code.sf.net/p/planeshift/code/trunk planeshift

Updating Sources

From time to time, newer PlaneShift revisions will require you to upgrade your cal3d and CS repositories to a newer revision as well. To update your supporting libraries, always be certain that you use the "-r" option keep from updating to the latest revision:

If you want to update to a new revision replace REVISION with the number of the revision you want to use:

$HOME/development/cal3d$ svn update -r REVISION
$HOME/development/cs$ svn update -r REVISION

Unlike the supporting libraries, you will generally want to use the latest PlaneShift source (or the HEAD) rather than an intermediate revision. In this case, you will omit the "-r" option like so: $HOME/development/planeshift$ svn update


If, for some reason, you wish to update any of the supporting libraries to the latest version (i.e. the HEAD), you have to remove the sticky date tag. WE DO NOT RECOMMEND THIS as it may break your build:

$HOME/development/cal3d$ svn update -r HEAD
$HOME/development/cs$ svn update -r HEAD

If you update a repository, you will need to recompile that repository and each repository that depends on it. Before doing so, you should do a "jam clean" for each project you want to jam again. So, for example, if you want to rebuild PS you will do:

$HOME/development/planeshift$ jam clean
$HOME/development/planeshift$ jam -aq

Do NOT install Cal3D, CrystalSpace and PlaneShift from FreeBSD ports

Cal3D

We need to build cal3d from source before we can start on Crystal Space. Cal3d is a library that is used for handling skeleton systems. This is a very nice system and can allow for fluid transformations between animations. This needs to be built/installed first because when we configure Crystal Space it has to find the cal3d libraries so it can know to build the sprcal3d plugin. Cal3D doesn't change much, so just download latest stable or checkout latest from svn:

Cal3D Home

$HOME/development$ svn co -r CAL3D_SOURCE_REV svn://svn.gna.org/svn/cal3d/trunk/cal3d cal3d

In case of a slow download use the following command:

$HOME/development$ svn co -r CAL3D_SOURCE_REV http://svn.gna.org/svn/cal3d/trunk/cal3d cal3d

Crystal Space (CS)

Crystal Space 3D SDK is the engine that we use for rendering and sound.

$HOME/development$ svn co -r CS_SOURCE_REV http://svn.code.sf.net/p/crystal/code/CS/trunk

$HOME/development$ svn co -r CS_SOURCE_REV_HEAD http://svn.code.sf.net/p/crystal/code/CS/trunk

PlaneShift

Lastly, download our source:

$HOME/development$ svn co https://svn.code.sf.net/p/planeshift/code/trunk planeshift

$HOME/development$ svn co -r PS_Laanx https://svn.code.sf.net/p/planeshift/code/trunk planeshift

$HOME/development$ svn co https://svn.code.sf.net/p/planeshift/code/trunk planeshift

Updating Sources

From time to time, newer PlaneShift revisions will require you to upgrade your cal3d and CS repositories to a newer revision as well. To update your supporting libraries, always be certain that you use the "-r" option keep from updating to the latest revision:

If you want to update to a new revision replace REVISION with the number of the revision you want to use:

$HOME/development/cal3d$ svn update -r REVISION
$HOME/development/cs$ svn update -r REVISION

Unlike the supporting libraries, you will generally want to use the latest PlaneShift source (or the HEAD) rather than an intermediate revision. In this case, you will omit the "-r" option like so: $HOME/development/planeshift$ svn update


If, for some reason, you wish to update any of the supporting libraries to the latest version (i.e. the HEAD), you have to remove the sticky date tag. WE DO NOT RECOMMEND THIS as it may break your build:

$HOME/development/cal3d$ svn update -r HEAD
$HOME/development/cs$ svn update -r HEAD

If you update a repository, you will need to recompile that repository and each repository that depends on it. Before doing so, you should do a "jam clean" for each project you want to jam again. So, for example, if you want to rebuild PS you will do:

$HOME/development/planeshift$ jam clean
$HOME/development/planeshift$ jam -aq

Crystal Space (CS)

Crystal Space is the 3D Software Development Kit (SDK) that is used in PlaneShift mainly for rendering and sound.

Create a subdirectory in development called CS. Right-click on the CS directory and select "SVN Checkout". Specify the URL as:

http://svn.code.sf.net/p/crystal/code/CS/trunk

Verify the checkout directory is "C:\development\CS", select "Revision", and paste the current CS revision number: CS_SOURCE_REV

Next, to apply patch 39918: Find cs\include\csutil\csuctransform.h and open it in visual studio, go to line #497 and replace the text if ((srcSize == 0) || (source == 0)) \ with if (source == 0) \

Then open: cs\includes\cstype.h and comment out line #191 (change typedef wchar_t wint_t; into //typedef wchar_t wint_t;)

To show line numbers in Visual Studio, click on tools -> options in the menu, and then go to "text editor" -> "all languages" and check "line numbers", leave the menu by clicking "ok".

CS Windows Libraries

Rather than having to install CS dependant components manually, Microsoft Visual C++, MinGW/MSYS and Cygwin users can download a single package which contains all common headers, pre-built library files, and dynamic link libraries in pre-compiled form from the Crystal Space website, http://www.crystalspace3d.org/.

The latest version of such libraries is available at: The currently used CS revision needs version LIBS_VER_STAB. Don't mix up with other versions!

Run the program and install the libraries. The Default name is fine.

Run the program and install the libraries in C:\CSLibs.

When it asks you for the CS directory, enter C:\development\CS.
Be sure that you are selecting also the MinGW Win32 Libraries and the support files for MSYS and Cygwin.
Be sure that you are selecting also the MSVC Win32 Libraries and the support files for version 2010 of MSVC. (You won't need MSYS or Cygwin files)
When you are promted check the 'Copy DLL's to CS directory' box.
To copy the files later, you can do so via the option in the folder from the start menu.
Make sure 'Set up MSYS support' is checked when prompted.
Make sure 'Set up VisualC support' is checked when prompted.

Notice: The CS libs were compiled for MSVC 2010, so not all of them will work on 2013/2015, this is not a problem since the ones we really need DO work.

You should now copy your CS Win Libs DLLs over to your new CS directory, if you haven't done that earlier, during the installation of the CS Winlibs. Goto the start menu, go to Programs and then to CrystalSpace Win32 libraries. Select "Copy DLLs to a CS directory". Set the directory to C:\development\CS when prompted. Next, copy CrystalSpaceLibs MinGW directory into a new generic directory.

CAL3d

Cal3d is a library that is used for handling skeleton systems.

Create a subdirectory in development called "cal3d". Right-click on the cal3d directory and select "SVN Checkout". Specify the URL as:

svn://svn.gna.org/svn/cal3d/trunk/cal3d

Verify the checkout directory is "C:\development\cal3d", select "Revision", and enter 507.

Open (in the cal3d directory) cal3d.sln in Visual Studio and if asked to convert/updgrade, do so.
If the Solution Explorer does not show on the left side of your screen, select from the menu: View -> Solution Explorer.
Set build config to release (in the menu at the top) and right-click on the CAL3D project in the Solution Explorer, then click on "build" to build the Cal3D project.
Notice that if you are building 64 bit, you will also need to make a new "solution platform" (x64, you can copy the rest from the 32 version).
After building, rename cal3d\bin\Release\Cal3D.dll to "libcal3d-csvc10.dll" and copy it to the CS directory (overwriting the file there).
If you are making a debug build, you will need to do the same for the following file. Additionally, in case of debug/static builds, the exact file name differs.
cal3d\bin\debug\Cal3D.pdb, rename it to "libcal3d-csvc10.pdb" and copy it to the CS directory as well (debug build only).

PlaneShift

Lastly, download PlaneShift source code:

Create a subdirectory in development called planeshift. Right-click on the planeshift directory and select "SVN Checkout".
Verify the checkout directory is "C:\development\PlaneShift".
Enter the following as the URL:

https://svn.code.sf.net/p/planeshift/code/trunk

Updating Sources

If in the future you have the intentions to updatePS because the team has decided to use another revision or because you feel like you want to update it, instead of doing a checkout you have simply to update. Please, remember that CS must be the exact revision specified above, while PS can be newer.

PlaneShift
Right-click on the PlaneShift folder and click "SVN Update".

Cal3D

We need to build cal3d from source before we can start on Crystal Space. Cal3d is a library that is used for handling skeleton systems. This is a very nice system and can allow for fluid transformations between animations. This needs to be built/installed first because when we configure Crystal Space it has to find the cal3d libraries so it can know to build the sprcal3d plugin. Cal3D doesn't change much, so just download latest stable or checkout latest from svn:

Cal3D Home

$HOME/development$ svn co -r CAL3D_SOURCE_REV svn://svn.gna.org/svn/cal3d/trunk/cal3d cal3d

In case of a slow download use the following command:

$HOME/development$ svn co -r CAL3D_SOURCE_REV http://svn.gna.org/svn/cal3d/trunk/cal3d cal3d

Crystal Space (CS)

Crystal Space 3D SDK is the engine that we use for rendering and sound.

$HOME/development$ svn co -r CS_SOURCE_REV http://svn.code.sf.net/p/crystal/code/CS/trunk

$HOME/development$ svn co -r CS_SOURCE_REV_HEAD http://svn.code.sf.net/p/crystal/code/CS/trunk

PlaneShift

Lastly, download our source:

$HOME/development$ svn co https://svn.code.sf.net/p/planeshift/code/trunk planeshift

$HOME/development$ svn co -r PS_Laanx https://svn.code.sf.net/p/planeshift/code/trunk planeshift

$HOME/development$ svn co https://svn.code.sf.net/p/planeshift/code/trunk planeshift

Updating Sources

From time to time, newer PlaneShift revisions will require you to upgrade your cal3d and CS repositories to a newer revision as well. To update your supporting libraries, always be certain that you use the "-r" option keep from updating to the latest revision:

If you want to update to a new revision replace REVISION with the number of the revision you want to use:

$HOME/development/cal3d$ svn update -r REVISION
$HOME/development/cs$ svn update -r REVISION

Unlike the supporting libraries, you will generally want to use the latest PlaneShift source (or the HEAD) rather than an intermediate revision. In this case, you will omit the "-r" option like so: $HOME/development/planeshift$ svn update


If, for some reason, you wish to update any of the supporting libraries to the latest version (i.e. the HEAD), you have to remove the sticky date tag. WE DO NOT RECOMMEND THIS as it may break your build:

$HOME/development/cal3d$ svn update -r HEAD
$HOME/development/cs$ svn update -r HEAD

If you update a repository, you will need to recompile that repository and each repository that depends on it. Before doing so, you should do a "jam clean" for each project you want to jam again. So, for example, if you want to rebuild PS you will do:

$HOME/development/planeshift$ jam clean
$HOME/development/planeshift$ jam -aq

Compile the Code

Please note that PlaneShift uses Breakpad as crash reporting tool. If you don't want to compile with breakpad, please do the following:

1) Edit src/client/crashreport.cpp and remove this line:

Force breakpad usage
#define USE_BREAKPAD

If you have a dual core or better processor then you can take advantage of parallel make or jam by adding -j3 after the command. You can replace 3 with the number of jobs you want to run in parallel.

Cal3D

Since cal3d is a library in development we probably don't want to 'install' this one as root since there is a good possibility it will change in the future. Instead we will 'install' it into our working directory. This is done by using the --prefix option when we configure it.

Using a text editor open configure.in and remove the line

AM_USE_UNITTESTCPP

Then you can build cal3d

$HOME/development/cal3d$ autoreconf --install --force
$HOME/development/cal3d$ ./configure --prefix=$HOME/development/cal3d
$HOME/development/cal3d$ make
$HOME/development/cal3d$ make install

Because we did not install cal3d we need to make sure other things can find it. This is done using the LD_LIBRARY_PATH:
Using a text editor open $HOME/.cshrc and add the line:

setenv LD_LIBRARY_PATH /home/development/cal3d/lib/:/home/development/cs/ (need user relog)

If you have a dual core or better processor then you can take advantage of parallel make or jam by adding -j3 after the command. You can replace 3 with the number of jobs you want to run in parallel.

Cal3D

Since cal3d is a library in development we probably don't want to 'install' this one as root since there is a good possibility it will change in the future. Instead we will 'install' it into our working directory. This is done by using the --prefix option when we configure it.

Using a text editor open configure.in and remove the line

AM_USE_UNITTESTCPP

Or you can use the following sed command

sed -i 's/AM_USE_UNITTESTCPP/#\ AM_USE_UNITTESTCPP/' configure.in

Then you can build cal3d

$HOME/development/cal3d$ autoreconf --install --force
$HOME/development/cal3d$ ./configure --prefix=$HOME/development/cal3d
$HOME/development/cal3d$ make
$HOME/development/cal3d$ make install

Because we did not install cal3d we need to make sure other things can find it. This is done using the LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=$HOME/development/cal3d/src/cal3d/.libs/:$LD_LIBRARY_PATH

Crystal Space (CS)

Now we can build it and use the configure line to tell it where we installed the cal3d libraries. To do this, use the prefix line that was used for Cal3d above.

Crystal Space (CS)

Now we can build it and use the configure line to tell it where we installed the cal3d libraries. To do this, use the prefix line that was used for Cal3d above.

$HOME/development/cs$ ./configure --without-java --without-perl --without-python --without-3ds --with-cal3d=$HOME/development/cal3d

$HOME/development/cs$ ./configure --enable-debug --without-java --without-perl --without-python --without-3ds --with-cal3d=$HOME/development/cal3d

$HOME/development/cs$ jam -aq libs plugins cs-config walktest

$HOME/development/cs$ jam -aq libs staticplugins cs-config walktest_static
$HOME/development/cs$ ./configure --without-java --without-perl --without-python --without-3ds --with-cal3d=$HOME/development/cal3d

$HOME/development/cs$ ./configure --enable-debug --without-java --without-perl --without-python --without-3ds --with-cal3d=$HOME/development/cal3d

$HOME/development/cs$ jam -aq libs plugins cs-config walktest

$HOME/development/cs$ jam -aq libs staticplugins cs-config walktest_static

We should export the CRYSTAL environment variable so applications outside the Crystal Space tree know where to find the .so's.
Using a text editor open $HOME/.cshrc and add the line:

setenv CRYSTAL /home/development/cs/ (need user relog)

PlaneShift

You can now start to compile PlaneShift
$HOME/development/planeshift$ ./autogen.sh
$HOME/development/planeshift$ ./configure --with-cal3d=$HOME/development/cal3d
$HOME/development/planeshift$ ./configure --enable-debug --with-cal3d=$HOME/development/cal3d
$HOME/development/planeshift$ jam -aq client
$HOME/development/planeshift$ jam -aq client_static
If you also want to build the server, do this as well:

$HOME/development/planeshift$ jam -aq server

$HOME/development/planeshift$ jam -aq staticplugins server_static

If you want to build the extra tools, just do "jam -a".

If your psclient has no skin you are used to seeing launch pssetup after you have copied your art over and select a new skin

If you wish for your psclient to not use the same user files as your other build/install you may run ps with the following command

$HOME/development/planeshift$ ./psclient -cfgset=PlaneShift.UserConfigPath=$HOME/.PlaneShift2

You can also edit this in the psclient.cfg file under the game section uncomment the appropriate line and edit the path.

We should export the CRYSTAL environment variable so applications outside the Crystal Space tree know where to find the .so's.

export CRYSTAL=$HOME/development/cs

PlaneShift


$HOME/development/planeshift$ ./autogen.sh
$HOME/development/planeshift$ ./configure --with-cal3d=$HOME/development/cal3d
$HOME/development/planeshift$ ./configure --enable-debug --with-cal3d=$HOME/development/cal3d
$HOME/development/planeshift$ jam -aq client
$HOME/development/planeshift$ jam -aq client_static
If you also want to build the server, do this as well:

$HOME/development/planeshift$ jam -aq server

$HOME/development/planeshift$ jam -aq staticplugins server_static

If you want to build the extra tools, just do "jam -a".

Before launching any PS app you need to tell PS where to find CS as we did not install it globally

export LD_LIBRARY_PATH="$HOME/development/cal3d/src/cal3d/.libs/:$HOME/development/cs/:"$LD_LIBRARY_PATH

If your psclient has no skin you are used to seeing launch pssetup after you have copied your art over and select a new skin

If you wish for your psclient to not use the same user files as your other build/install you may run ps with the following command

$HOME/development/planeshift$ ./psclient -cfgset=PlaneShift.UserConfigPath=$HOME/.PlaneShift2

You can also edit this in the psclient.cfg file under the game section uncomment the appropriate line and edit the path.

If you have a dual core or better processor then you can take advantage of parallel make or jam by adding -j3 after the command. You can replace 3 with the number of jobs you want to run in parallel.

Cal3D

Since cal3d is a library in development we probably don't want to 'install' this one as root since there is a good possibility it will change in the future. Instead we will 'install' it into our working directory. This is done by using the --prefix option when we configure it.

Using a text editor open configure.in and remove the line

AM_USE_UNITTESTCPP

Or you can use the following sed command

mv configure.in configure-old.in
sed 's/AM_USE_UNITTESTCPP/# AM_USE_UNITTESTCPP/' configure-old.in > configure.in

Then you can build cal3d

$HOME/development/cal3d$ autoreconf --install --force
$HOME/development/cal3d$ ./configure --prefix=$HOME/development/cal3d
$HOME/development/cal3d$ make
$HOME/development/cal3d$ make install

Crystal Space (CS)

Now we can build it and use the configure line to tell it where we installed the cal3d libraries. To do this, use the prefix line that was used for Cal3d above.

$HOME/development/cs$./configure --disable-universal-binary --without-java --without-perl --without-python --without-3ds --with-cal3d=$HOME/development/cal3d
$HOME/development/cs$./configure --disable-universal-binary --enable-debug --without-java --without-perl --without-python --without-3ds --with-cal3d=$HOME/development/cal3d

$HOME/development/cs$ jam -aq libs plugins cs-config walktest

there is no Mac static build guide at this time
We should export the CRYSTAL environment variable so applications outside the Crystal Space tree know where to find the .so's.

export CRYSTAL=$HOME/development/cs

PlaneShift

$HOME/development/planeshift$ ./autogen.sh
$HOME/development/planeshift$ ./configure --disable-universal-binary --with-cal3d=$HOME/development/cal3d
$HOME/development/planeshift$ ./configure --disable-universal-binary --enable-debug --with-cal3d=$HOME/development/cal3d
$HOME/development/planeshift$ jam -aq client there is no Mac static build guide at this time

If you also want to build the server, do this as well:

$HOME/development/planeshift$ jam -aq server

If you want to build the extra tools, just do "jam -a".

If your psclient has no skin you are used to seeing launch pssetup after you have copied your art over and select a new skin

If you wish for your psclient to not use the same user files as your other build/install you may run ps with the following command

$HOME/development/planeshift$ ./psclient.app/Contents/MacOS/psclient -cfgset=PlaneShift.UserConfigPath=$HOME/Library/Application Support/PlaneShift2

You can also edit this in the psclient.cfg file under the game section uncomment the appropriate line and edit the path.

Run MSYS from the start menu to open the shell. Be aware that if you have MSYS opened already, you need to restart the console, otherwise many things won't be found during the build process. Make sure you run the export commands to set the environment variables again

Crystal Space (CS)

Switch to the Crystal Space source dir using 'cd /c/development/cs'. Configure to debug mode and jam. (if you wish to build in optimized mode, just run configure without --enable-debug). On Mac OS X, there is an issue with ptmalloc crashing on exit so append the flag --disable-ptmalloc

./configure --without-java --without-perl --without-python --without-3ds --enable-shared=no
./configure --enable-debug --without-java --without-perl --without-python --without-3ds --enable-shared=no
jam -aq libs plugins cs-config walktest
jam -aq libs staticplugins cs-config walktest_static
This will build all the needed libraries and plugins, as well as the standard test application.
After everything compiles, try running "walktest.exe" in /c/development/cs to check that everything is ok.

PlaneShift

Change your working directory to PS's, and do:

./autogen.sh
./configure
./configure --enable-debug
If you're building the server instead do the following as you also need to configure with your MySQL location:

./autogen.sh
./configure --with-mysqlclient=/c/mysql

./autogen.sh
./configure --enable-debug --with-mysqlclient=/c/mysql

jam -aq client
jam -aq client_static
If your building a server also do the following to compile it:

jam -aq server

jam -aq staticplugins server_static

If you want to build the extra tools, just do "jam -a".

This should compile PlaneShift.

If your psclient has no skin you are used to seeing launch pssetup after you have copied your art over and select a new skin

If you wish for your psclient to not use the same user files as your other build/install you may run ps with the following command

psclient.exe -cfgset=PlaneShift.UserConfigPath=C:\development\pssettings

You can also edit this in the psclient.cfg file under the game section uncomment the appropriate line and edit the path.

Crystal Space (CS)

Make sure that the 'msvc10' folder has the 'read only' box unchecked (right click on the folder and select Properties, 'read only' is one of the attributes in the General tab) before continuing.

Open C:\development\CS\mk\msvc10\wkstypical.sln
Open C:\development\CS\mk\msvc10\wksstatic.sln
For any version other than 2010, Visual Studio will ask you to upgrade the project, do so.

Go into the 'Build' menu, and select 'configuration manager'. Change the 'Active Solution Configuration' to : 'Release(with DLLs)'
ReleaseWithStaticLibs
Go into the 'Build' menu, and select 'configuration manager'. Change the 'Active Solution Configuration' to: 'Debug(with DLLs)'
DebugWithStaticLibs

If the Solution Explorer does not show on the left side of your screen, select from the menu: View -> Solution Explorer.
Right click on the solution and select 'Build Solution'. To test the build of CS, run walktest.exe in C:\development\CS.
In any Visual Studio version other than 2010, 5 of the 238 projects will fail due to dlls not being made for your version of Visual Studio. This can be ignored, since we do not need those 5 for planeshift.
If you encounter any errors, check you have done everything correctly, and then if the problem persists, you can ask for help in the CS IRC channel:
irc.freenode.net #crystalspace

PlaneShift

Copy the following 3 files (crystalspace-2.1-vc10.dll libcal3d-csvc10.dll and libz-cs.dll) from your CS directory to your planeshift directory.
Note that the exact name of the first two dlls may vary, depending on you building static, debug or normal. This guide assumes you are making a normal user version.
Then copy libcurl.dll from your curl\bin directory into your planeshift directory.
If you are compiling the server as well, you will need to copy libmysql.dll from c:\mysql\lib to your planeshift folder as well.

Open c:\development\PlaneShift\mk\msvc10\wkspstypical.sln
Open c:\development\PlaneShift\mk\msvc10\wkspsstatic.sln
For any version other than 2010, Visual Studio will ask you to upgrade the project, do so.
Go into the 'Build' menu, and select 'configuration manager'. Change the 'Active Solution Configuration' to 'Release(with DLLs)'.
Go into the 'Build' menu, and select 'configuration manager'. Change the 'Active Solution Configuration' to 'Debug(with DLLs)'.

If the Solution Explorer does not show on the left side of your screen, select from the menu: View -> Solution Explorer.
We will need to edit a few of the projects before they can compile. To open a properties menu of a specific project, right click on the project name and select properties. To change a property (like include directories, or additional dependencies, click on the property, and at the far right of it, a small arrow will appear, click on that and select "edit". These instructions are implied throughout this section.

plgsoundmngr:
Needs libpsmusic.lib and libpsutil.lib added in properties -> linker -> input -> additional dependencies
Needs c:\development\planeshift\out\release10\libs added in properties -> vcc++ directories -> library directories

apppsclient:
Needs c:\development\planeshift\out\release10\libs and c:\development\cs\out\release10\libs added in properties -> vcc++ directories -> library directories.

apppslaunch:
Needs c:\development\curl\include added in properties -> vcc++ directories -> include directories
Needs c:\development\curl\lib added in properties -> vcc++ directories -> library directories

plgdbmysql:
You can skip this one if you only want the client.
Needs libpsutil.lib added in properties -> linker -> input -> additional dependencies: Needs C:\mysql\include added in properties -> vcc directories -> include directories
Needs C:\mysql\lib and c:\development\planeshift\out\release10\libs added in properties -> vcc directories -> library directories

If you are only interested in the client, right-click the apppsclient project in the solution explorer window and select Build (you may also need to manually build plgsoundmngr for sound support);
else, Build solution.
Notice that both plgsoundmngr and plgdbmysql fail the first time you build the whole solution, because libpsutil.lib does not exist yet. Just click "build" a second time and they will work just fine.
Also notice that before running the client, you will need to get the art files (see the next chapter).

Setting Up For Debugging

Now before you can debug the programs, you need to change some properties of the project.
For each application you are interested in debugging (e.g. apppsclient):
Right-Click on the project.
Under properties->debugging change:
Command to: C:\development\planeshift\(name).exe
Working directory to: C:\development\planeshift\
You should be good to go now.

Get PS Art

Minimal Art from SVN

IMPORTANT: At this time SVN art is broken, so you need PS released art to run your compiled client.

$HOME/development/planeshift$ svn co https://svn.code.sf.net/p/planeshift/code/art

$HOME/development/planeshift$ svn co https://svn.code.sf.net/p/planeshift/code/art

$HOME/development/planeshift$ svn co https://svn.code.sf.net/p/planeshift/code/art

https://svn.code.sf.net/p/planeshift/code/art

Released Art from a PlaneShift installation

If you want your compiled client to have all art (icons, skins, characters, ...) then you need to get the art from an official released client.
If you have previously downloaded a release package, you can use it to get the needed files. The files are in the "art" and "data" directories. However you should keep the following folders in data because the contents from the SVN are usually more recent and updated: gui, shader, shader-snippets and renderlayers.

For those who seek to only build the client, this is all you need. Start the client, and go enjoy the game.

Notice: you will also need this art to run the (SVN) server.

Get the Server Running

Optional section

Create the Database

Check if MySQL is running.
Also, you should use a Command Prompt in DOS for the MySQL client commands.
You can start your MySQL server in this way:

# chmod 755 /etc/rc.d/rc.mysqld

# chmod 755 /etc/rc.d/rc.mysqld

# /etc/rc.d/rc.mysqld start

# sudo service mysql start

# /etc/rc.d/rc.mysqld start

# /etc/rc.d/rc.mysqld start

# /etc/init.d/mysql start

Then login to the MySQL client using (default username with no password):

$ mysql -u username -ppassword

The default username is root with no password.
Using a text editor open /etc/rc.conf and add the line:

mysql_enable="YES"

then use

# /usr/local/etc/rc.d/mysql.sh start

to start the mysql server.
Then login to the MySQL client using (default username with no password):

$ mysql -u username -ppassword

The default username is root with no password.
To start mysql automatically on boot do the following:
sudo daemonic enable mysql
sudo /Library/StartupItems/daemonic-mysql/daemonic-mysql start

Next we need to set a password for the root mysql user: mysqladmin -u root password yourpasswordhere

To make the database you need to do the following:
cd $HOME/development/planeshift/src/server/database/mysql
mysql -u root -pyourpasswordhere
Start a command prompt (Start->Run and then type "cmd") and type:

C:\mysql\bin\mysqld --console

Start another command prompt and then login to the MySQL client using (the default username is root with no password):

C:\mysql\bin\mysql -u root

How to create a new PS database:

mysql> create database planeshift;
mysql> GRANT ALL PRIVILEGES ON planeshift.* TO planeshift@localhost IDENTIFIED BY 'planeshift';
mysql> quit

$ cd home/development/planeshift/src/server/database/mysql/
home/development/planeshift/src/server/database/mysql/$ mysql -u planeshift -pplaneshift

$ cd home/development/planeshift/src/server/database/mysql/
home/development/planeshift/src/server/database/mysql/$ mysql -u planeshift -pplaneshift

cd c:\development\planeshift\src\server\database\mysql\
C:\mysql\bin\mysql -u planeshift -pplaneshift

$ cd $HOME/development/planeshift/src/server/database/mysql/
home/development/planeshift/src/server/database/mysql/$ mysql -u planeshift -pplaneshift

mysql> use planeshift;
mysql> source create_all.sql;
mysql> quit

The database PlaneShift has now been created for PlaneShift to use.

Sometimes it is convenient to use another database name, user or password for development. In this case the file psserver.cfg has to be updated with the changed values. To change the database name the file create_all.sql also has to be modified.

Running the Server

If you have not installed mysql as a service, you need to start it manual each time before running the server.
Start a command prompt (Start->Run and then type "cmd") and type: C:\mysql\bin\mysqld --console

Go to your PlaneShift directory (C:\development\planeshift) and run psserver, this will start the server.
Note: psserver requires the DOS Command Prompt to run. psclient does not.
Go to your PlaneShift directory (C:\development\planeshift) and run psserver. This will start the server.If you have a script to start your server or load maps you can open a terminal and use :
psserver --run=/this/script_name

Note : If you have the file extension hidden, your file name might be "script.txt", and not "script"

Go to your PlaneShift directory ($HOME/development/planeshift) and run psserver, this will start the server. If you have a script to start your server or load maps you can use

./psserver --run=/this/script_name

Go to your PlaneShift directory ($HOME/development/planeshift) and run psserver, this will start the server. If you have a script to start your server or load maps you can use

./psserver --run=/this/script_name

Go to your PlaneShift directory ($HOME/development/planeshift) and run psserver, this will start the server. If you have a script to start your server or load maps you can use

./psserver --run=/this/script_name
Once the server has been started, you should see a "PS Server:" prompt. Not always does the prompt show PS Server: on first start but this is ok as long as you have gotten no errors so far.

Note: If you get any problems with psserver, make sure you have the latest version of MySQL 5.5 and that your libMySQL.dll file in windows\system32 (if any) is the same as the one in mysql\lib.

Type the following to load the correct map and spawn all items and NPCs:

PS Server: loadmap npcroom1
PS Server: loadmap npcroom2
PS Server: loadmap npcroom_corr
PS Server: loadmap podium
PS Server: spawn
PS Server: ready

Additional maps can be listed with the "maplist" command, and loaded via the "loadmap" command. To see a list of all available psserver commands, type "help". You can shut down the server with "quit".

You should now be able to start psclient and log in. The server is localhost on port 13331, if your server is located somewhere else or you want to connect to somebody's else server, you need to modify the servers list.

The servers list is located in C:\development\planeshift\data\servers.xml.

The servers list is located in $HOME/development/planeshift/data/servers.xml

The servers list is located in $HOME/development/planeshift/data/servers.xml

The servers list is located in $HOME/development/planeshift/data/servers.xml

The following accounts are in the SVN DB:

Username Password Access Group
vengeance keith full GM (30)
acraig andrew normal (0)
guest guest full GM (30)
dev1 andrew full GM (30)
dev2 andrew full GM (30)
gm1 andrew GM2 (22)
gm2 andrew GM6 (26)
admin1 planeshift Admin (50)
admin2 planeshift Admin (50)
player1 andrew normal (0)
player2 andrew normal (0)
player3 andrew normal (0)
player4 andrew normal (0)

To perform server actions you just have to log in as a GM character. If you want a list of commands available execute the /admin command. You will be given the list of available commands for your account's security group. When logged in with this account, you can view the in-game help to obtain the full list of available commands and syntax. If you loaded any maps other than the test map "npcroom", you may teleport to them by using the command: "/teleport me map [mapname]"

Get the NPC Server Running

NPCClient requires the "Navigation Mesh", which is basically a low resolution generated mesh of the walkable areas of the game, used to make the NPCs walk around. To use a pre-generated navmesh you can simply rename the file "navmesh_to_rename" to "navmesh" in the /data directory.
If you want to generate your own navmesh, you can launch the navgen program.

jam navgen
./navgen
./psnpcclient

Mini Scripts

Optional section

You might want to create some script so that you don't have to manually type in the environment variables every time. In this way you can also have multiple versions of CS coexisting peacefully.

Make a file "PlaneShiftserver.sh" in the $HOME/development folder, and copy/past the following script in it:

#!/bin/sh
export LD_LIBRARY_PATH=$PWD/cal3d/src/cal3d/.libs/:$PWD/cs/:$LD_LIBRARY_PATH
export CRYSTAL=$PWD/cs/
cd $PWD/planeshift
./psserver $@

Next make a file called "PlaneShiftclient.sh" in the same directory, and put the following script in it:

#!/bin/sh
export LD_LIBRARY_PATH=$PWD/cal3d/src/cal3d/.libs/:$PWD/cs/:$LD_LIBRARY_PATH
export CRYSTAL=$PWD/cs/
cd $PWD/planeshift/
./psclient $@

Finally we need to set the right permissions on the scripts:

$ chmod +x PlaneShiftserver.sh
$ chmod +x PlaneShiftclient.sh

Get the Client Running

WINDOWS USERS: You already have a working client since the "getting the art" chapter, use this chapter as reference on how to edit config files only. You do *NOT* need anything from it.

To have the client running you need at least two parts, described in the next chapters:
- ensure you are using the Crystal Space base configuration files
- ensure you are using some client art, better if the released art.

Note: If you just want to run the client and use it to connect to the main server, you can copy/paste the /art and the /data folder from the release client, and skip the rest of this section.

Pointing to Crystal Space configuration files

For the first point you need to open the vfs.cfg in your planeshift directory and change this line:

VFS.Mount.config = $@data$/config-plugins$/

by adding the path to your crystal space configuration files, example:

VFS.Mount.config = $@data$/config-plugins$/,$/development$/CS$/data$/config-plugins$/

On Windows VFS.Mount.config = $@data$/config-plugins$/,c:$/development$/CS$/

Pointing to PlaneShift release art files

If you plan to do development work, or would just like to not need to copy over most of the art, you can mount the data straight from its existing location. This is highly recommended for developers using the internal SVN art.

1) Open up the vfs.cfg file in the PlaneShift dir. Find the list of mount points (VFS.Mount.* lines) and add a mount for each custom dir you wish to use. For this example, I will mount a pre-installed package. Using the VFS syntax key at the top, add a mount as follows:

VFS.Mount.bins = $/development$/PSbins$/

I have named the mount "bins" and the dir I am using is at "/development/PSbins/". Please note in the example /development is in the root dir. If you have /home/user/development add it at the beginning of the path.

On Windows VFS.Mount.bins = c:$/development$/PSbins$/ will be equivalent to C:\development\PSbins\

You wil use the mapping in psclient.cfg, but in vfs.cfg you HAVE TO point to a physical path manually, so proceed by doing this:

VFS.Mount.planeshift/materials = $/development$/PSbins$/art/materials.zip
VFS.Mount.planeshift/meshes = $/development$/PSbins$/art/meshes.zip
VFS.Mount.planeshift/world = $/development$/PSbins$/art/world.zip

2) Open psclient.cfg (or the cfg file of the PS application you want to use a mount). To continue the above example, I can set the SVN build client to use the installed package's maps by editing the following in psclient.cfg:

Planeshift.GUI.Skin.Base = /bins/art/skins/base/client_base.zip
PlaneShift.GUI.Skin.Dir = /bins/art/skins/
PlaneShift.GUI.Skin.Selected = elves.zip

If you wish the server and NPC client to use these as well, modify/add that line to their cfg files too.

Note: PS mounts such as Planeshift.GUI.Skin.Base take a VFS path to a ZIP file, as opposed to a dir. If you wish to mount from an uncompressed dir, you need to add a slash to the end of the path:

On Windows it will be a backslash, not a forwardslash.
Planeshift.GUI.Skin.Base = /svn/planeshift/art/skins/base/client_base.zip\
On Linux it will be a forwardslash.

Planeshift.GUI.Skin.Base = /svn/planeshift/art/skins/base/client_base.zip/

On FreeBSD it will be a forwardslash.

Planeshift.GUI.Skin.Base = /svn/planeshift/art/skins/base/client_base.zip/

On Mac it will be a forwardslash.

Planeshift.GUI.Skin.Base = /svn/planeshift/art/skins/base/client_base.zip/

Pointing the client to your local server

To have your client connect to your local server, you just need to modify /planeshift/data/servers.xml adding one line like:

<server name="Localhost" description="Local test server" ip="localhost" port="13331" />

Common Problems / Troubleshooting

Generic Problems

If sounds does not work: change to Open AL in pslaunch.

If you get errors about art/skins/default.zip, change it to elves.zip in psclient.cfg. (there is no default.zip in the production art.

If your client crashes right after loading, or when looking at spells/effects being cast, add: Video.OpenGL.UseExtension.GL_ARB_vertex_buffer_object = true to your psclient.cfg (notice that sometimes a client prefers to take the file located in %appdata%) It seems some graphics cards cannot handle fancy effects without it. You can also set this by starting the launcher and clicking options. (Notice this also applies to ATI cards, ignore what pslaunch says about them.)

LINUX

Problem: You are getting this error:

/home/luke/ps/planeshift/./out/linux/debug/src/client/static/_cs_static_use_CRYSTAL.cpp:44: undefined reference to `csStaticPluginInit::glshader_cg::glshader_cg()'
collect2: error: ld returned 1 exit status

Solution: You need to install the nvidia cg toolkit, see above from instructions.


Problem: You are getting an error while compiling static client like:

...failed Archive ./out/linux/debug/libs/libplaneshift_database_staticplugins-0.5.a ...
...skipped psclient_static for lack of planeshift_database_staticplugins...

Solution: Edit the file planeshift/src/plugins/Jamfile and comment out this line:
#SubInclude TOP src plugins database ;

Getting Help

If you have trouble getting any of this to work, please feel free to contact us and we will do our best to help.
There is an IRC channel dedicated to providing help with building PlaneShift:

Server: irc.freenode.net
Channel: #PlaneShift-build

Credits

Caarrie, author of the first version of this guide and basic Mac guide;
Arianna Benigno, maintained the guide;
Rolenun, adjuster for good part of the content;
Dave Garrett, author of the new compiling guides layout;
Chris Ayers, author of the first guide for MSVC;
Steve Cook, author of the guide to compiling with Mingw32.
Platyna, author of the first compiling guide for Slackware distribution.
Mike Gist, author of the static compiling guide.
Andrew Craig, author of the first Linux guides.
Gijs Hofstee, rewriting the windows guide for MSVC 2015 and general maintenance.