Legacy 5 Thoughts
Go to Root Class Object
Internal Inheritance
Object inheritance
Root Class -- Object
This object is inherited by all other objects in the system. Its
purpose in life is to serve as a common ancestor for container classes
to hang onto, and to provide the minimum required functionality for
all objects. This includes a few methods and flags -- load time of the
object for purposes of garbage collection, unique identifier, object
type id, attribute list(s), and method pointers.
An attribute list must contain the following methods:
- Create/Destroy list
- Insert into list; overwrite on demand
- Query from list
- Key existance check
- Traversal
Furthermore, the Object provides methods for writing out (serialization)
and reading back in an entire object, to the Storage Medium [tm].
Source level class inheritance
Some rudimentary inheritance occurs in the source code. All game
objects descend from the root class Object, whcih has no parents.
A Player, is a Living, is a Object, for instance. A Room is a
Container, is a Object. I really hope Guile can be embedded into C++,
else I'll have to fudge something.
Object level (game) inheritance
The game tracks object relationships; this is needed for memory efficiency
and to keep game mechanics simple. When a Room pops, its contents are
found and they are also popped. A popped object is merely a reference
to its Template. When a change is attempted, that template is copied (or
its relevant portions copied). We therefore have object inheritance
so that (say) a Priest could be descended from a Human, descended from
some basic Living which knows how to wander, etc. This promotes code reuse
and keeps design clean. However, a Priest must have a template object
defining all of this -- when a Priest pops, its a coy of the template.