I have been reading up on Entity System Frameworks specifically Artemis. I am trying to decide if it is right for me. I strictly work on tile based 2d pixel art games, and I don’t think they will ever be that resource intensive. I have always used standard OOP with a lot of inheritance in the past.

My understanding of the Entity System Framework right now (I am not sure if I grasp it completely yet) is:

  • Entities are nothing but ID's
  • Components are nothing but dumb data added to an entities component pool
  • Systems are update functions that are attached to the world to handle every entity that matches the Systems component signature

If my understanding is correct then I am having quite a bit of trouble conceptualizing adding tilemaps and AI Behavioral Trees into this framework. I will ask about AI in the future.

Should a tilemap be built into this framework? Or should it be kept separate to make it easy to generate with a tilemap editor?

If the tilemap should be built into this framework, is each tile a different entity? And the tilemap a system? Or is the tilemap itself a single entity with inheritance built off of it?

If the tilemap is sperate, what would be the best way of collision detecting entities against the external tilemap?

I understand that multiple options that I have listed might be correct, but if anybody has done this in the past they might be able to shed some light on my confusion. Maybe there is another alternative that I have not thought of?

Thank you.

  • \$\begingroup\$ A completely random note, X/Y coordinates works as IDs as well. Not that I'm suggesting you implement it in your entity system, but rather, you can attach effects to your tiles in the same manner as you would in an entity system. \$\endgroup\$
    – William
    Commented Jul 20, 2012 at 6:53
  • \$\begingroup\$ Hey, just passing on Byte56's suggestion: components don't really need to be dumb data holders. Sometimes it would be useful if they could actually operate that data; vectors, for example. \$\endgroup\$
    – jcora
    Commented Jul 20, 2012 at 11:22
  • \$\begingroup\$ I really like this suggestion as well. I can add tilemaps into the entity framework without having to separate the tilemap helpers from the data, or having to break up the tilemap into multiple components / entities. \$\endgroup\$ Commented Jul 20, 2012 at 16:31
  • \$\begingroup\$ Tilemap is just another component, and collision system and renderer system handles collisions with tilemap and rendering of tilemap \$\endgroup\$
    – Kikaimaru
    Commented Jul 20, 2012 at 20:16

2 Answers 2


I implemented an entity component framework (similar to Artemis) after I'd already been in development for a while, but I don't think I would have done things differently if starting from a blank slate.

I have my world totally separate from the entity framework. It just didn't make sense to me to convert the world into some sort of entity or collection of entities. My world is 3D with cubes, but I believe the same applies for tiles. Entities make up everything else in the world, but the terrain is separate. However, when cubes are removed, they do spawn "material" entities.

Collision detection isn't too hard to tie in. Your world would likely have isSolidAt(x,y) type methods that your collision system will utilize. Honesty, I've said this once already today in a different answer, do whatever makes the most sense to you. You're not breaking any rules by making the tile map separate or making it an entity. Whatever you can wrap your head around is what's best. For me, that was keeping the world separate and making everything else entities.

  • 1
    \$\begingroup\$ Say my map is an entity. How would another entity go about accesing the map's isSolidAt method? \$\endgroup\$ Commented Oct 4, 2013 at 0:26
  • \$\begingroup\$ Storing the map as an entity probably isn't a great idea for just this situation. I suppose you've have to communicate directly with it in this situation. The system in charge of the map entity would have access to the map entity, and be able to retrieve information from that entity when it's requested. \$\endgroup\$
    – House
    Commented Oct 4, 2013 at 1:51

I added tilemap as a separate component to entity (with all tiles inside) and there is also separate renderer for tile map, so I can render it in 3d or in 2d. To create all tiles as entities is possible but to expensive.

something like that:

Entity e("map");
e.addComponent(new Tilemap("1.xml"));
e.addComponent(new TilemapRenderer2d(graphics));

tile map is something like that
class Tilemap
  array of tiles;
  isWalkable ; etc;

class ITilemapRenderer

class TilemapRenderer2d
  foreach (tile in owner()->component()->tiles()) 
    if (tile == ground) ground_sprite->draw() ....

benefit in separating drawing from logic is base idea of MVC pattern

  • 1
    \$\begingroup\$ The entire tilemap is contained within a single component? Is it attached to some sort of game environment entity / master entity? I can see a pretty large benefit gained by separating the render-er from the tilemap component. \$\endgroup\$ Commented Jul 20, 2012 at 16:26
  • \$\begingroup\$ Thank you for updating your answer! I love code snippets. \$\endgroup\$ Commented Jul 20, 2012 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .