Game Development Community

dev|Pro Game Development Curriculum

Updated Linux, Ubuntu, Torque SDK getting started guide.

by Jason Peterson · 07/11/2006 (12:41 pm) · 12 comments

This is my first resource so be gentle.

I have been tinkering with the Torque engine for about a year now, on both Macintosh and Windows. I am getting sick of having to use proprietary software so I decided to dive into the world of Linux.

I have been using Red Hat at work for about four years, so I decided to initially try Fedora Core 5 (fc5). That was a mistake. It was very time consuming to get the boot loader to install ( for dual boot ) and the nvidia drivers were also a headache. When I finally got everything running the 1.4.2 SDK binary install would give me a segmentation fault... as some others have found out. I installed the SDK on another Linux box and copied the directory structure to my fc5 box and tried to compile. That also failed miserably ( I don't remember the errors ). I believe Garage Games uses Gentoo so I also gave it a try. Don't do this yourself unless you have some time to kill, from start to finish it took roughly 21 hours to install ( compile ) all the necessary software. The install time could probably be cut in half if you don't compile openoffice, there may be a pre-compiled binaries version of Gentoo but I am not that familiar with it.

Gentoo was too painful for me ( it did work though ) so I decided to try one more distribution.

Ubuntu...

I can't say enough about the Ubuntu distribution. Installation was easy, fast and flawless. The download took longer than the installation itself. From start to finish with the Torque SDK running and compiling it took about an hour not including the initial Ubuntu download. Just for your information Ubuntu installed all drivers for all of my hardware including a Wacom tablet and some external disk drives with out my help. It also picked up on my Windows workgroup and I was able to browse all of my XP machines and install my shared printers, pretty cool.

Anyway here is a step by step guide to my installation. I hope it helps you and if you have any questions just ask.

If you haven't already done so jump over to www.ubuntu.com and download the installation iso.

Burn the iso to a disc.

Reboot your machine and make sure you can boot from your CD drive. This is done in the bios.

The Ubuntu CD is called a "LiveCD" it will boot up into a fulling function Ubuntu box. If you don't like the looks of things stop here.

If you are configuring your box for dual boot, you want to be able to boot into Windows or Linux, you need to have an empty partition on your hard drive or a separate hard drive altogether. This is where you will install Ubuntu. If you need more help on dual booting there are many good how to web sites for this.

I chose the separate hard drive method, with Windows XP already installed on my first drive. As a note you could also dual boot into two multiple distributions. I am running both 32 bit and a 64 bit Ubuntu on my AMD64 box, I am working on getting the SDK to compile and run in 64 bits, it is nice to compare both versions.

Once booted up launch the Ubuntu installer by double clicking on the Install icon.

Follow the steps on the screen and pay attention when you get to the partitioning part. Make sure you pick the right hard drive to erase and install Ubuntu. If you don't you will be sorry.

Once you finish the installation reboot by clicking the red power icon in the upper right corner. Ubuntu will prompt you to take the LiveCD out of the drive.

You should now have a dual bootable system. Choose the Ubuntu menu item to boot into Ubuntu Linux when you start your computer.

At this point that's about it for the installation. You should get a prompt in a dialog box to update any outdated packages ( applications ) on your first boot. Go ahead and do so.

You can also go ahead and install the Torque SDK. Make sure you set the permissions on the .bin file to make it executable, and double click.

Once the SDK is installed you are almost finished. There are some other packages that need to be installed that the Torque SDK and engine depends on to run. These weren't installed by default.

Ubuntu uses a program called the Synaptic Package Manager to install new programs and supporting libraries / software. It is found in the tool bar at the top of the desktop under System>Administration, go ahead and start it.

To get everything installed quickly use the search button to narrow your choices of packages.

The first thing you will need are the drivers for your video card for openGL. Nvidia has more support for Linux than ATI right now. I would recommend nvidia. If you have another chip-set your on your own.

Click the search button in the Package Manager and enter "nvidia". There should be a number of choices all with nvidia in them. What you need are "nvidia-glx" and "nvidia-glx-dev". Mark the packages for delivery by clicking the box off to the left of each name. Click the Apply button to install the software. You now need to reboot back into Ubuntu. After you are booted back up you are still not using the nvidia drivers. The X windows system uses the file /etc/X11/xorg.conf to configure the display. There is a section in the /etc/X11/xorg.conf file that starts with "Device", should look something like this:

Section "Device"
Identifier "NVIDIA Corporation ... "
Driver "nv"
BusID "PCI:1:0:0"
EndSection

Change the "nv" to "nvidia" and save the file. You have to do this as the super user. The easiest way is to use the terminal under Applications>Accessories and use the command:

sudo vim /etc/X11/xorg.conf (enter) then enter your password

this opens up the etc/X11/xorg.conf file in the VIM editor.

use the arrow keys to find the line with the "nv" in it. Hit the "i" key for insert and change "nv" to "nvidia" press the escape key and type ":wq" to write the file.

exit out of the terminal and hit Ctrl+Alt+Backspace to reset the X windows server. If all went well you should see the nvidia logo flash on your screen (very fast). The nvidia drivers are now functional.

Use the Synaptic Package Manager to install the following packages like before, make sure you install any dependencies if prompted:

libsdl1.2-dev
libsmpeg0
libsmpeg-dev

At this point the Torque Engine should run using the ./runtorque.sh command in the examples directory. You can edit the main.cs file to start the first person shooter demo instead of the default.

To build the engine you will also need to install the following packages, make sure you install any dependacies if prompted:


make
make-doc
g++
g++-4.0
gcc
gcc-4.0
gcc-4.0-base
nasm
libxft-dev

These are the packages that I had to update after a clean install of Ubuntu. If you did anything out of the ordinary during the install you may need more.

Reboot your computer.

You should now be able to build the engine. Use the terminal and cd into your Torque directory, and enter:

make -f mk/configure.mk OS=LINUX COMPILER=GCC4 BUILD=DEBUG

then enter

make

wait a minute or two and you should get a new .bin file in the examples folder.. torqueDemo_DEBUG.bin

to run it cd into examples and type ./runtorque.sh debug.

When you add files to the engine make sure to edit your "target.*.mk" files to include your code in the build, and enter the "make" command in the "Torque" directory to rebuild the engine.

That's it if you are wanting to get into Linux I think that Ubuntu is the best way to go... as far as efficiency goes. If any one has anything to add, or has a question, or if I made a mistake don't hesitate to fill me in, or ask. I through this together quite quickly.

Thanks,

Jason

About the author

Recent Blogs


#1
07/11/2006 (5:58 pm)
Thank you for putting all these together, will try it. Torque 1.3 (both server and client ) runs fine on
Redhat 9.0 and nvidia drivers.
#2
07/12/2006 (8:21 am)
This is excellent, a couple of things to note.
Kubuntu will be much easier for folks coming over from Windows than Ubuntu is, since Kubuntu uses KDE as it's default Window Manager whereas Ubunutu uses Gnome. However other than default window manager there is effectively no difference between the 2.

I would use Ubuntu or Kubuntu as my day to day desktop OS, but you do not want to use these as a game server, because the window manager and user friendlyness does cost you clock cycles. Use Gentoo for dedicated servers.

Quote:
What you need are "nvidia-glx" and "nvidia-glx-dev".
These will not be found by default, and are not applicable to ATI cards. To have access to the nVidia driver set you will need to make sure the "Multiverse" package repositories are enabled in your apt configuration file.
For ATI just go to the ATI website look for linux drivers and download and run their installer, there is an option for Ubunutu in the driver config.

Quote:
sudo vim /etc/X11/xorg.conf (enter) then enter your password

vim is not really good for a novice to try and use. Use nano instead,
sudo nano /etc/X11/xorg.conf
the editor is much more noob friendly ctrl+o will write out the file, and just use the arrow keys to navigate it.


Anyways excellent work!

Regards,
Dreamer
#3
07/13/2006 (6:37 am)
I am not sure the nvidia changes are required for those using a Nvidia card.

I installed Ubuntu when I started working on 1.4.2 for GG and never once touched my X11 config etc. Just installed the proper drivers etc and went to work

-Ron
#4
07/16/2006 (9:32 am)
read a article from slashdot: Tom's Hardware Reviews ATI and Nvidia on Linux
http://www.tomshardware.com/2006/07/12/geforce_and_radeon_take_on_linux/
just want to keep the link here, so others can find it helpful.

Edit: correcting the link.
#5
07/20/2006 (9:33 pm)
You can also get the live cd's shipped to you for free, and mix n match distro's eg get several PC, 64 bit or mac distro's :-)

I just had 5 ubuntu cd's arrive - did take ~5 weeks if you are prepared to wait,

try http://shipit.ubuntu.com or http://shipit.kubuntu.org

Thanks for outlining the steps as I have not tried the linux version of TGB nor TGE yet
#6
07/28/2006 (2:36 pm)
You don't have to use Gentoo in order to run a network server. In fact it would be safer to use a distro that has precompiled binaries that were tested on tens of thousands of boxes. Its easy enough to switch to text mode. Just type "init 3" to instantly quit out of X and go into text mode. If you want it to start in text mode, just edit your "/etc/inittab" so that the default init level is 3.
#7
07/28/2006 (2:42 pm)
Well you have a good point Ray, you don't have to use gentoo, but do a ps ax sometime in your runlevel 3 you will still see there are unneeded processes going yes you coul kill them off, or even prevent them from starting but why bother. With Gentoo it's just alot easier to not install all that stuff. Also a binary properly built with optimizations specific to the hardware and without kitchen sink dependencies will result in better performance. Maybe not the 50% but probably at least 1-2% and you do that on all your needed packages to just have a running system, and you endup in the end with markedly better performance.

Regards,
Dreamer
#8
07/28/2006 (3:50 pm)
No I agree that you can compile faster, less reliable binaries for Gentoo, by using specialized CPU specific optimizations. I used to do that with my Slackware desktop for fun. I used to make a few small tweaks the the Linux source code too, which would increase my performance even more. Would I do that on a server that had to be up all the time no matter what? I don't think I would.

I tried out Ubuntu a little bit ago, and it was pretty minimal with what you had running in the default install. In fact it didn't have any developer tools at all (no gcc or make), which is great for a server. You never want to have any type of compiler on your servers, since its super easy to make tools that will exploit the machine, if you can get on as a limited user account. If you are really that picky about services, you can just disable them in the startup scripts, which is dead simple to do.
#9
07/31/2006 (6:24 am)
For dedicated servers I'd build Linux from Scratch and deploy on as many servers as needed.
www.linuxfromscratch.org
You'd have to write up some deployment scripts of course, but once that is done, deploying new servers for your game would be a breeze, minimalistic and higly optimized for your hardware.

edit:link
#10
12/12/2006 (7:34 am)
Nice resource, but I would recommend the "build-essential" package for a basic compiler collection,
make and more. I think nasm needs to be selected in addition.

There's also a handy libsdl1.2-all package in Ubuntu.

Also, for Windows-primary users who just want a somewhat familiar environment, there's the
kubuntu-desktop package ;)

Pros: Not butt-ugly, and has many nice themes.
Cons: Big download, people with too much spare time still argue about the licensing :P
#11
11/26/2007 (2:12 pm)
thank you, Thank You, THANK YOU!!!

I've been trying for a week to get TGE to work under Fedora 8, and being a Linux noob I just couldn't get all the requisite libs set up. It took me about three hours to install Ubuntu and get TGE working, as it didn't install all the libs I needed but with a bit of looking about and using Synaptic Package Manager, it's rawkin' now. I still have some issues with the Linux build crashing my OSX and XP clients on server join, but at least now I am in a position to troubleshoot in know territory.

Thanks again

Gibby
#12
05/31/2009 (12:54 pm)
After doing these two commands:

make -f mk/configure.mk OS=LINUX COMPILER=GCC4 BUILD=DEBUG
make

It compiled everything except for audio/audio.cc ...


--> Compiling audio/audio.cc
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
In file included from ./platform/platformAL.h:25,
from ./platform/platformAudio.h:16,
from ./audio/audio.h:10,
from audio/audio.cc:6:
../lib/openal/LINUX/al/al_func.h:18: error: ‘<anonymous>’ has incomplete type
../lib/openal/LINUX/al/al_func.h:18: error: invalid use of ‘ALvoid’
In file included from ./platform/platformAL.h:26,
from ./platform/platformAudio.h:16,
from ./audio/audio.h:10,
from audio/audio.cc:6:
../lib/openal/LINUX/al/alc_func.h:11: error: ‘<anonymous>’ has incomplete type
../lib/openal/LINUX/al/alc_func.h:11: error: invalid use of ‘ALCvoid’
audio/audio.cc: In function ‘bool cullSource(U32*, F32)’:
audio/audio.cc:252: error: too few arguments to function
audio/audio.cc: In function ‘AUDIOHANDLE alxCreateSource(const Audio::Description*, const char*, const MatrixF*, AudioSampleEnvironment*)’:
audio/audio.cc:731: error: too few arguments to function
audio/audio.cc: In function ‘void alxLoopingUpdate()’:
audio/audio.cc:1732: error: too few arguments to function
audio/audio.cc: In function ‘void alxStreamingUpdate()’:
audio/audio.cc:1833: error: too few arguments to function
audio/audio.cc: In function ‘bool Audio::OpenALInit()’:
audio/audio.cc:2414: error: too few arguments to function
audio/audio.cc:2419: error: too few arguments to function
audio/audio.cc:2441: error: too few arguments to function
make[1]: *** [out.GCC4.DEBUG/audio/audio.obj] Error 1
make: *** [default] Error 2


New to C - tried to trace - but I couldn't find anthing... Been a long time since I've coded. I'm guessing I might not have installed all the libraries... yet some of the items didn't match up perfectly with what I have... Using Ubuntu 8.10 and TGE 1.5.0. Thanks!