Inside3D!



Getting Started

Introduction

Quake C is a programming language which John Carmack developed expressly for use with Quake. The semantics of the language itself resemble a stripped down version of C. Some Examples of Quake C modifications are new weapons, monsters, player skins, the possibilities are endless. QuakeC is every Quake Players dream come true...

What Do I Need To Get Started?

The first step is to download the QuakeC source code. You can find the QuakeC files here at Quaketastic.com, courtesy of Willem (mirror at DarkPlaces), or an altered archive of them featuring only what is necessary for multiplayer if you want a lean multiplayer mod without anything singleplayer here (mirror). The compilers of choice for qc are FTEQCC by Spike and FrikQCC by FrikaC.

What Do I Need To Edit?

Any text editor will most likely work, but beware Notepad's 64k limit on files. You will probably want something with syntax highlighting and line numbers, such as Justin Thyme's QCide, or a more mainstream editor like Notepad++ or jEdit, which already have syntax highlighting for C, which should be a fine catchall for QuakeC work.

Setting up

After you have edited a .qc file, and you have ran the compiler IN the src dir, you will find a file named PROGS.DAT In the /quake/mygame/ directory. You can then exit to the root Quake dir, and run Quake with the -game mygame command line, which will cause Quake to look for data in the mygame directory before falling back to id1. You can then play with the changes you have made.

Your Directory Structure

Your directory structure should then look like this...

  /quake/quake.exe
  /quake/id1/
  /quake/mygame/src/thecompileryoudownloaded.exe
  /quake/mygame/src/world.qc
  /quake/mygame/src/progs.src
  /quake/mygame/src/... etc ...

Comments

Comments are little notes used by a programmer in order to help others to understand their code. They do not affect the program at all if written correctly. There are two ways to denote comments in Quake C. One way is with doubles slashes (//). The double slash comment only works behind the slashes and on the same line. With every new line that you want a comment on you must include double slashes.
void () W_FireShotgun = // Hello this is a double slash comment
Another way to write comments are with the slash-star (/*). With this type of comment, every line after the /* is a comment until ended with */.
void () W_FireShotgun = /* Hello this is a slash-star comment This is still part of the comment */
When experimenting with the code, if you want to get an understanding of the impact of a line of code, simply comment it out and recompile, for example, here is the beginning of the fire rocket function:
void() W_FireRocket = { local entity missile, mpuff; self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
Now if we insert a double slash at the beginning of that last line, we will have:
void() W_FireRocket = { local entity missile, mpuff; // self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
The result? Infinite rocket ammo! Here you just told the compiler to ignore the line which removes a rocket from your ammo whenever you fire the rocket launcher. A lot can be discovered through simple omission of lines like this, or changing numeric values to see how the game reacts!

Operators and IF Statements

Operators are the little signs we usually find in IF statements. Signs like ==,>=,<, etc. here is a table of the important operators in Quake C:

== Equal to
!= Not equal to
= Becomes
>= Greater than or Equal to
<= Less than or Equal to
> Greater than
< Less than

The basic structure of an IF statement is as follows:

if (condition)
{
        True-part;
}
else
{
        False-part;
}

Variables to Know

Here is a table of the important variables to know in Quake C and what they are:

.health The health of an entity
.ammo_shells The ammo(shells) of an entity (must have prefix like "self")
.ammo_nails The ammo(nails) of an entity (must have prefix like "self")
.ammo_rockets The ammo(rockets) of the entity (must have prefix like "self")
.ammo_cells The ammo(cells) of an entity (must have prefix like "self")
.classname The classname of an entity (must have prefix like "self")
.origin The origin of an entity (must have prefix like "self")


Generated in 0.00587s
Copyright 1996-2005 Inside3D.com