Getting the Nebula Sourcecode and Compiling It


I've put together these documents in the interest of combining all the useful texts about using compiling and using Nebula in one place, and in my own words. Also I wanted to create a set of tutes more geared for the new user, with terminology explained so that people aren't left guessing what's going on.

If you're a Wndows user, and you'd rather not go through the process of compiling, then you might want to look at grabbing the precompiled Nebula binaries. Though they are a little older, they still work fine.

For those that do want to compile, If you are working on a Windows system you should install the Cygwin Unix tools to run on your system. NeL, the massive multiplayer engine requires that you have this also, so it's good to have it on board. Anyway, Cygwin gives you the GCC compiler. While it's possible to use Visual Studio 6/7, this tutorial focusses on Free Software development practices (wherever possible) so you'll need to look elsewhere if you'd rather use that. If however, you are working in Linux, the excellent compiler, GCC, will already be on your system. A compiler is necessary to turn sourcecode into objects (or binaries) that comprise the running engine.

Next we need to download the engine source-code itself, using a method that ensures we have the very latest features. To do this we'll use CVS software (Concurrent Version System) to grab the the code and mirror it in a meaningful directory structure on our local machine. CVS is used in the bulk of software development projects worldwide as a way of keeping track of changes to code made by many concurrent developers. We will simply use CVS to get the source, and forget about it for the time being.

Windows users should use the free
WinCVS. Apparently it's the easiest CVS client to use. The documentation is here. See section 'IV' – it's all you need. Linux users simply need to use the commandline program 'cvs' which is probably already on your machine. If not install it and use it in a terminal as you see it below. The command to pass to your CVS client (whether WinCVS or cvs) to download aquire the source is:


cvs -d:pserver:[email protected]:/cvsroot/nebuladevice login

When asked for a password just hit <ENTER>. You've logged in. Then give this to the client to get the source:


cvs -z3 -d:pserver:[email protected]:/cvsroot/nebuladevice co nebula


If it looks like a complex command, fear ye not, all it's doing is requesting download of a specific branch of code from inside the nebula sourceforge server. You should see the download progress as it writes the data onto your local filesystem. Remember WinCVS users will need to deconstruct that command to use it following the manual page given above.


Once this is done, do the following depending on your build architecture:

Linux:


Kernel Version 2.2 or better (eg any recent Linux system)

GCC-2.95 or better (type 'gcc -v' to get the version)

Mesa3 or higher


TCL/TK8.4 or higher (used as Nebula's scripting language). Make sure you get rid of any older versions!

Latest
DevIL


Of course the best way to install these packages is using your favourite on board package installation environment (Yast, apt-get, rpm etc). Regardless, check that they are installed in a normal library path like /usr/local/lib or /usr/lib. If they are not installed there make sure you add the path to where they are in /etc/ld.so.conf and run 'ldconfig' as root.

Alter your ~/.bashrc to include the environment variables Nebula needs to build and run. Make sure they reflect your own paths:


NOMADS_HOME=~/nebula
NEBULADIR=~/nebula
PATH=$PATH:$NOMADS_HOME/bin:$NOMADS_HOME/bin/linux
LD_LIBRARY_PATH=$NOMADS_HOME/bin/linux:$LD_LIBRARY_PATH
export OSTYPE NOMADS_HOME NEBULADIR PATH LD_LIBRARY_PATH


To update and make a list of all the files to compile, run:


cd $NEBULADIR/code/src
tclsh updsrc.tcl


Then compile:


make


Done! All the binaries (executable Nebula programs) are in $NEBULADIR/bin/linux/


To test it out:


cd $NEBULADIR/data/tekdemos
nlaunch tekdemos.tcl


.. and have a play around ;)

Windows:


To be honest I have little experience with Windows these days, but the following information has been put together from reliable sources, and I'm assured it works. Nebula has many Windows users, so a solution to a problem (if you encounter one at all) is never far away.

As with many things, compiling on Windows is a bit trickier but this should do it:


Windows XP/ME/2000/NT
DirectX 8/8.1 SDK
TCL/TK8.4 or higher (used as Nebula's scripting language). Make sure you get rid of any older versions!
Latest DevIL (Windows users only need the binaries)
Cygwin (for compiling from the commandline)


Take note of where the Nebula sourcecode was written onto your system.

Now you need to move the DevIL binaries (DLL's) and put them into both nebula\bin\win32 and nebula\bin\win32d

You also need to copy the DLL's for TCL and TK into
into nebula\bin\win32 and
nebula\bin\win32d

Most importantly make sure tcl84.dll, tk84.dll, tclpip84.dll are copied there.

So, now we're ready to begin setting up the compile by creating an updated list of what we want to build. Start Up Cygwin (from the start bar or a desktop shortcut) and:


cd nebula/code/src
tclsh84 updsrc.tcl



Just as in linux, 'environment variables' need to be set. These are paths that the system is told to remember so that it knows where to find the files you ask it to use. However, in Windows you set these using the control panel. See this guide for help setting the following environment variables. For some senseless reason, you need to reboot to change them for user Administrator (if you need to):


NOMADS_HOME=c:/dev/nebula change to fit your paths (must be fwd slashes app.)
PATH=%PATH%;%NOMADS_HOME%\bin\win32
eg: c:\dev\nebula\bin\win32


Now in Cygwin do the following:


cd $NOMADS_HOME/code/src
make


Ok so now it's compiling. When done try out the tech demos:


cd $NOMADS_HOME/data/tekdemos
nlaunch tekdemos.tcl


If you can see the tekdemos then go on to Part2:
Scripting and the Basics of the Nebula Scenegraph


Because this tutorial is focussed on free game development tools, you will have to go here if you want help compiling Nebula using VC6/7.