Entity System Introduction

Every experienced programmer knows that planning a huge project is difficult. You need to know exactly what you want your program to do and which things should be possible to add later. If you do not do this you get unclean code, lose the clear view over the project and have to rewrite large parts again. Because game development is a dynamic process, sometimes it can be difficult to decide in which direction the game will develop) (Maybe you already compared alpha screenshots of a game with the final result)


In this example we suddenly want a new unit, an armored robot. This is not possible with our structure and therefore we would need to rewrite the code. At this point, the idea for an Entity System starts.

Entity System

There are various concepts for Entity Systems and they all have some differences. In this article we concentrate on the way the jMonkey Entity System works.


An Entity is simply an unique Id. Every Unit, Item, Bullet, etc. in your game will be represented by one of these entity Ids.


A Component is a class which only contains data. This means it has a constructor and only getter methods. Examples for Components can be:

  • PositionComponent

  • MovementComponent

  • CollisionComponent

Components are added to the Entities.

At any particular time, there can be only one component of the same class for one entity.

As you can see Entities are flexibly made up of different Components. You need your Armored Robot? No Problem, you only need to combine the right components. Besides, you are able to remove/change/add components during the game which is a huge benefit of Entity Systems.



Simply put, any classes other than the components and the entities can be considered as systems. You need to pay attention when you read about other Entity Systems because they can have different ideas of what a system is.

In the systems, you can request all Entities which have special components. For example you can say that you want all entities who have a position and a movement component, and then calculate the new position for these Entities by overwriting the old position component with a new one.

This leads automatically to many classes that only perform a single task, like the movement. As a result the project becomes clear and in case of bugs, you directly know which class is responsible for these components.

For a more detailed and technical view, have a look at the Entity System Advanced article

Pros and Cons


  • good overview

  • flexibility

  • modularity


  • performance

  • unfamiliar

  • a bit risky

As mentioned above, the System has many benefits. Now lets focus on the cons: The performance is slightly slower because you have more classes and more calculations are needed in the background. This point is not so significant anymore because computers are becoming faster and faster. A more critical point is that, until now, only a few projects have employed entity systems. One example of a project which uses a similar Entity System is the adventure Mythruna. http://mythruna.com/

Some say that it is not guaranteed that the Entity System will always work in practice. This may be true depending on the projects structure. Therefore project structure and layout is an important consideration when using an entity system.


It can be hard to adapt to the style of Entity System Programming if you are used to OOP. Therefore you need to pay attention that you in no way mix both styles together. Like other software architectures, you lose all benefits if you are not consistent.

Should I use an Entity System?

  • Make sure that you want to take the risk of using a very new concept

  • It is better if you have good programming experience

  • An entity system can make it easier to add new content as your game project grows.

  • Entity Systems are recommended for MMOs, but can be used for practically any game project.