[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 1.2 Concepts

Every object within the game world is represented by an entity. This includes the world itself and all the objects within it, such as players, non-player characters, items and cameras.

The base Crystal Entity Layer Entities are managed within the Physical Layer. These basic Entities cannot do very much at all as they are. In order to add functionality one, or usually more, Physical Layer Property Classes are added to the Entity.

Property Classes are used to provide specific attributes, functionality and constraints to Entities and also provide the interface with the Crystal Space library. This may be a simple attribute, such as allowing an entity to store it's weight, or it may provide more complex functionality such as receiving input from the keyboard or drawing a 3D object such as a mesh. The set of properties provides by all the property classes together defines what the entity really is, and what functionality is provided.

Property Classes are added to Entities at run-time. What this means for the developer is that if required Property Classes can be added, or removed, from Entities on-the-fly.

Property Classes are generated by Property Class Factories. These are usually implemented as a Crystal Space plugin. This means that you load the plugin, and then invoke the plugin as required to create property classes.

The Physical Layer is also responsible for providing the Persistence Layer. This is a system that is responsible for being able to save and load the state of each and every Entity. This may be a file on a disk, or to some form of database. Single-player games would use this to provide save-game functionality for example.

The Behaviour Layer handles things such as game logic. It is this layer that dictates how an Entity will behave within the constraints placed upon it by the Physical Layer.

The Physical Layer is able to generate events, which are passed to the Behaviour Layer in order to be acted upon. Examples of such events are when an Entity is clicked on by the mouse pointer, when a particular key is hit or when an item is added to an inventory. Such events are usually generated from within the Property Classes when a predetermined set of conditions is achieved.

The majority of the Behaviour Layer may be implemented in a scripting language such as Python if this is suitable for the project. This allows the behavior of Entities to be easily scripted without having to recompile the entire project, and also for new behaviours to be added in the same manner.

In summary, Crystal Entity Layer is made up itself of two layers, these being the Physical Layer and the Behaviour Layer.

The Physical Layer is responsible for all managing base Entities, providing the Property Class system to manage attributes, functionality and constraints to Entities, to prove a system for the Property Classes to communicate with the Behaviour Layer and to provide a Persistence Layer in order to be able to load and save Entities to some form of storage.

The Behaviour Layer is responsible for managing how Entities behave within the restrictions placed up on by the Physical Layer. This may be implemented in C++, or it may be implemented in some form of scripting language.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.