|The first thing you'll need is the source package. The source is available at ftp://ftp.idsoftware.com/idstuff/quake3/source/, but there's probably an id mirror closer to you. Download the appropriate package for the 1.32 release (Ignore the TA thing in the filenames - it includes the team arena source, but makes builds for normal q3a). When you've installed the source, take a look at the source tree. Now, the folders:|
- code: This contains the actual code for the game
- lcc: This contains the compiler the the code. Note that you can't use a normal compiler, as quake 3 uses a virtual machine for execution.
- q3asm: The assembler for the virtual machine.
- ui: I'm not sure what this is used for, there's only one file in there.
The first thing to do is try to compile the source. I think there's a MSVC++ workspace for windows users, I've never checked. For linux users, just run GNU Make ("make") in the code directory, and everything should copmile.
To test this, create a file named description.txt. In it, have a single line of text, describing your 'mod' ('testmod' will do just fine). Zip up the text file, and rename it pak0.pk3. Then, create a new directory in your quake 3 folder, and drop the pk3 file in there (quake 3 doesn't acknowledge a directory as being a mod unless there's a pak0.pk3 file in there). Inside the directory, create another directory called vm, take the .qvm files out of the source tree (make sure they're the q3a qvm files, not the ta ones), and place them into the directory. Then try running quake 3, and selecting your mod from the mods list. If all goes well, it should run as it always does.
Now comes the fun part. As an initial experiment, we're going to change the names of the skill levels, and make rockets move half as fast as they do now. The first thing you should always do is go into game/bg_public.h, and change line 8. By default, it reads baseq3-1. Make sure that's something different, to ensure you don't get mismatched clients and servers.
The difficulty levels are stored in ui/ui_main.c, starting on line 27. Change them to whatever you want. Compile it, replace your old .qvm files, and try quake 3 again. Start a bot match, and see your new difficulty settings. If there are compilation issues, make sure you closed the quotes.
Playing with the rockets is more intersting. Locate game/g_missile.c. In the function fire_rocket, look for the line where it calls VectorScale(dir, 900, bolt->s.pos.trDelta).That 900 is the speed of the rocket. Now, to halve it, as I said earlier, change it to 450. Or 30000. Or whatever you want, really. Then, recompile as before, and try it. (Hint: the player runs at about 350 units, any less than that and you can run faster than your rockets. The DeFrag mod can give you your speed and height and other stats, if you need them.)
Now that you've got a general idea of what's required to screw with the gameplay (that's all the code does - you'll need 3d studio max or similar to change the models, and Radiant if you want to change the levels), you should be able to try writing your own mod. The "game" directory contains the server code - movement, weapons, spawning, that kind of stuff. "cgame" is the client stuff, so graphics, sounds, effects, and prediction. "ui" is the user interface - the menus. One thing to always keep in mind is that this is only the game code, the engine is closed-source and will probably remain that way until doom 3 is released. There are limits to what you can do with the source, and there are many 'system calls' that you won't be able to read through. If you want to be able to make greater changes, you'll have to use an earlier version of the engine (quake 1 or 2 - q1 uses a VM, q2 uses dynamic libraries).
If you're stuck for an idea of what to try, try an instagib mod (railguns only/railguns and gauntlets, unlimited ammo, one hit kills, and maybe gib yourself if you miss twice, to make it more interesting). They're not overly difficult, but should give you a fair idea of the layout of the source. And maybe it will help your rail accuracy :p Beware any areas surrounded by #ifdef MISSIONPACK and #endif, they're for quake 3 team arena - if you've got the game, you can play with them. The process is exactly the same. This article also applies (mostly) to the SDKs for:
- Elite Force
- Return to Castle Wolfenstein
- Enemy Territory
- Soldier of Fortune 2 (I think I saw the SDK somewhere... it's on the quake 3 engine, anyway)
- Generally, anything on the quake 3 engine - not all the games have released SDKs, but many do.
Happy fragging/coding/syntax errors!