Up 'N Running

From ioquake3 wiki
Jump to navigation Jump to search

Tutorial 2 - Up 'N Running

By [SumFuka]


Ok, time to get our hands dirty. Visit fileplanet.com if you haven't already got the stuff below :

  • quake3 (cd)
  • Q3PointRelease_Jan1300.exe
  • Q3AGameSource.exe

You'll also need a compiler. I highly recommend MSVC6... it's an industrial standard IDE and the game source comes with project workspaces for MSVC so that you can get started right away. If you're a student try your college bookshop for a cheap price on MSVC. Or get one from work, or whatever. We'll have "MSVC in da house" for these tutorials. (Check out the great articles 4 and 5 by HypoThermia on How To Compile Without Microsoft Visual C++ (Part 1)).

1. Configuring MSVC

Your system needs to be configured to run MSVC. Open your autoexec.bat. Add the following line to the end :


If your VCVARS32.BAT is located somewhere else then modify accordingly. If you haven't got a VCVARS32.BAT then re-install MSVC. Next, we need to add something to our path - this is where the tools for creating qvm's are located. Add the following line in your autoexec.bat (at the end of the file, or directly below the other lines that define your path if you want to keep it neat!) :



2. Installing

Make sure quake3 AND the point release are installed and work fine (yes, you MUST have the point release installed... Neither Version 1.11 nor a cracked quake3.exe will work). Install to the c:\quake3 directory if you can (the Q3AGameSource only likes installing to C:\Quake3... otherwise you'll need to do some directory renaming).

Next install the q3a source (by running Q3AGameSource.exe, DUH!). You should now see a quake3\source directory.

3. Open the Project

If you have MSVC installed then let's jump right in - double click on quake3\source\q3agame.dsw. You should see the project open in MSVC. If you're NOT using MSVC then you'll need to create your own project definition using the source files under quake3\source.

Ok, if you're new to MSVC, here's some pointers. Click the 'FileView' tab on the left pane - you'll see a tree there. Notice that there are three projects here. 'game' is the most interesting project - it defines how the server runs the game. 'cgame' contains client code, whilst 'ui' contains stuff for the in-game user interface (e.g. menus).

We will be making most of our modifications to the 'Source files' and 'Header files' in the 'game' project. Double click on a source file in the tree to open it in the editor window. Open some of the source files and have a browse (don't worry if they seem daunting at first!). Here's an excerpt from one of the more interesting files, g_weapon.c :




void Weapon_RocketLauncher_Fire (gentity_t *ent) {
        gentity_t       *m;

        m = fire_rocket (ent, muzzle, forward);
        m->damage *= s_quadFactor;
        m->splashDamage *= s_quadFactor;

//      VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta );
        // "real" physics

4. Set the directory where the .dll appears

We want the .dll to appear in our quake3\source directory. By default gamex86.dll is compiled in the quake3\source\Debug directory (which we need to change).

Ok, still in MSVC, go to the "Project" menu and choose "Settings (ALT-F7)". Single-click on 'game' in the list of projects on the left hand side. We're going to change where the qagamex86.dll file is built. Click the "Link" tab and have a look at the "Output file name" - by default it's set to "..\Debug/qagamex86.dll". Change it to "..\qagamex86.dll".

5. Compile the project

Ok. In MSVC, go to the "Project" menu and choose "Set Active Project -> 2 game".

To compile the 'game' project, let's choose "Build qagamex86.dll (F7)" from the "Build" menu. MSVC will tell you the progress in the bottom pane. You should finish with "0 error(s), 0 warning(s)" (since you havent modified anything yet... right ?). The qagamex86.dll file should appear in your quake3\source directory.

6. Test the .dll

Ok, let's run quake3\quake3.exe +set fs_game source +map q3dm1. Hit tilde (the top left key on your keyboard) and use the pageup and pagedown keys to scroll through the log... you should see a message somewhere that the .dll file was successfully found and loaded! If you see a message saying that no .dll was found then your .dll is in the wrong place... if quake can't find your .dll then obviously your mod can't run.

7. Create a QVM

A .qvm, or 'quake virtual machine' is fairly easy to create (assuming your environment was set up correctly). What is a .qvm ? I like to think of it a as a 'safe' substitute for a .dll. It's safer than a .dll because a .qvm isn't able to do nasty things that .dll's can (wipe your hard drive, for example). Not to say that they are 100% safe (remember when people broke the security on Java applets by overflowing the virtual machine's stack ??) but qvm's are certainly safer.

Let's make a .qvm now. Open a DOS shell and go to the quake3\source\game directory. Then run game.bat. Voila - You'll see a .qvm file appear in the quake3\source\vm directory! We can run cgame.bat and ui.bat (in their respective directories) to make two more .qvm's. You can distribute these .qvm files to other people so that they can run your mod.

Ok, now you're up and running. "Ree-spect". Now let's make our first modification...

«Tutorial 1: Mod Making 101 | Tutorial 2: Up 'N Running | Tutorial 3: Hello, Qworld! »