QuakeC

QuakeC
Paradigm imperative (procedural), structured
Designed by John Carmack
Developer id Software
First appeared 1996
Typing discipline static, strong
Major implementations
Quake C Compiler, FastQCC, FTEQCC, QCCx, GMQCC
Influenced by
C

QuakeC is an interpreted language developed in 1996 by John Carmack of id Software to program parts of the video game Quake. Using QuakeC, a programmer is able to customize Quake to great extents by adding weapons, changing game logic and physics, and programming complex scenarios. It can be used to control many aspects of the game itself, such as parts of the AI, triggers, or changes in the level. The Quake engine was the only game engine to use QuakeC. Following engines used DLL game modules for customization written in C and C++ from id Tech 4 on.

Overview

The QuakeC source to the original id Software Quake game logic was published in 1996 and used as the basis for modifications like capture the flag and others.[1] QuakeC source code is compiled using a tool called qcc into a bytecode kept in a file called progs.dat. The programmers of Quake modifications could then publish their progs.dat bytecode without revealing their source code. Most Quake mods were published this way.

QuakeC allowed the Quake engine to dominate the direction of the first-person shooter genre. Thanks to Carmack's idea of extending video game life by adding unlimited expandability (extensibility already played a big role in Doom), an enormous Internet community of gamers and programmers alike has arisen and many modern multiplayer games are extensible in some form.

QuakeC is known as interpreted because as Quake runs, it is continually interpreting the progs.dat file.[2]

Limitations

The syntax of QuakeC is based on that of the C programming language, explaining its name, but it does not support the implementation of new types, structures, arrays, or any kind of referencing other than the "entity" type (which is always a reference). QuakeC also suffers from the fact that many built-in functions (functions prototyped in the QuakeC code but actually defined within the game engine and written in C) return strings in a temporary string buffer, which can only hold one string at any given time. In other words, a construct such as

SomeFunction (ftos (num1), ftos (num2));

will fail because the second call to ftos (which converts a floating-point value to a string) overwrites the string returned by the first call before SomeFunction can do something with it. QuakeC does not contain any string handling functions or file handling functions, which were simply not needed by the original game.

Most video games at the time had their game logic written in plain C/C++ and compiled into the executable, which is faster. However, this makes it harder for the community to create mods and it makes the process of porting the game to another platform (such as GNU/Linux) more costly.

Despite its advantages, the concept of implementing the game logic in a separate scripting language and writing an interpreter for it was soon dropped (even by John Carmack who had implemented this concept) because of the overall inflexibility of an interpreted language,[3] the increasingly complex game logic and the fact that the game logic could be packaged into a native dynamic link library whose source code could be released to the mod community.

Modified compilers and language extensions

As is their custom to do with nearly everything they make, id Software released the source of qcc, their QuakeC compiler, along with the original QuakeC code in 1996. Modified versions soon sprung up, including Jonathan Roy's fastqcc and Ryan "FrikaC" Smith's FrikQCC. These added functionality, optimizations, and compiling speed boosts.

In 1999, when id Software released the code from Quake's engine under the GNU General Public License (GPL), the workings of the bytecode interpreter were examined and new QuakeC compilers were released, such as J.P. Grossman's qccx and a new version of FrikQCC. These compilers took advantage of newly discovered features in a backwards-compatible way so that the bytecode could still be properly interpreted by unmodified Quake engines. New features include arrays, pointers, integers, for loops and string manipulation.

With the Quake engine source code now able to be changed, further features were added to QuakeC in the form of new built-in functions. Features long yearned for by QuakeC coders finally reached realization as QuakeC now had file and string handling functions, enlarged string buffers, more math functions, and so on. However, programmers taking advantage of these changes lost backwards compatibility with the unmodified Quake engine.

Xonotic since version 0.7 uses the gmqcc compiler.[4]

Client Side QuakeC (CSQC)

Some enhanced Quake engines (notably Darkplaces and FTEQW) have support for an extension of regular QuakeC (now commonly referred to as Server Side QuakeC or SSQC) that allows client side only scripting of the Quake engine. This is especially useful for GUIs, HUDs and any visually heavy effects that do not need to be simulated on the server and transferred over the network.[5]

See also

References

  1. Lasse Lehtinen (1996-07-25). "QuakeC released". Quake and QuakeWorld history. Retrieved 2011-01-14.
  2. Andrew Wu. "Quake C Basics". Retrieved 2013-04-06.
  3. Carmack, John (13 March 1997). "Here is a technical issue to be discussed". .plan. id Software. Retrieved 20 August 2009.
  4. Xonotic 0.7 Release
  5. "Client-Side QuakeC". QuakeWiki. Retrieved 2016-11-16.
This article is issued from Wikipedia - version of the 11/16/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.