Since returning from the WikiMania2005 conference I have this idea of enabling the Moin wiki to act as a simple Multi User Dungeon.
I never did any MUD-programming myself, so I don't know how hard it is or how easily accessible the datastructure is. So this thing can be considered merely experimenting.
Please feel free to contact me, if you're interested in contributing your ideas.
Current state
Currently there is a Parser, called "SUD" (sud.py). For installation just copy it to your plugin/parsers directory.
Using SUD works like this:
- Each page belongs to a "zone". Define it as a pragma of the page, otherwise it will be the pagename itself.
- The zone must start at least with the name of the topmost page. So everything under one page can share the same zone.
- SUD will create an inventory-and-status file in the user directory. In it, it will save one inventory and a list of status values for each zone. Changing the zone will reset the inventory to empty.
Using the {{{#!sud }}} syntax, you can declare some code in python for the page. The API is very restricted and file-access is not possible. In this code block, the page can check and edit the inventory and maybe redirect to another page.
Example
Page: FabianHouse
#pragma zone FabianHouse {{{#!sud # Nothing here }} } You are standing in front of a beautiful house. A ["/Door"] leads into it and a ["/Doormat"] welcomes you with the words "No door-to-door selling!".
Page: FabianHouse/Door
#pragma zone FabianHouse {{{#!sud if status == "opendoor": redirect("Inside") elif inventory.has_key("doorkey"): inventory.del_item("doorkey") status = "opendoor" redirect("Inside", u"The key fits - you open the door.") else: redirect("../FabianHouse", u"The door is locked.") }} }
Page: FabianHouse/Doormat
#pragma zone FabianHouse {{{#!sud if inventory.has_key("doorkey") or status == "opendoor": msg = u"It's just a doormat." else: inventory.set_item("doorkey", "on") msg = u"There is a key under the mat!" redirect("../FabianHouse", msg) }} }
Future plans
That part is very basic, as you can see. Anyway, it should give you the idea.
Currently I want to (learn and) use AJAX to make things funky.
- A simple chat module (which would be usable outside of this SUD/MUD thing) should enable chat-per-zone.
- Descriptions that do not require a sub-page. More info in the next section
AJAX descriptions
AJAX is very simple, it's just a HTTP-request via javascript.
When clicking on "look" and the on any word in the text, which is inside a span tag with an onclick-event, the client javascript will request e.g. the ?action=mud of the same page and request the description for that word. The response will be set into a message-field on top of the page
Please
add your ideas, opinions and suggestions here.
I ever said that Linux (and Python) is a text adventure, but this gives it another dimension. -- ThomasWaldmann 2005-11-13 16:04:06