Basic Universe Simulator (BUS)

An interactive fiction framework written in Python

BUS is a small set of Python classes which form the basics of an interactive fiction (or text adventure) game. The code is short and hopefully clear. It's meant to serve as a demo of what Python can do, as well as a framework from which you might develop your own sophisticated games.

(For more serious games, you might want to use PUB instead.)

BUS includes a decent parser, which can handle compound commands such as "get the rock and put it in the sack then drop the sack and garbage". (Not that you'd ever type a command this long, but you could!)

BUS is based on object-oriented programming techniques; classes of objects in the game correspond to Python classes. BUS includes the following object classes:



BUS is still undergoing some development, so hang on tight! In particular, I may move some of the command methods to the objects themselves, rather than having them all in the Actor class.

Please check out the code -- it's rather short:

busparse.py
buscore.py

To try it out, enter Python and type the following commands:

>>>import busparse		# loads the parser module
>>>parser.test()		# test it out -- type some commands
In testing the parser, you're limited to a small set of built-in words -- please consult the code to see what these are.

The game objects and parser together are demonstrated as follows:

>>>import buscore		# load the core game classes
>>>thing.test()			# try it out
>look
Commands currently recognized by BUS include look, get, drop, put, and inv. You can also boss Bert around, e.g. Bert, go north.

The parser is case-sensitive. To exit either test function above, hit Control-C and press Return.


Please give me feedback by email to joe@strout.net.

[ Back to Joe's Python Scripts for Newbies ]


http://www.strout.net/python/bus/
Last Updated: 11/24/98 . . . . . . Joe Strout . . . joe@strout.net