Quick tutorial

Please note that the code shown here should be considered a pseudo-code.

Setting up Artemis in a game container and game loop

Here you'll see a demonstration how to set up Artemis to use within your traditional game loop.

That's all you need to get your world running with a few systems. Of course there are no entities yet in the world.

Now, for the part where true is passed as an argument when adding RenderingSystem to the world, that means the RenderingSystem is marked as "passive", meaning it won't get processed when calling World.process(), allowing you to call RenderingSystem.process() manually where and when you want to do the rendering.

Defining a component

All you need to create your own component is to extend the Component class.

Please note that components do not contain any logic code. It may however contain getters and setters, and other methods that can assist in that regard.

Using a constructor and getters/setters is up to you. You could define your fields are public and simply work with them like that.

Creating an entity

To create an entity you need to retrieve an entity instance from the world. Then you can start adding components into it.

The lifecycle of an entity is a little more complex than this. Entity.addToWorld() will activate the entity in the world, Entity.deleteFromWorld() will delete the entity from the world, but Entity.changedInWorld() has to be called whenever you've made a modification to an entity that has been added to the world, e.g. adding or removing components.

Defining an entity system

Now we need to add the logic part into the game. EntitySystems process the components of entities and manipulate them. We'll demonstrate how by defining a MovementSystem that uses the aspect consisting of Position and Velocity.

When defining an entity system class you need to pass an instance of Aspect into the super constructor. You need to use Aspect.getAspectForAll(Class<? extends Component>... types). You can compose Aspects with AND, OR and exclusion conditions.

ComponentMappers are the optimal way of retrieving a component from an entity. Using the @Mapper annotation they are automagically injected into your system.

Other useful tutorials and articles on external sites

Entity/Component Game Design: A Primer

http://piemaster.net/2011/07/entity-component-primer/

Entity/Component Game Design That Works: The Artemis Framework

http://piemaster.net/2011/07/entity-component-artemis/

Introducing: Artemoids

http://piemaster.net/2011/06/introducing-artemoids/

Reusing Artemis entities by enabling, disabling and storing them

http://blog.gemserk.com/2012/01/03/reusing-artemis-entities-by-enabling-disabling-and-storing-them/

How we use Box2D with Artemis

http://blog.gemserk.com/2012/02/02/how-we-use-box2d-with-artemis/

Scripting with Artemis Entity System Framework

http://blog.gemserk.com/2011/11/13/scripting-with-artemis/

Object-Oriented? No, this is an entity system

http://bigbangloop.com/tag/artemis/

Entity Oriented Programming

http://jjcomer.github.com/blog/2011/11/06/entity-oriented-programming/

Entity Systems Project

http://entity-systems.wikidot.com/

Entity System 1: Java/Android

http://t-machine.org/index.php/2010/05/09/entity-system-1-javaandroid/

Adam Martin's T-Machine.org

http://t-machine.org/ (recommended, but search for "entity system")