actuality.log


Tuesday, August the 23rd, 2005

This weekend was good for the pseudo-intellectual amongst the gaming community. The source code for Quake III‘s engine was released. Here are some steps and notes to getting it compiled on your friendly GNU/Linux box.

(Remember, this is just the engine, and you do need to shell out the $10 or whatever and get your copy of the original game, for the game data.)

Steps:

0) cd /convenient/directory/
1) wget --passive-ftp ftp://ftp.idsoftware.com/idstuff/ source/quake3-1.32b-source.zip
2) unzip -qq quake3-1.32b-source.zip
3) cd quake3-1.32b
4) find -type f -exec dos2unix {} \;
5) cd code
6) chmod +x ./unix/cons
7) ./unix/cons -- release
8) cp -r /where/you/installed/the/game/you/bought/baseq3 ./install/
9) cd install
10) ./linuxq3

Corresponding Notes:

0) Pick a directory writable by you. Duh.
1) Make sure you get the latest code by first browsing the ftp site with your web browser.
2) -qq keeps things very quiet.
4) Make sure all the evil DOS carriage return characters are removed and the text files are UNIXified.
6) Make the install script executable.
7) -- release ensures you’re building the “final release” version of the code without -Werror turned on. Which means it will complain, but not balk, on warnings. You could also do ./unix/cons -- release gcc="/opt/intel_cc_80/bin/icc" g++="/opt/intel_cc_80/bin/icc" for, you know, Intel goodness.
8) Move the game data over from the original game’s install.
10) Start fragging!

Once you’re done and decide to actually learn something, you browse the code a bit. There are some absolutely intriguing (or horrendous, depending on how you look at it) bits in the code. For e.g., in code/game/q_math.c,


float Q_rsqrt( float number )
{
	long i;
	float x2, y;
	const float threehalfs = 1.5F;

	x2 = number * 0.5F;
	y  = number;
	i  = * ( long * ) &y;
       // evil floating point bit level hacking
	i  = 0x5f3759df - ( i >> 1 );  // what the fuck?
	y  = * ( float * ) &i;
	y  = y * ( threehalfs - ( x2 * y * y ) );

#ifndef Q3_VM
#ifdef __linux__
	assert( !isnan(y) ); // bk010122 - FPE?
#endif
#endif
	return y;
}

Seriously, what the fuck? I found a paper on-line that made a little bit more sense.

This is a printer-friendly version of the journal entry “Compiling and running Quake III on GNU/Linux” from actuality.log. Visit http://emphaticallystatic.org/earlier/compiling-and-running-quake-iii-on-gnulinux/ to read the original entry and follow any responses to it.

4 Responses to “Compiling and running Quake III on GNU/Linux”

  1. Anantha says:

    In making this post, I think you screwed up your right column !

  2. wahgnube says:

    I just noticed. I had to find a machine with windows and IE. Will look into it.

  3. pul| says:

    What’s with the “intel goodness” thing? I remember you speak about it quite often.

  4. wahgnube says:

    (Where I am coming from: Almost every machine I’ve been around since I was two (1982) has been Intel processor based. This results in me having some sort of semi-faith-based zealotry toward the company and their products. For instance, I can’t imagine owning an Apple computer now, but the moment the first Intel based Apple Powerbooks come out, I am getting one.)

    Given the source of a program to be compiled on an x86 variant, who better to write a compiler that uses all nifty performance tricks on that processor line than the processor maker themselves?

    Therefore, by “intel goodness” I refer to the 30%–100% performance boost you gain using icc over using, say gcc, for the exact same code on an x86 processor. Though it seems like I pulled those numbers out of thin air, I have plenty of anecdotal and sometimes-scientific evidence to support them.


1 people conned into wasting their bandwidth.