Rendering order in an Entity System

Posted by Daedalus on Game Development See other posts from Game Development or by Daedalus
Published on 2013-06-25T12:37:33Z Indexed on 2013/06/25 16:30 UTC
Read the original article Hit count: 286

Say I use a basic ES approach, and also inside Systems I hold lists of all entities that Systems are required to process.

How do I maintain this list of entities in desired rendering order, i.e. for a dumb 2D RenderingSystem?

I saw this discussion, and what they suggest is to do something like Z ordering - what I would probably do is just to store a "layer" int in DrawableComponent and then, inside RenderingSystem, just sort entities by mentioned "layer" whenever the entity list for RenderingSystem changes.

They also say we could just delete and recreate the entity whenever we want it on the top, but it seems too inflexible to me.

How is this problem usually solved?

© Game Development or respective owner

Related posts about architecture

Related posts about component-based