How to use batch rendering with an entity component system?

Posted by Kiril on Game Development See other posts from Game Development or by Kiril
Published on 2012-09-11T14:02:47Z Indexed on 2012/09/11 21:50 UTC
Read the original article Hit count: 312

Filed under:
|
|

I have an entity component system and a 2D rendering engine. Because I have a lot of repeating sprites (the entities are non-animated, the background is tile based) I would really like to use batch rendering to reduce calls to the drawing routine. What would be the best way to integrate this with an engtity system?

I thought about creating and populating the sprite batche every frame update, but that will probably be very slow. A better way would be to add a reference to an entity's quad to the sprite batch at initialization, but that would mean that the entity factory has to be aware of the Rendering System or that the sprite batch has to be a component of some Cache entity. One case violates encapsulation pretty heavily, while the other forces a non-game object entity in the entity system, which I am not sure I like a lot.

As for engine, I am using Love2D (Love2D website) and FEZ ( FEZ website) as entity system(so everything is in Lua). I am more interested in a generic pattern of how to properly implement that rather than a language/library specific solution.

Thanks in advance!

© Game Development or respective owner

Related posts about entity-system

Related posts about spritebatch