[Twisted-Python] upon further consideration...

Nick Moffitt nick at zork.net
Mon Apr 2 03:31:04 EDT 2001


begin  Glyph Lefkowitz quotation:
> Nick, I think you're right.  I'm going to scrap the verb-oriented
> dispatch system for something MUCH more like Inform's style.  I'm
> still working out the design, but when I've got something
> substantial, I'll post again.

	Good heavens.  Well I must admit that my earlier messages were
driven largely by naivete rather than pure technical prowess.

	I've been playing with twisted-python more and more lately,
and have been trying to build a smallish game.  As such, I think I'm
getting a feel for what you had in mind pre-0.8.x, so let me post what
I was thinking about the nasty verb problem (goddamn action-oriented
structures in an object-oriented world!).

	I had thought about your verb-based dispatch system, and
decided that before I'd sit down and read your code, I'd think about
how I would implement such a beast.

	I decided that all basic verbs would be implemented in the
direct object.  As such, that meant that the parser would identify the
DO rather than the verb, initially, and then go looking for the object
that represents the DO.

	The search pattern for a sentence with no DO ("Shoot at
dalek") would be actor, actor's contents, and the contents of actor's
location.  So you could have a player with laser-eyes, a handgun, and
a nearby trebuchet, all capable of "shoot"ing, but the laser-eyes
would win out unless a DO was specified.

	Indirect objects would have a special kind of verb form for
"catching" actions performed by direct objects.  They'd accept the
sentence's DO as the subject, as well as any prepositions (to know if
you're putting the coin IN the piggy bank or merely ON it).	

	Pre- and post- hooks are easily done by overloading and
putting code before or after you call your parent's version of a verb.

	Anyway, this is largely cafe musing, but I had diagrammed out
the traditional "throw rock at dalek" scenario and it seemed to make
sense. 

	I'm sure there are better ways to merge the handling of verbs
with python's object system.  It is kind of neat to just read through
an object and pull out functions that match a simple pattern.

	Left unadressed was the synonym problem (making "examine" and
"look at" synonymous in the general case), though I doubt it's that
complicated.

	

-- 
You are not entitled to your opinions.
 
	01234567 <- The amazing indent-o-meter!
        ^	    Matt McIrvin: the Nikola Tesla of tab damage.





More information about the Twisted-Python mailing list