Difference between revisions of "Mod Making 101"

From ioquake3 wiki
Jump to: navigation, search
Line 48: Line 48:
  
 
... Still here ? Great. Now go get coding, and "keep it real".
 
... Still here ? Great. Now go get coding, and "keep it real".
= Tutorial 2 - Up 'N Running =
 
 
By [[mailto:sumfuka@planetquake.com SumFuka]]
 
 
(Or, HOW TO GET THAT DAMN COMPILER TO WORK !)
 
 
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 With Other Compilers (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 :
 
C:\MICROSOFT VISUAL STUDIO\VC98\BIN\VCVARS32.BAT
 
 
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!) :
 
 
SET PATH= C:\QUAKE3\BIN_NT;%PATH%
 
 
Reboot.
 
 
== 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 :
 
 
<pre>
 
/*
 
======================================================================
 
 
ROCKET
 
 
======================================================================
 
*/
 
 
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
 
}
 
</pre>
 
 
== 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 <b>quake3\quake3.exe +set fs_game source +map q3dm1</b>. 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...
 
 
 
<b>Mod Making 101 | [[Up 'N Running | Tutorial 2: Up 'N Running]]</b>
 
<b>Mod Making 101 | [[Up 'N Running | Tutorial 2: Up 'N Running]]</b>

Revision as of 21:18, 25 September 2009

Tutorial 1 - Mod Making 101

By [SumFuka]

Hello and welcome to wonderful world of quake mods! Quake3 seems destined to be the best ever platform for mod making - we have the advantage of programming C in an industrial standard IDE (such as MSVC) and the security features of .qvm's. We also have the very best fps graphics engine to date. Not to mention out-of-the-box support for ctf and bots. That gives us a pretty solid platform to build from.

This first tutorial isn't really a tutorial (!?) - it just describes mod making basics (what is a mod, how does it work etc). If you're a mod making veteran (or you just want to get your hands dirty), jump right in at tutorial #2.

Still here ? Ok, the best way to learn q3coding is just like sex - practise practise practise ! So try coding all the tutorials on this site. Yep, that's right - don't just read them, go ahead and compile each one ! You'll learn heaps by browsing through the code and actually typing in the code modifications yourself. But first... some background.

What is a mod?

A quake3 modification or 'mod' is essentially a new game you can play in quake3, using modified rules / weapons / levels / characters / etc. Since the early days of quake1, id software have generously allowed the community to create their own mods. [In my opinion, it's these mods that have given quake it's longevity and fostered the great quake community we have today]. Who can forget Zoid's "Capture the Flag" (ctf) and TFS's "Team Fortress" for quake 1 ? If you haven't played a mod before, go and have a play at ctf. In fact, why not go and have a bash anyway... ?

(3 hours later)

... back already ? Ok. It's a great feeling (playing ctf) isn't it ? Who would have thought that a simple "run around and shoot everyone" game like quake could have been modified into such a classic ? There have been hundreds of mods and many classics. Have a browse through the mods section at planetquake.

My favourite all-time list of mods is [personal opinion, no flames - please !] : (1) Ctf (2) Team Fortress (3) Duel / Teamplay mods (4) Holy Wars (5) Rail Arena [shameless plug, sorry!]. Each one of these mods had it's own special 'feeling'. The best way to test a mod is to play it at a LAN party with your mates and observe everyone yelling and screaming at each other in the heat of the game... that's what makes a great mod, IMHO.

2. Who makes mods?

Well potentially, you (since you're already reading this, duh). If you are interested in making mods because you love the feeling of capturing the flag with your buddies and you reckon you can contribute something to the quake community - great ! If you want to get into the games industry yourself, mods are a great way to showpiece your skills. Who knows, create a killer mod and you could be the next Zoid (he nows works on contract id).

If you want to make a mod and sell it, you're in the wrong ball park - mods can only be given away (read the license agreement). You can't distribute your mods on cd either, they can only be distributed electronically.

3. How do you play a mod?

You'll find a mod you like either on a webpage somewhere, or possibly in your server browser (in-game or external e.g. GameSpy). If it's a "server side only mod" then all you need to do is connect to the server (you don't need to download anything). Bang, you're playing! Most mods however require a client download... you'll need to download some stuff and extract it to your quake3\mod_name directory. (As with downloading anything, be careful!).

We might see future q3a support for auto-downloading .qvm's, but until then we're stuck with a manual download. Once the mod is installed, find a server running that mod and go play! To run your own mod, run C:\quake3\quake3.exe +set fs_game mod_name (substitute your drive letter for C:, I'll leave it off from now on).

4. What's involved in making a mod?

  • 1. A good idea
  • 2. C programming skills
  • 3. Knowledge of the q3a codebase
  • 4. Team members to complement you (mappers, modellers, etc)
  • 5. Go for it !

That's pretty much it. Get an idea, some coding experience and then get jiggy with your compiler. When you have created a playable version of your mod, ask your friends around for a LAN party to test it. If you find them screaming at each other ("You BASTARD !!!", "Get the flag, help me get the FLAAAG!" etc) then you've done well. Once all the bugs are out, release it on the net (contact hosting@planetquake.com when you're ready) so that other people can enjoy it. Pop up your own server if you can (or maybe ask a server admin to run your mod for a while).

5. Your very own mod!

So you make a mod, release it on the net, it kicks up a storm and you become famous in the quake community. It's happened to many people after making many great mods. I still get emails every other week or so from people saying "I played your quake2 mod, it's great my friends and I had a blast - thanks!"... that makes it all worthwhile.

But the road can be rocky sometimes - be prepared to get heaps of constructive criticism (especially if you release a mod without really testing it 100%). Be prepared to get stuck for days trying to nut out why your game is crashing. Be prepared to have team members quit on you. Be prepared to have to make choices between quake and other people in your life (yes it's a big commitment, I once lost a girl to quake [and yes, it was the right choice!]). But most of all be prepared to have HEAPS of fun !

... Still here ? Great. Now go get coding, and "keep it real". Mod Making 101 | Tutorial 2: Up 'N Running