QuakeC is a C-like language the drives most of the "intelligence" of Quake 1.

The monster AI (or lack of), weapon and item control, animation, and most other things that take place are controlled in QuakeC. id Software released compilers and their QuakeC code, which allows people to write really cool mods (like Capture the Flag).

QuakeC is not very C like. It is c-like in syntax, but c++ like with objects, pointers etc. It doesn't go the full object-oriented hog, though. It has no concept of classes, and there can be only 255 objects (entities), which all actually exist in the quake map. Entities can be set to run functions at a set time, or upon collision with other entities. All code is global, though, so entities can't have private functions. Quakec compiles to byte-code in the same way as java, producing a single linked progs.dat file. Every progs.dat is a complete program, so (unlike doom), mods can't be merged.

There are some nice specialist features that help with 3d manipulation. Vectors are a primitive type, and can be added and multiplied easily. The normal to a surface is also trivial to find. Vectors can be postfixed with _x, _y, _z, and their components treated as floats.

QuakeC is however missing a few basics, essentially because id didn't need them to create quake. String concatenation, for instance. Painkeep is famous for constructing its menus using about 15 million if statements. QuakeC is also missing any form of array (meaning more nasty if statements). FrikQCC makes use of the byte-code nature of qc to hack string concatenation and arrays in without requiring a modified version of quake. nice.

QuakeC always compiles with debug-information built in. Quake actually makes use of this, catching illegal operations and runaway loops, and producing a stack trace (I've yet to see another language that catches runaway loops...). It also means that progs.dats can be easily decompiled to produce meaningful source code. There are programs availible to replace the debug info with random characters. But that's immature. id were nice enough to give you all this source code for free. Don't hide yours.

Log in or registerto write something here or to contact authors.