Quake DeveLS - You stooopid idiot !

Author: SumFuka
Difficulty: Easy

Hi there, I am your host, SumFuka. The first thing we are going to do is to download the q2 source and install it. I have installed it to E:\myquake2, so substitute your directory name in the following examples if you install it elsewhere.

Now lets talk compilers, I have tried using lcc and gcc, and have managed (after much trouble) to compile the GAMEX86.DLL with both of those free compilers, but both of them have crashed quake when I try to run it. I am now using an old version of Microsoft Visual C++ (version 2.1), so if you don't want to pay for the new version, ask your friends or ring some stores, you may find an old version of 2.1 kicking about (which is quite satisfactory, and has less baggage than v5). (Do they have sell old compilers in those bargain bins at EB ? I've never burrowed to the bottom of one of those bins... you never know what you might find)

OK, we need to create a new project in MSVC.

  1. Open MSVC, and select FILE, NEW, and create a new Project.
  2. Create a (NON-MFC) "Dynamic-Link Library"
  3. Give it a name GAMEX86
  4. Give it a directory of E:\MYQUAKE2\GAME. That way all the source files are in the same directory as our project.
  5. Click OK and you will be asked to add files to the project. Add ALL the .c files included in E:\MYQUAKE2\GAME, and the game.def file too.
  6. Your project is complete ! Hit SHIFT-F8 to compile it !
  7. There should be "0 errors, 0 warnings" from compiling the dll. If there are some errors, either you have messed with the code or you have a BAD(tm) version of MSVC.
OK at this stage you should have compiled gamex86.dll !!! You should find it in the E:\MYQUAKE2\GAME\WinDebug directory. The file size will vary greatly with compiler versions and debug\release modes, but it should be between 300 and 500k.

Installing gamex86.dll...

BACKUP YOUR OLD GAMEX86.DLL !!!! Without it you wont be able to play quake2 ! You will find it in C:\QUAKE2\BASEQ2. To install our NEW, FRESH (and more nutricious) gamex86.dll, simply copy it from E:\MYQUAKE2\GAME\WINDEBUG to C:\QUAKE2\BASEQ2. Run quake !

You STOOPID idiot !

Now the fun begins ! open the file p_client.c and go to line 74. Change this line :

gi.bprintf (PRINT_MEDIUM,"%s killed self.\n", self->client->pers.netname);
to look like this :

gi.bprintf (PRINT_MEDIUM,"%s killed self... You STOOOPID idiot !\n", self->client->pers.netname);
What does the above line mean ? Well gi is the "game interface". All functions you need to call in the quake2 world are called via the game interface. bprintf is a "broadcast" print function... it prints a message to all connected clients in the game. (very similar to bprint in QuakeC... ahhhh, the good old days !)

The parameters to bprintf are the print level (a high level message is guaranteed to get to all clients, low level messages may not get to everyone in a busy game). Next is the FORMAT STRING. Look up a good book on c for how to construct format strings, but here is my 3 step lesson on C-string formats :

  1. Simply write your string, putting %s where you want strings to appear, or %d where you want integers to appear
  2. Follow the format string with each % variable you put in the string, IN THE SAME ORDER !
  3. Make sure the type of %s parameters are (char *) and %d parameters are (int)
What the HELL is self->client->pers.netname ?

In our example, the %s is replaced with self->client->pers.netname (What the HELL is that ?)... easy, self is, well, YOU in the quake2 world. the arrow thingy (->) points to a data object on the right owned by the data object on the left. So YOU in the game world have a data object called CLIENT. Your client object has a data object of its own called PERS (persistent data). Finally, the persistent data has a field called NETNAME (which is referenced by the .). Phew. Don't worry if you didn't follow that...

Now, compile the gamex86.dll and copy it into your quake2\baseq2 directory. Run quake2 and start a multiplayer server. Grab the rocket launcher, run up to the nearest wall and fire away ! When you kill yourself, quake2 should say :

Au.SumFuka killed self... You STOOOPID idiot !
Tutorial by SumFuka

This site, and all content and graphics displayed on it,
are ©opyrighted to the Quake DeveLS team. All rights received.
Got a suggestion? Comment? Question? Hate mail? Send it to us!
Oh yeah, this site is best viewed in 16 Bit or higher, with the resolution on 800*600.
Thanks to Planet Quake for there great help and support with hosting.
Best viewed with Netscape 4 or IE 3