[q2x] Alive

Brian Hook hook_l at pyrogon.com
Fri Aug 8 22:31:54 EDT 2003


> I assume you mean in src/game, the m_* (monster?) and g_* (game?)

Right.

> I can see an object oriented style of C there. 

Sadly, if I recall, most of that was a straight translation of the QC 
stuff from Q1 then updated for the new monster types.

> is to make all of the behaviour data (script) driven rather than
> hard coded. 

Bingo.  In theory, Q2 is architected such that the entire game should 
be loadable from a DLL/script.  Unfortunately the reality so far has 
been that significant modifications still require changes on the 
client, which is just so wrong it boggles me.  But that's what happens 
when you have deadlines I guess (or when John doesn't write all the 
code =) ).

So my ideal universe consists of the following components:

raw client (no game specific knowledge)
raw server (no game specific knowledge)
client side game logic (cgame.dll in Q3 parlance)
server side game logic (gamex86.dll)
ref_gl (pure rendering)
ref_soft (possibly punting this)

Q3 achieved much of this via cgame.dll, but John opted to use a VM 
instead of a scripting language (not that I can fault him too much for 
that).  The downside is that making mods became much less accessible 
and portable.  Mods for Quake were immediately portable to all 
architectures because of QC.  Mods for Q2 and Q3 required someone 
recompiling for each target architecture.

Using a scripting language like Lua, you once again get portable mods, 
AND you get the beauty of using a language that is friendlier than C 
or C++ for newbies.

So all the m_* and g_* will eventually become Lua code.  There'll be a 
gamex86_lua.dll bridge that exports the same interface as the C DLL, 
but it then thunks/dispatches to the Lua scripting system for 
everything else.  I haven't worked out the specifics of how the 
bridging should work, but overall it should be fairly simple.

> there either. So all of the "service objects" that allow script to
> control the game will need to be exposed. How are you planning on
> doing this? Are you hand coding or using the newly released tolua5?

I think hand coding is best, if for no other reason than to make me 
acutely aware of what is being transported back and forth between Lua 
and the game.

Brian





More information about the q2x mailing list