[Reality] Containment - barriers to implementation

exarkun at divmod.com exarkun at divmod.com
Sun Apr 4 22:41:09 MDT 2004


On Sun, 4 Apr 2004 14:56:10 -0400, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:
>
> On Apr 4, 2004, at 1:33 AM, <exarkun at divmod.com> wrote:
> 
> >     We want to start a containment implementation.  Some things it 
> > should support include simple room/exit structures, cardboard boxes, 
> > lead boxes, glass boxes, and brass cockroaches.  It should also 
> > support an observation [sub]system of some sort, including both vision 
> > in the normal spectrum and in the x-ray spectrum ("See through lots of 
> > stuff, but not lead").
> 
> 
> Containment (and carrying) should also take into account some simple 
> statistics related to weight and size.  In Divunal mk 1, we also had 
> "weildiness", which was an abstract number indicating how comfortable a 
> given thing is to carry barehanded.  I suppose it represented how 
> complex and/or oblong a thing was.
> 

  I was thinking of dealing with such things in a manner something like the following:

    class BoringEuclideanObject(Adapter):
        __implements__ = IPhysical

        mass = None


    class BoringEuclideanContainer(Adapter):
        __implements__ = ICollecter

        capacity = 50
        contained = 0

        # ... find and more implementations ...

        def get(self, obj):
            """Try and make obj become inside self.
            """
            mass = IPhysical(obj).mass
            if mass > self.capacity:
                raise SomeKindOfException("Tooooo biiig")
            self.capacity -= mass
            self.contained += mass
            # Equivalent of .link()/.grab()

  The important bit being the adaption to IPhysical and the use of its attribute to determine whether containment can be achieved.  Weieldiness could be achieved the same way, by having the actor's wield method check whatever attributes of whatever component are appropriate.

> This might also involve some form of timed event.  For example, you can 
> pick up a certain amount of weight for 10 minutes, but then it gets too 
> heavy and you need to put stuff down.  Or, a particular pile of junk is 
> stable for a given number of minutes and then collapses.
> 
> This also implies some base stats such as strength on the 
> ITakeActor/IDropActor/IPushActor/etc implementor, which will hopefully 
> all be the same object...
> 

  Assuming everything I've written so far is approximately correct, I think this is a vastly simpler problem (at least for me) than the one regarding criteria discussed elsewhere in this thread.

  Jp



More information about the Reality mailing list