Theory and documentation
Version history and plans
Last updated: 2004-02-27
The object/item framework
Introduced in: 0.0
Developed by: Treefinger
Latest iteration in: 0.2
Latest iteration by: Treefinger
The object/item hierarchy work in two layers. The first layer is
the object hierarchy, containing basic functionality for graphics and
movement. The second layer defines items and flyweights for using these.
The object hierarchy
The object hierarchy is only composed of two general classes:
The graphical object is the mother of all graphical objects in the game.
Each object can have (but is not bound to have) an associated
Sprite. All objects also has a weight and a
dimension. This allows for some "physics" to be declared for all objects.
The Moveable graphical object is simly an object with the added
functionality to allow moves and actions. It has a location, a facing and
a heading. This object is also responsible for updating its own position.
This is to allow for different movement schemes (how a car moves in
contrast to how a character moves).
The item hierarchy
The item hierarchy is somewhat special, it contains "general" objects and
then specialized "flyweights". This is because one can divide items into
"classes" and then just make minor adjustments to this "class" to gain
a specific item. Thus, a general class defines all common attributes for
an item; graphics, name, description, attributes etc. The Item and
respectively the Clothes class are instantiations of this class of item
in the world. An item can also be a container and then contain other
Defines combat attributes and container attributes. Each instance of this
class denotes not just an item, but a class of items. For example:
short swords, lamps, etc...
This is a class of items that someone can wear if they have certain body
parts. This includes armour. For example: Trousers, chainmail, etc...
An instance of a class of items.
An instance of a class of items that can be worn.
An interface to define that this class can contain something else.
A convenience class that keeps track of weight and volume of an item that
can contain something else. Only items that are defined in the general
class contains a container class.