[quake3] Python game code

Neil Toronto ntoronto at cs.byu.edu
Sat Nov 18 15:11:04 EST 2006

Neil Toronto wrote:
> What sort of interest is there for an option to code the game (not the 
> engine) entirely in Python?
> Advantages:
> - MUCH easier to code - Python is brain-dead simple, so that even 
> artists without programming background could make simple changes
> - Could provide hooks to run custom Python code from just about 
> anywhere (and mods could even inject their own hooks) - basically, you 
> could mod the game without replacing the game files, or run multiple 
> mods simultaneously
> - Could run Python code directly from the console to debug
> - Could create very complex game logic very easily
> I know this is going to rub some C coders the wrong way - but at a 
> higher level of abstraction, where you don't have to think about 
> low-level operations like memory allocation and pointers, you can 
> churn out very complex stuff very quickly. Of course, there's a price:
> Disadvantages:
> - It's slower than C
> I'm thinking of broader applications of the engine than just Quake 3 
> the game.
> Neil

To illustrate, here's the whole extent of a "slow rockets" mod:

import g_weapon

g_weapon_create_rocket = None
def create_rocket(*args, **kwargs):
    rocket = g_weapon_create_rocket(*args, **kwargs)
    rocket.vel /= 2
    return rocket

g_weapon_create_rocket = g_weapon.create_rocket
g_weapon.create_rocket = create_rocket

Place the script in a .pk3 file, somehow notify the server that you want 
it loaded (cvar?), and viola! You can even chain these little things.


More information about the quake3 mailing list