[MUD-Dev] Object Models

Gavin Doughtie gavin at idealab.com
Fri Nov 24 22:28:26 CET 2000


>>> KevinL wrote:

> >>> Bruce wrote
> > Taking the example of a weapon, we might look at the case of a
> > sword.  Possible characteristics of a sword, in trying to model
> > how it interacts with its environment might include:
> >  * Can be wielded in one hand.
> >  * When used, it can inflict damage:
> >    * Slicing
> >    * Piercing
> >    * Blunt trauma
> >
> > Perhaps we want to allow the user to be able to sharpen weapons,
> > potentially allowing them to cause greater damage.  To do so, we
> > create a new action that can be carried out:  sharpen edge.
> > Sharpening an edge knows to look for the slicing behavior of an
> > object, and then seeks to collaborate with that behavior to carry
> > out its effect.  Doing so would allow the sharpening edge
> > behavior to work with -any- object that implements/possesses a
> > slicing behavior.  (In practice, we'd probably want to constrain
>
> So, I've got to ask:  How do you deal with the difference between wooden
> "edged" weapons, steel, lead, etc?  Do you design a separate behaviour for
> each, or do you mix behaviours with some sort of prototype/component which
> then get used by different objects?
>
> Or the difference between sharpening a sword, and sharpening a plough?  Do the
> objects themselves mix in their own attributes to modify the behaviour
> (ploughs being larger and presumably taking more time to sharpen)?

I would attempt to assemble a composite object in this case, with some implementor
of "edge", in turn containing a "material" property and methods like "sharpen" and
"cut". The whole assemblage (combat stats, etc.) might live under a more generic
"weapon" interface.

Seriously, you can go crazy with this stuff, but the whole point is to make things
easier for the user (programmer, world builder) to understand. In real life you
see much more "has a" than "is a subclass of" relationships among the objects you
encounter. You also tend to solve problems by applying prebuilt components (i.e.,
you don't manufacture your own drywall screws).

Gavin

_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list