[Twisted-Python] Reality Servers

Glyph Lefkowitz glyph at twistedmatrix.com
Tue Sep 4 05:39:16 EDT 2001


On Mon, Sep 03, 2001 at 09:41:31AM +1000, Chris.Hadgis at mincom.com wrote:

> ... broadcastToPair() sends the message to all containers 
> associated with the figure's current location. If I leave the figure where 
> it is, the containers are 'Room'. But when I take the figure the 
> containers are 'Guest' and 'Room'.

Yep, that's right; and it should remain so.  It's important to be able to
determine the 'real' position as well as the other positions of an object.

> My proposed solution is to not include the location's containers in the 
> container list. I am not sure of all of the effects of doing this. I know 
> when I do this that I get the messages once whether I have taken the 
> figure or not. I don't know how to test this with multiple players :( on 
> Win98. And I don't know the code well enough to understand the logic 
> behind it.

I'd say that this is the wrong solution.

> I also think the set of broadcast routines should be standardised, 
> especially at this early stage. That way, there will be some standards for 
> TRDemo and Inheritance as well as any future games. Some broadcast 
> routines just call others.

Yes.  Those routines have been through more revisions than any other code I've
ever worked on, and mostly before I got exposed to the 'simplest thing'
doctrine of XP, as is probably obvious :).  The single-broadcast proposal you I
responded to in my other email seems like a good solution to that, and it
should not require making any changes to the placement code.

Such a unified 'broadcast' ought to collect all the objects in all the
locations that the object is present in, uniquify that list, and *then* start
broadcasting; I was still starry-eyed from reading too many lisp textbooks and
wanted to do everything recursively before :).  Iteration is better suited to
this problem, I think.

> I do have plans to port the more common IF examples to TR (Golden Skull, 
> Alice In Wonderland) and perhaps the Greedy Gargoyle from PUB :) when I 
> run out of things I wish to do to TR.

Cool.  Those ports would be nifty :)

> The 'drop' routine for the figure also needs some work. If I drop it when 
> I don't have it, I get the message (the self squeaks). If I take it and 
> drop it, I don't get the message. All that is needed is a test to see if 
> the current location is a guest and broadcast the message then. I don't 
> know why there is a call to InappropriateVerb after the message.

Feel free to fix it.

It raises InappropriateVerb because that means "Keep going and looking for
other verbs called 'drop', then do that."  "Inappropriate" might be an, erm,
inappropriate word for that. :-)

However, there were plans at one point to replace as many verbs as possible
with 'action' methods, that would be called as pre/post on multiple objects and
somewhat more special-cased as in Inform, and relegate the verb_xxx methods to
parsing.

I still think this is a good idea but don't really have much time to implement
it.

BTW: If you're going to be patching code, I recommend downloading the newest
TRDemo and Inheritance code, as I've modified them to be Twisted Plugins and
modified their README's accordingly.  More documentation forthcoming.

-- 
                      ______      __   __  _____  _     _
                     |  ____ |      \_/   |_____] |_____|
                     |_____| |_____  |    |       |     |
                     @ t w i s t e d m a t r i x  . c o m
                     http://twistedmatrix.com/users/glyph





More information about the Twisted-Python mailing list