Archive for December, 2006

Python: Now with less stack

Tuesday, December 19th, 2006

This past week I rediscoverd an article about Stackless Python and decided to try it out. Stackless Python implements continuations, which are hugely powerful for game scripting. I wrote up some simple game objects with Stackless and I am thoroughly impressed.

Others have covered Stackless Python better than I could, so I’ll point you to them. There is a great overview of Stackless Python for games on Thoughts Serializer. From there it’s a quick jump to Introduction to Concurrent Programming using Stackless Python. And, of course, there is always the Stackless website.


Auto API
I have always wanted a scripting system that automatically exposes it’s own API. Years ago I was using Radiant to build geometry for my game engine. Entity properties were defined in an obscure file somewhere with an arbitrary language. The editor used this file to create widgets for the properties of an entity. With the entities hidden away in compiled C code it would be difficult to do any processing to automatically generate this information. It could be done with access to the source code and a custom built parser, but with Python it’s even easier.

Python can interrogate classes for documentation information, method names, and even method arguments. But with a little extra work it is possible to specify information about the arguments beyond what can be gleened from python’s function definitions.

Information such as the range, type, or simple documentation of an argument cannot be specified in a standard python function definition. I created a system that uses doxygen style commands inside method doc strings to add this information. For instance:

def Action_Open(self, rate=1.0):
"""
@doc   Opens the door over time.
@param rate [float]
Rate of speed to open the door.
"""

The documentation system parses this file, grabs the Action functions, and parses doc strings to associate type and documentation with each method parameter. The information can then be used in a tool to create input elements specific to the entity. My goal is to get this information into Maya so that script events can be attached to objects and message handlers written on scene nodes.

Congratulations

Tuesday, December 19th, 2006

Congratulations to Mick Beaver who was hired as Raven Software‘s new Build Process Engineer. It’s a great opportunity, and I’m sure he’ll gain a lot of great experience from his time at Raven. Amongst his myriad new job duties is to “manage data management systems,” which made me titter.

Congratulations, Mick!