[quake2] Quake2 and Lua

Nick Trout nick at rockstarvancouver.com
Wed May 14 13:55:19 EDT 2003

> > >I'm interested in embedding Lua in the Quake2 engine to play around
> > >with Lua scripting.

I got the latest code from CVS, mirrored your MSVC project workspace
structure, and built q2x. The software version runs just fine. I
couldn't get the GL version to compile because of a missing "GL/glext.h"
file. I can't seem to find this file anywhere.

I take it from a post you made on the Lua mailing list a while ago that
you want to replace the guts of q2x with Lua to perform all of the cvar
and command functionality. I could help with this if you like. It might
be best to phase in Lua replacement code one area at a time, e.g.:

 * replace cvar functionality (src/common/q_cvar.c) with access to Lua
tables which are read from config files, or set from command prompt.
There could be several ways of doing this, e.g., functionally or by
using Lua tables and adding metamethods.

 * replace cmd functionality with Lua calls (src/common/q_cmd.c) -
provide bindings to q2x core functionality. Should bindings be generated
automatically? I read you only want to use C which I can understand.

Here's where I need to do more reading... 

 * Create binding to edict (entity dictionary?) and other core game APIs
to allow recoding of AI in Lua. 

 * Put in code for creating mframe arrays from Lua tables, rather than
statically compiling into the game. Edict binding would allow control of
AI entities.

 * replace src/game/m_<creature>.c AI one at a time. This is a little
naïve and makes lots of assumptions. The codebase would probably need a
significant refactoring and plenty binding code in order for this to

Are there any details on the "luagame" module mentioned on the q2x
description page? Where were you thinking of drawing the binding line?

What might help your project quite significantly is a wiki. They are
great for discussing ideas, documentation, and retaining a history of
descision making. One could be set up for the whole Icculus site
(IcculiWiki?) or just for q2x (Qwiki?!) ? I very much like MoinMoin

And BTW, what a great game Quake is!


More information about the quake2 mailing list