From: baruch@nynexst.com (Robert Baruch)
Subject: Re: Generic Object Description
Organization: Nynex Science and Technology
Date: Mon, 6 Apr 92 13:37:01 GMT

In article <11223@mindlink.bc.ca> a3619@mindlink.bc.ca (Chris Harwood-Jones) writes:
>
>I have been dealing with that same problem in designing a computer RPG. Having
>just moved from a structured-programming approach to an object approach (and am
>redesigning from scratch), my current thoughts are far from sophisticated, but
>heres what I have so far:
>
>ROOT CLASS:  "Thing"
>        name
>        weight  monetary value
>        ability to withstand damage
>        how carried:
>                wearable (e.g. a coat),
>                carryable (e.g. a ball), or
>                liquid (e.g. a pint of beer)
>        how many (for object groups;  e.g. "20 arrows"
>        type (is this object a member of a special subclass?)
>
>SUBCLASS #1:  "Container"
>        capacity
>        percentage of carried items' weight negated
>                (i.e. Bag of Holding or suspensor field)
>        does it carry liquids or solids?  (i.e. wineskin vs. backpack)
>
>SUBCLASS #2:  "Armour"
>        protection type & value
>        hit location(s) affected
>
  <stuff deleted>
>
>--
>----------------------------------------------------------------------
>/ Chris Harwood-Jones        ************       a3619@mindlink.bc.ca /
>/                                                                    /
>/   "It means nothing; and it seems, so far as I can observe,        /
>/ useless to others."                                                /
>/                                                                    /
>----------------------------------------------------------------------

Well, this sort of thing is necessary.  I've looked at the object tables of
lots of adventure games, and they are all pretty much of the same type as
your system.  What I am looking for is a system which allows a programmer
to add on an object, and define its reactions to a finite number of 'action'
variables, which encompasses pretty much everything you can do with an
object.  These action variables could be considered primitives, from which
all other actions (or at least, most of them) can be derived.

For example, take a brick object.  A programmer adds this brick object to
the database of objects.  Later on some other programmer adds a hammer object
to the database.  I want the system so that even if the second programmer does
not know about the brick object, the brick will react correctly when hit by
the hammer -- the brick fragments into two or three smaller brick pieces.
So we could have a primitive 'impact', which would be programmed by the
brick programmer.  The brick programmer would say that soft impacts (such as
dropping from a height of a few feet) will not do anything.  Medium impacts
(the hammer) will fragment the brick into several brick pieces.  Hard impacts
(shooting the brick with a gun) will blow it into smithereens.  

So regardless of what object actually performs the impact, you can define what
happends to the brick.  Therefore, the hammer programmer would only have to specify
that when you say "Hit X with hammer", the hammer applies a medium_impact to X.
The object X then decides what happens to itself, additionally decided what to
apply to the hammer.  For example, if the hammer is a funky magic hammer made of
breakable glass, then yes indeed the hammer will shatter the brick, but the brick will
then apply a medium_impact to the hammer, shattering IT!

Some kind of physical-law engine would probably apply that rule mentioned above
automatically, and so you would in effect get a law that states, "Unless otherwise
specified, if X impacts Y to degree Z, then X will also have an impact of degree Z
applied to it."  The Every Action law applied to every object without any work!

--Rob