26286 total geeks with 3498 solutions
Recent challengers:
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 

Articles

GEEK

User's box
Username:
Password:

Forgot password?
New account

Shoutbox
MaxMouse
It's Friday... That's good enough for me!
CodeX
non stop lolz here but thats soon to end thanks to uni, surely the rest of the world is going good?
stabat
how things are going guys? Here... boring...
CodeX
I must be going wrong on the password lengths then, as long as it was done on ECB
MaxMouse
lol... the key is in hex (MD5: of the string "doit" without the "'s) and is in lower case. Maybe i should have submitted this as a challenge!

Donate
Donate and help us fund new challenges
Donate!
Due Date: May 31
May Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00
Contributors


News Feeds
The Register
"Leccy car biz
baron Elon Musk:
Thanks for the
$500m, taxpayers...
Apple cored:
Samsung sells 10
million Galaxy S4
in a month
Brit spooks bugged
Edward VIII"s
phones, records
reveal
Virgin Media slides
fat 10Gbps pipes
into Murdoch"s
BSkyB
China"s exposed
crack cyberspy crew
dumps "most" of its
kit
SAP in search of
autistic software
engineers who
"think different"
George Soros pumps
£50m into
fibre-gobbling ISP
Hyperoptic
Microsoft and pals:
Save the global
economy by NOT
ripping us off
Aha, I see you
switched on your
mobile Wi-Fi. YOU
FOOL!
What"s that Dell?
You"re out? HDS
punts pay-per-use
cloud storage
Slashdot
One-Time Pad From
Caltech Offers
Uncrackable
Cryptography
First Government
Lawsuit Against a
Patent Troll
Why We Should
Celebrate Snapchat
and Encourage
Ephemeral
Communication
Teens, Social
Media, and Privacy
Physicists Create
Quantum Link
Between Photons
That Don"t Exist At
the Same Time
Missile Test
Creates Huge
Expanding Halo of
Light Over Hawaii
3D Printers For
Peace Contest
Intel"s Linux
OpenGL Driver
Faster Than Apple"s
OS X Driver
Rough Roving:
Curiosity"s Wheels
Show Damage
Tesla Motors Repays
$465M Government
Loan 9 Years Early
Article viewer

Playing around with the Quake 3 Arena source code



Written by:ReKleSS
Published by:Domuk
Published on:2004-02-21 23:41:26
Topic:Miscellaneous
Search OSI about Miscellaneous.More articles by ReKleSS.
 viewed 20078 times send this article printer friendly

Digg this!
    Rate this article :
Like almost all of id Software's games, a SDK was released along with Quake 3. The SDK contains everything (including a compiler, but not an editor) that you need to start writing a mod for the game.
Note: To be able to try this out, you'll need a full version of the game. The demo doesn't allow you to run mods. You'll also need a working knowledge of C.

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!

Did you like this article? There are hundreds more.

Comments:
DeMoNiCoN
2004-02-23 13:01:16
Ah very nice ReK. I'll catch up with you later to see if you know anything else that can help me since I'm attempting to create some ET bots or failing that, a mod. Later~
ReKleSS
2004-02-24 09:57:18
No, ET bots would be extremely difficult... they come under the 'weird systemcalls' stuff - botcode is part of the engine, not the game. Go with the mod idea.
-ReK
DeMoNiCoN
2004-02-24 10:58:12
Awww ;) OK, I'll try to conjure up an idea of two for a mod
RavanDi
2005-04-21 14:37:01
any idea of hl mods like cs ?
Anonymous
2006-04-14 02:57:07
the point?
Anonymous
2007-12-30 07:07:42
nice, i will try to create a sof2 mod .
Anonymous
2008-01-05 08:32:07
problems while compiling game qvm (server side),
door_sliding doesn't have a spawn function
trigger_sound doesn't have a spawn function,

for all entities...
Anonymous
2011-01-05 04:21:09
QUAKE GAME SITE for Everyone!
Quake 1 , 2 & 3 Mods,Downloads,Files,Chat etc

http://quakepc.webs.com
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:


Blogs: (People who have posted blogs on this subject..)
Action
First one on Tue 12th Jan 10pm
Yaw, this is the first blog post, just to begin with something. Nice site here, cool features like OSIDrive, and so on. However, strange that an "OpenSource Institute" uses non-OpenSource softare to host its site (Windows and IIS). It's not correct... I t
bb
A Daily Profanity at dailyprofanity.com on Mon 21st Dec 11am
For anyone who likes viz, and roger mellies profanisaurus. There's a website called amusing daily profanity which dishes up a humorous profanity every day via rss, twitter email and a few other ways. Rather rude words, but very funny in my opinion,
hambone
Blog entry for Wed 25th Nov 7pm on Wed 25th Nov 7pm
wtf i can't do geek 12. I don't know what to do. i want to kill myself becuz of this
haziman
Blog entry for Mon 9th Nov 4am on Mon 9th Nov 4am
for all geekos out there...
echmil
fuck you all!!!!!!!! on Sat 7th Nov 11pm
jag har tjock med tyngate tråkigt-.-
goldie
Blog entry for Tue 5th May 6am on Tue 5th May 6am
import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; import java.io.*; import java.util.Properties; public class SENDMAIL { public void sendMail(String mailServer, String from, String to,
bb
Bubble Graph on Wed 11th Mar 12pm
I love this graph bubble graph http://www.osix.net:80/modules/folder/in dex.php?tid=28125&action=vf
ketan404
My online resume! on Mon 9th Mar 8am
It is here http://www.listoffreelancers.com/profile s/ketankulkarni Simple and clean design. I like this website. Ketan
macrocat
Blog entry for Sun 8th Mar 3pm on Sun 8th Mar 3pm
Another site with some challenges. Basically, I'm linking this to get a measly five points ;O. Hellbound Hackers
Nightscript
Parapsychology - Fri 19th Dec 5am on Fri 19th Dec 5am
Yes i'm crazy but heres what ive been thinking about and it seems more reasonable that a lot of reality. Note that this ties into parapsychology/psychokinesis research. Mind is not over matter. Thats the wrong state of thinking for sure. Look, this


     
Your Ad Here
 
Copyright Open Source Institute, 2006