Wednesday, November 28, 2007

Parsing, Schmarsing

(Hi, I'm James, and I'm one of the developers on PyMUD. I had Steven add me to the blog so I could insert my occasional quips about why Python is awesome, Steve Jobs needs to stop wearing blue jeans, and occasionally update on the project's progress)

Who would've thought writing a MUD would involve so much parsing?

Parsing user input to commands. Parsing world data. Parsing configs. It kind of just exploded, and soon we ended up with a 1000-line parsers module to handle the world and items XML. It got to the point of being so scary neither Steven or I wanted to touch it. Finally, we've begun cleaning it up, and I've already cut off nearly 250 lines. But hey, at least it's Python. I don't even want to think what this amount of parsing would've been like in a non-dynamic language.

After more than a year of quiet, we're finally advancing towards our Alpha 3 milestone. Items are functional for the most part, but the major stopping point before release is having a character class system. The code cleanup task is helping us get familiar with the code again, fix any bugs we may happen to run into, and prepare for the class / ability system.

Addendum by Steven:
As James pointed out, the parsers are probably one of the most important parts of the PyMUD system. We have an entire (huge) parsing module dedicated to extracting Object (NPC, Ability, Room, Item) data from the game's XML scripts. This is the one he was referring to. In addition to the sprawling XML parser, we have more parsers for user input and for parsing server configuration files. The latter is easy, more or less. The former is one of the more complex aspects of the system, and actually forms a basis for the entire NetChat Py-Client.

Both crucial parsers work fine in their current form, but they're becoming a bit of a mess to manage. Both need to be looked at a little more before we're comfortable plunging onward into the wilderness that is new content.