Hexinverter ¬ Project Introduction: PYOO - A library for Text Adventuring

Project link: https://github.com/chaomodus/pyoo

I wrote a MOO. Well sort of, something based on, in may ways, a MOO. Something with the feel of a MOO. A library for text adventures, in Python.

The system is implemented as a parser for commands, along with a set of classes that participate in a protocol with the interpreter (through their methods being marked up a certain way, thanks to a little metaprogramming and a decorator). The set of classes include a simple room system and a way to load a textual description of rooms and create a set of objects representing them. I hope to extend the loader complex to include basic loaders for a variety of objects and being able to pre-populate the rooms with specified objects.

The biggest challenge was how to manage interpreter context within the system. I'd originally designed the whole thing to be moderately interpreter-indepedent, and there are still traces of that in the sort of build-your-own feel of parts of the system, but it turns out that moving between rooms, for example, requires some mediator or ability to look up objects, and this is logically placed in the interpreter. Now the interpreter does a slightly naughty thing of adding itself as a member to the contained objects, and presenting a small API to those objects for, for the time being, looking up objects and moving between rooms. It could provide other useful services also, but it hasn't come up in the simple examples I've created thusfar.

I've included some examples, I'm proud of how short the code for testrooms.py is, since it presents a fully navigable text adventure space (which is currently empty).

I hope in the future to integrate this into my game suit, PyBoop (which is currently only a 2d engine but I don't feel that text adventure tools are outside of its scope). I intentionally kept this library decoupled from its output so that semigraphical games and games with portable graphical text rendering could be created.