[Reality] Containment - barriers to implementation
exarkun at divmod.com
exarkun at divmod.com
Sat Apr 3 23:33:06 MST 2004
Summary of conversation on IRC tonight:
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").
The major point of discussion was over who should be responsible for knowing that x-rays pass through cardboard and glass, but not lead, and that human-visible spectrum light passes through glass, but not cardboard or lead.
A good answer seems to be that a materials system should be responsible for knowing this. This appears to require a change to imagination.simulacrum.collect(). The current Look action is implemented only in terms of the IDescribable interface (possibly a mistake, but probably unrelated to the real issue). With the current imagination.simulacrum.Container implementation of ICollector, there is no way to have Look bypass all barriers in the object graph (such as a closed cardboard box) and filter the result based on some containment system.
The main idea discussed to make this possible was the addition of a second criterion, for use with ICollector.more() (whereas the current criterion is used with both, though the current implementation uses it only in find()). As an alternative to adding a second criterion, it also seems possible to change the current criterion to an introspectable object (*not* a Componentized, as radix suggested in an attempt to fry my brain) which would provide enough information to filter both collectors/more and implements/find in semantically different ways. This preserves the existing interfaces, more or less, and forces us to fix criterion sooner rather than later, so maybe is a better solution.
So! What does all this mean? Perhaps something like this:
class Look(TargetAction):
....
def doAction(self):
....
if usingXRayVision:
c = collect(self.target, IDescribable,
# Only implementors that are lead can actually be seen
lambda o: IMaterial(o).type == 'lead',
# Only collectors that are lead cannot be seen through
lambda o: IMaterial(o).type != 'lead',
2)
else:
c = collect(self.target, IDescribable,
# All implementors are visible
lambda o: True,
# Open and transparent containers can be seen through
lambda o: not ICloseable(o).closed or IMaterial(o).type == 'glass'
2)
....
Does this seem to be at all on the right track?
Jp
More information about the Reality
mailing list