Dating and game players

GAME ENTITIES Different games have different requirements as to what is needed in a game entity, but in most games the concept of a game entity is quite similar.

A game entity is some object that exists in the game world, usually the object is visible to the player, and usually it can move around.

Some example entities: TRADITIONAL DEEP HIERARCHIES The traditional way of representing a set of game entities like this is to perform an object-oriented decomposition of the set of entities we want to represent.

dating and game players-46dating and game players-26

This has the benefit of the functionality being available to all derived classes, but has the downside of the associated overhead also being carried by those classes.

Even fairly simple objects such as rocks or grenades can end up with a large amount of additional functionality (and associated member variables, and possibly unnecessary execution of member functions).

Often, the traditional game object hierarchy ends up creating the type of object known as "the blob".

Refactoring Game Entities with Components Up until fairly recent years, game programmers have consistently used a deep class hierarchy to represent game entities.

The tide is beginning to shift from this use of deep hierarchies to a variety of methods that compose a game entity object as an aggregation of components.

This article explains what this means, and explores some of the benefits and practical considerations of such an approach.I will describe my personal experience in implementing this system on a large code base, including how to sell the idea to other programmers and management.We usually end up with something like figure 1, but with a far greater number of nodes in the class hierarchy.As development progresses, we usually need to add various points of functionality to the entities.The objects must either encapsulate the functionality themselves, or be derived from an object that includes that functionality.Often, the functionality is added to the class hierarchy at some level near the root, such as the CEntity class.

Comments are closed.