Greg Dolley’s Weblog

A Blog about Graphics Programming, Game Programming, Tips and Tricks

Archive for the ‘Game Modding’ Category

How to Make a Quake 3 Arena Mod

Posted by gregd1024 on January 24, 2008

Now that the Quake III port is done, I can write about creating a mod instead of just installing one. Let’s get started…


You’ll need to be at least somewhat familiar with C programming in order to make a mod. Quake III doesn’t do what is typically done by other games these days – which is wrap all game modding into some form of scripting language (such as Lua) or abstract things to the point where you don’t need to be a game programmer or familiar with the entire codebase in order to make simple behavioral changes.

The Two Types of Mods

The first thing you’ll need to know is that there are two types of Quake III mods:

  1. QVM mods
  2. DLL mods

It doesn’t matter which type of mod you make. A QVM mod will have the same effect in the game as a DLL mod. The only difference is how these mods are executed at runtime.

QVM mods are created by compiling your source into a QVM file. These files are very similar to Java bytecode – they contain instructions that the Quake III engine interprets at runtime.

DLL mods are created by compiling your source into a Windows DLL. These DLL’s are no different from any other Win32 DLL – the operating system executes these DLL’s as native machine code whenever the Quake III engine needs to call a function contained within them.

Due to the extreme difficulty I experienced trying to load a QVM mod (as explained in a previous Quake III mod post), I’m going to focus on the creation of DLL mods for this post. In my opinion this method is the easier of the two anyway.

Get the Source Code

The first thing you’ll need to do is get the source code for Quake III Arena. You can download it from one of the following links:

You can use either of the two codebase’s. The second link is Id Software’s original C codebase, while the first link is my .NET MC++ port of their C code. Both contain a Visual Studio solution for compiling everything in one shot, but Id Software admits they didn’t do extensive testing after the VS conversion. If you only have Visual Studio 2003 then I would try their C version anyway. For those who have Visual Studio 2005, you can try the C version and just upgrade the project, but why go through the work when VS 2008 Express is free?

If you must use the original native codebase for some special reason, but only have Visual Studio 2008, send me an email through my Contact page and I’ll send you my upgrade checklist – a list of steps I did to convert the original VS 2003 project to VS 2008 while keeping the native C settings intact (once you know what the steps are, it actually only takes about 20 minutes to convert). I’m really glad Microsoft still supports ANSI C in the compiler.

You will need a retail copy of Quake 3 Arena to run mods, it will not work with the shareware demo version.

I know what you’re thinking – “but I have the source code, why can’t I circumvent the license check?!” The license check isn’t the problem. The problem is that there are a few big differences between the structure of a demo PK3 data file and a retail PK3 data file (specifically related to the UI interpreted bytecode instructions). The public source only includes code for reading a retail version’s PK3 data. If you try and force the code to read a demo data file (and believe me, I’ve tried), the game crashes half the time; the other half of the time it will run but with no menu options.

Besides, it’s not worth getting around the license – these days you can buy all three Quake games (Quake I, II, and Quake III Arena) for $20 bucks in the Ultimate Quake collection. I got mine at Fry’s Electronics for $19.95; I’d recommend you get it from a discount electronics store too since buying it from Id Software’s site will cost a little more ($30 bucks at the time of this writing).

Game Project Structure

There are eight project files included in the source. You’ll only need to focus on three of them:

  1. The cgame project.
  2. The game project.
  3. The quake3 project.

These projects build as Win32 DLL’s. However, you must change where the compiler saves them. Open their project settings and set the output directory to the “baseq3” folder of your Quake III installation (i.e. on my computer it is “c:\quake3\baseq3”).

Modify the Code

We’re going to change one line of code that will make the rocket launcher repeat-fire at a faster rate. Open the source file, bg_pmove.c, under the game project and look for a function called PM_Weapon. Once in this function scroll close to the bottom of it where you should see a switch statement that looks like:

switch( pm->ps->weapon ) {

In the switch statement look for the case of WP_ROCKET_LAUNCHER; it is 125 lines below the start of the function. In that case block the variable “addTime” is being set to 800 – change this to 100. So instead of:

   addTime = 800;


Now the code should look like:

   addTime = 100; // for rapid fire

Under the build configuration drop-down of Visual Studio select “Debug.” You could have selected “Release” but running in debug mode will give you better diagnostic information in the event something crashes. 

Now compile the source – select “Build->Rebuild Solution” from the menu. I recommend a full rebuild instead of a regular build just in case some stray binaries were accidentally left in the original source tree.

Installing and Running the Mod

Now it’s time to take the compiled DLL’s and have Quake III use them as a mod. By now you should have modified the three DLL projects to output their binaries to “c:\quake3\baseq3” (or whatever you chose as your Quake III installation). Open that directory in Explorer and check for the following DLL’s:

  1. cgamex86.dll
  2. qagamex86.dll
  3. uix86.dll

If those DLL’s are present, you’re ready to run your mod! Simply start Quake III with the following command line:

“quake3.exe +set sv_pure 0 +set vm_game 0 +set vm_cgame 0 +set vm_ui 0”

When the Quake III menu options load, select a single player game and run an instance without any bots (so you won’t get distracted). After you’re inside the map, press tilde (”~”) to drop down the Quake 3 console. Here you’ll see a ton a status text. Use the <Page Up> and <Page Down> keys to scroll through everything line by line. You’ll want to look for status messages saying your DLL’s were loaded OK. The status text for qagamex86 is quite a few pages up, while the status of cgamex86 and uix86 are near the bottom. These lines look like, “LoadLibrary qagamex86.dll ok.”

When you see the DLL’s were loaded successfully, you’re done! Now try picking up the rocket launcher and see how fast it fires!! A good map for getting the rocket launcher right away is q3dm1 accessible under Squirmish mode.

More Fun

Here’s something extra you can do to make the rocket launcher feel and act more like a rapid fire weapon. You see, when we changed the firing rate of the rocket launcher above, we really only changed the trigger rate (the minimum amount of time that you have to wait between rocket fires), but didn’t touch the speed at which the rockets travel. It will feel better and you’ll get more frags if the weapon has a faster muzzle velocity.

In order to do this, open up g_missile.c under the game project and search for a function called “fire_rocket.” Once there, you’ll notice that the function is very small and most of what it’s doing is setting projectile properties. You’re interested in the following line near the bottom:

VectorScale( dir, 900, bolt->s.pos.trDelta );

Change this line to:

VectorScale( dir, 1800, bolt->s.pos.trDelta );

So you’re really just changing the “900” to an “1800.” Anything less than 900 will give you a slower rocket, and anything more than 900 will give you a faster rocket. But beware! Just as you can now fire faster rockets, this also means the bots can do so as well.


Coming up with your own complex mods that require more than editing two lines of code will require some study of the Quake III codebase. You can learn quickly by simply playing around with the code and stepping through it with a debugger.

-Greg Dolley

*Get new posts automatically! Subscribe via RSS here. Want email updates instead? Click here.


Posted in Game Modding | 26 Comments »

How to Install a Quake 3 Mod – Common Problems and Solutions

Posted by gregd1024 on January 15, 2008

I’m assuming you’re reading this post for one of two reasons:

  1. You downloaded a mod from a third party, followed the installation instructions, and nothing actually changed in the game.
  2. You programmed your own mod but couldn’t get it to actually run.

This post can be applied to solve both problems, but I’m not going to cover how to actually make a mod; I’m just going to explain what common pitfalls exist and how you can overcome them. (I will be writing a post about how to create a mod in the near future, but that’ll be after I’m done with the Quake III .NET port.)

OK, let me start off by saying if you are having trouble installing a Quake III mod, you’re not alone. I had massive problems with the first mod I tried. It was a very simple mod where I changed the rocket launcher’s trigger rate and rocket speed – so it could rapid fire like the plasma gun. 😉 And, in the end, I was only able to install it via the compiled DLL’s – the QVM files, even though they all compiled successfully, just refused to load. Since Quake III will behave the same way regardless of whether a mod is installed via DLL(s) or QVM(s) (although DLL’s are a bit faster), I didn’t see the point in continuing to beat my head against the wall over those QVM files. Therefore in this post I’m going to explain the installation of mod DLL’s only, not QVM’s. If you have successfully installed QVM’s on the v1.32 point-release, please contact me here or leave a comment on this post.

This is the main problem: when you run Quake III using command line options, some parameters in the q3config.cfg file (under /baseq3) get overwritten in order to remember what was last set. Then, the next time you run the game, even if you don’t set the same arguments as in the last instance, the game will still run as if they had been set. For example, if you launch the game with, “quake3.exe +set vm_game 0” and later use just “quake3.exe,” those two instances will behave no differently. This can be very confusing and naturally results in methods never getting tested.

Not all command line parameters behave this way, but most do. The one’s which affect you when making mods are the following three:

  1. vm_game
  2. vm_cgame
  3. vm_ui

As you probably already know, these three correspond to the three “mod’able” game DLL’s or QVM’s (qagamex86, cgamex86, and uix86 – if you’re running on a non-Intel platform, the suffix will be different than “x86”).

There’s another big problem with installing mods and it has to do with the server’s operating mode. There are two modes the Quake 3 server can run under – “pure” and “non-pure.” A pure server can only run modified versions of qagamex86, while a non-pure server can run all three modules. Trouble is, even if you tell the game to use a module other than qagamex86, it will simply ignore your request if the server is in pure mode. You won’t even see an error message.

OK, by now I’m sure you’re wondering how to set up things properly so let’s get to it! I’m going to show you a series of steps, but first keep in mind that I’m running the 1.32 Point Release. If you don’t already have this version I would highly recommend installing the patch so we’re both on the same page. I don’t know whether the steps I’m going to list will work in other versions of the game. Now here goes…

Mod install steps:

  1. Copy the mod DLL(s) into the same directory where “quake3.exe” is located. Update (1/21/2008): actually, it’s safer to copy them to the “baseq3” directory under the root because only a Debug build of Quake III will scan both the root and “baseq3” while the Release build will only scan “baseq3.”
  2. Open a DOS command prompt.
  3. Type “cd <drive>:\<quake3_install_dir>\” and hit <Enter> (on my computer the path is “c:\quake3\”)
  4. Type “quake3.exe ” and append one or more of the following command line options:
    • “+set sv_pure 0” (this one is not optional)
    • If you’re installing qagamex86 add: ” +set vm_game 0″
    • If you’re installing cgamex86 add: ” +set vm_cgame 0″
    • If you’re installing uix86 add: ” +set vm_ui 0″
  5. Press <Enter> and the game will load.
  6. Once you see the Quake 3 menu go ahead and start a new single player game.
  7. Press tilde (“~”) to drop down the Quake 3 console.
  8. In the console you’ll see a ton of status text. Scroll through it via the <PageUp> and <PageDown> keys looking for lines that say your DLL’s were loaded successfully. The status text for qagamex86 is quite a few pages up, while the status of cgamex86 and uix86 are near the bottom. The lines look like, “LoadLibrary qagamex86.dll ok.” 
  9. If the console indicates your DLL(s) loaded correctly, then congratulations! Your mod should now be running in the game!

That’s about it. If you have any questions about installing DLL mods, feel free to email me via my Contact page.

-Greg Dolley

*Get new posts automatically! Subscribe via RSS here . Want email updates instead? Click here.

Posted in Game Modding | 26 Comments »

World of Warcraft Plugin Editor for Visual Studio!

Posted by gregd1024 on January 6, 2008

If you’re into making plugins for WoW, you’ll want to check this out:

AddOn Studio for World of Warcraft

I saw this on Visual Studio’s RSS feed. It’s quite an extensive add-on that turns your IDE into a WoW form editor and Lua script language editor. It even has syntax highlighting! Not only that, this thing does code generation just like Visual Studio – you can auto-generate Lua events, insert code snippets, and auto-generate the TOC file based on what files are in your project.

-Greg Dolley

Posted in Game Modding | 1 Comment »