Skip to content

Documentation: GameObject Components

man'O'war edited this page Aug 24, 2016 · 2 revisions

About GameObject

The GameObject is the base entity in the Game, anything is the scene is a GameObject.

However, using simply game objects does not allow to express the meaning carried by an entity.

GameObject/Component pattern ( c.f decorator pattern )

In this pattern, we separated between GameObjects and their carried context.

  • GameObjects does not physically exist
  • GameObjects are nothing.
  • GameObjects are just Containers and organized in hierarchy

As for Components, they are objects that carry a specific context, logic, behavior. They cant exist by their own within a scene, as they need a host obejct.

Combining both GameObjects and Components allows to create a GameObject with a specific context.

  • Each component added to the game object gives it additional logic.
  • The context carried by a GameObject is defined by all the components within this game object.
  • The same component can be added by many GameObjects

pattern

In the piture above, (we consider) it shows all exisiting components ( shown by blue circle ). Orange rectangles represent GameObjects, they can add as many components as they needed, each specific combination of linkage define a new & unique context for the GameObject.