Will's blog

purpose: Will Kahn-Greene's blog of Python, Linux, random content, PyBlosxom, Miro, and other projects mixed in there ad hoc, half-baked, and with a twist of lemon

Thu, 04 Nov 2004

Twisted Reality

Every once in a while, someone emails me about Stringbean and wonders why I'm not working on it much. Stringbean is more like an LPMud than a MOO and would allow for in-game coding of objects in Python. I've been giving a few reasons of why I'm not really actively working on it:

Twisted Reality is a MOO oriented mud so it's got a different focus than Stringbean does. However, Twisted Reality is also attempting to solve another big problem I have with muds using Aspects.

The problem is this: you build a bunch of objects the player can manipulate (things like torches, swords, hammers, nails, screwdrivers, ...) and in order to add another way for the players to manipulate and modify these objects, you have to code manipulation/modification-handling code for every single object. What if you wanted to allow players to burn an object? Well, for every object, you'd have to implement burn-handling code.

You could implement this using multiple inheritance. Each object inherits from a object-type class (armor, weapon, container, ...) as well as a material class (iron, wood, organic, copper, glass, ...). The material classes could handle effects like burning. But what if you had something like an axe with a wooden handle and an iron blade?

Anyhow, it'd be easier if the burn code could be centralized into one place--an aspect. The stuff in the Reality mailing list is interesting enough that even though I haven't looked into it further, it's caused me to want to wait to research it more before I go work on Stringbean again.

Posted by Glyph Lefkowitz on Thu Nov 4 17:41:12 2004
Just thought I'd mention - we call it Twisted Imagination these days, since the new incarnation is fairly distinct from the older ones.  Unfortunately, the lack of any useful implementation has made it difficult to accrue any additional manpower, and vice versa.  If you are interested in it, please sign up for the mailing list (which hasn't changed names - that's how shorthanded we are, we can't change our mailing list's name) and ask some questions.  There are lots of open issues surrounding the current implementation and it would be good to get some help working through them.


Posted by Paul Wright on Sat Nov 6 20:05:05 2004
I've occasionally thought about MUDs and MOOs in Python. The lack of a restricted execution environment is a pain. While the Zope people seem to have come up with a way to prevent the os.system("rm -rf ~/*") sort of attack, they've not addressed resource exhaustion AFAIK.

I think if you really wanted to make it work, you'd have a separate process running the untrusted code which talked to the trusted codebase over some sort of RPC interface. You'd have a transactional database (like ZODB or something) for sticking your state in. Then if the untrusted process needs to be killed you just go back to the last checkpoint and re-spawn it. I wrote a blog entry vaguely about this at http://www.livejournal.com/users/pw201/33648.html


Posted by Tim Hoffman on Sun Nov 7 00:36:04 2004
Actually you should have a look at Zope in more detail. It does perform some levels of resource exhaustion prevention for TTW code. For instance it will trap infinite levels of recursion. It actually tracks and prevents recursion occurring more than 'n' deep (i think n is 20 by default).


Posted by Jacob Hallén on Sun Nov 7 18:29:50 2004
A simpler approach may be to start with an LPMud
gamedriver and swap out large parts. You'd put
in a Python interpreter instead of the LPC interpreter. You might toss the communications layer in favour of twisted.
This way your security model towards the OS of the
machine the server runs on would be a tried and
tested one. For internal, cross-class and cross-object security you would need the Python2.4 decorators to be able to do something with any reasonable syntax.


Please keep comments appropriate. I reserve the right to remove anonymous comments, flames, spammy, inappropriate, and other comments that I deem to be worth removing.

Note: New comments get placed in a "draft" status and will NOT show up on the site until I explicitly approve it. Usually that happens within 24 hours, but sometimes I go away and it takes a day or two.

Note 2: There is now a preview button for those of you who want to see a preview! However, it doesn't quite work the way you'd think it should work. I'll look into adjusting it some day.

Note 3: If you can't for some reason post a comment, send me an email: willg at bluesock dot org.

Your name:


Your e-mail address (this doesn't get displayed to anyone--I use it to contact you if there are issues):


URL of your website (optional):


Comment:


Yes, I am a human!

pyblosxom::2.0 dev

All contents Copyright 1996 to 2008 Will Guaraldi.
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.