A category is a collective grouping of a type of thing. For example a table could be
defined by a category.
Categories serve several functions within the game.
- They serve to provide a generic set of objects, designable by a world author, and
useable and extendable by any other authors. An author can create a category, base it on
an existing category and specify an instance of such an object in a game world. In the
game world, the author only needs to specify items about the object that are non-standard.
- They provide templates to speed the loading and storage of data as only the category
name and the differences need to be stored and retrieved. This in turn reduces the effect
of lag as it lowers the amount of data that needs to be transferred across the network and
allows pre-loading of data.
- A category is a way of classifying specific instances of an object into generic types of
objects. When displaying information about a specific thing, they key differences between
the particular thing and the category it belongs to are used to provide the description of
the thing. For example: a description would say "a big kettle" if the kettle was
bigger than the "normal" size of a kettle according to the cultural expectations
of kettle size. Conversely user would see "a kettle", rather than "a
normally-sized kettle".
Categories represent nouns in the English language.
Categories define a generic set of capabilities, characteristics, and components that
are required to have a thing. This means that the game author does not need to redefine
this set of items every time a new item is required.
For example:
A table has as its components 4 legs and a bench.
The table has definable characteristics of construction material, size and carrying
capacity.
The table has capabilities of: carrying other things, hitting other things.
Creating categories
Categories are loaded from a ".category" file. The loader looks initially for
a file defined by the [game name].category.
A category file can point to other category files, using the "INCLUDE" tag,
to make the files more manageable. This also allows the inclusion of category files
created by other authors.
Categories are defined using the following syntax:
Category Title
The category title describes the fact that the definition is for a category and the
name of the category.
Category: [category name]
Category Attributes
subclass of [Category Name]
This describes the position of this category in the inheritance hierarchy. There is a
special word here none. This means that the category is the top category.
Within the game data files, the first category should always be the top category. Any
categories subsequently marked as "none" will be ignored.
plural is [String]
This provides the plural version of the name if it is different from the singular
version.
mandatory components [Category Name],...[Category Name]
This provides a list of components that must be present for the object to be in
existence.
When a thing of these types is creates, the components provided and in this list are
added to the set of mandatory components for the thing.
If any of these components are removed, then the thing ceases to exist.
optional components [Category Name],...[Category Name]
This provides a list of components that may be present for the object to be in
existence.
mandatory characteristics for construction [Characteristic Name],...[Characteristic Name]
This provides a list of characteristics that must be present for the object to be
created.
mandatory tools for construction [Category Name],...[Category Name]
This provides a list of tools that must be present for the object to be created.
mandatory characteristics for deconstruction [Characteristic Name],...[Characteristic Name]
This provides a list of characteristics that must be present for the object to be
disassembled.
mandatory tools for deconstruction [Category Name],...[Category Name]
This provides a list of tools that must be present for the object to be disassembled
Category components
A category can have the following components. The order is not important.
- Characteristic
- Capability
Examples
These categories are based loosely on the word-net hierarchy of nouns. I have used the
old Booch OO notation show inheritance, but to identify that the inheritance is
implemented in the interpretation of data rather than the inheritance of Java objects.
See also: Full list of
default world data files.
Category: Thing
The top category is called Thing.
All objects in this world are a type of thing.
subclass of none.
Characteristic: sex
I have put sex here because some languages assign sex to items that have no sex. This
makes it a universal attribute. (Remember to create the state machine for this. values are
male, female, hermaphrodite and neuter)
Category: Conceptual thing
Represents a concept or an idea in this world.
subclass of Thing.
Category: Physical thing
Represents a real thing in this world.
subclass of Thing.
Characteristic: life time model
The life time model is a reference to a model for the likely failure of the thing.
There are 2 general models here. The first is a failure percentage chance the second is a
number of uses model.
type is state-machine
state-machine is life time model 1
Characteristic: X Location
type is real
Characteristic: Y Location
type is real
Characteristic: Z Location
type is real
Characteristic: bounding-Shape
type is polygon
Capability: hit
Category: Abstraction
An abstraction represents a concept realisation of a physical thing.
subclass of Conceptual thing.
<Characteristics>
Thing(Physical Thing) abstraction-Of
category-Name value is "Abstraction"
Category: Idea
An idea is a thing that has no equivalence in a physical thing. For example: anger.
subclass of Conceptual thing.
<Characteristics>
category-Name value is "Idea"
Category: Object
An object is a physical item.
subclass of Physical thing.
<Characteristics>
category-Name value is "Object"
real mass, default value is 0
<Capabilities>
hit
Category: Wave
A wave is a flow of energy through a physical media. For example: sound and light.
!wave particle, wave front!
subclass of Physical thing.
<Characteristics>
category-Name value is "Wave"
<Capabilities>
launch
Category: Space
A space is a representation of boundary implementing a context boundary.
subclass of Physical thing.
<Characteristics>
category-Name value is "Space"
Object Model
The object model for categories is basically the same as that for things. The major
difference is that the hierarchy of things is a inheritance tree where as in Things it is
a containment tree. Also, each category should only exist once, where as there can be many
things actually implementing the one category.
Categories are constructed from a tree where each category, except the top category,
inherits characteristics and capabilities from the higher level category.
Categories are described by a set of characteristics. A default characteristic should
be provided.
Categories have a definitional set of capabilities.
Categories have a defined set of components, some of which may be optional. These
components are in themselves categories. For example: a cap is an optional component of a
pen.
Adding a component does not create a new component. Rather it points at the specified
category as each separate category is in effect a singleton.
Category.Java
contruction Failed
Excpetion.Java
Using Categories
This section describes how to use a category, as a template, to create an actual object
within the game world.
mandatory versus optional components
Care needs to be given to the selection of mandatory and optional components as this
will have a significant impact on the play of the game. Generally you should use the
smallest possible set of mandatory components. For example, A car that does not have an
engine is still a car, albeit a broken one. This makes an engine an optional component.
You should provide a state machine in this case to indicate the state (working or
otherwise) of the car and disable the capabilities such as drivable.
|