What games items belong outside of the ECS model?

Started by
2 comments, last by そら 4 years, 7 months ago

Hi there,

I'm curious how some of you differentiate between ECS implementation and non-ECS implementation. For example, in my ECS implemented I have a render system that models all of my visible components. However, there are things that I draw to the screen that I wouldn't describe as "entities" it would seem odd for an ECS system to draw these (e.g. background image, user-interface icons, etc.). But at the same time, it would seem that certain user interface items would need access to component information. 

I'm curious how you differentiate between tasks that should fall within ECS and tasks that fall outside of it (e.g. should a pop-up window be considered an "entity"?).

I'm also curious how your ECS "update" function falls within your overall game loop.

 

Advertisement

This post is absolutely just my personal opinion and personal experience working on projects of my own, and may not be in keeping with standard or best practice or what's done in widely-used frameworks that use ECS or other types of entity-component system.

This doesn't mean much (it's just anecdotal), but I've always handled everything within the entity-component system and haven't encountered any disadvantages with that approach (I haven't specifically implemented an ECS system though, so maybe there are considerations there that I'm not aware of). To me, trying to separate out certain things seems redundant and like it could lead to duplication of effort and introduce the additional burden of facilitating communication between the entity-component system and other systems.

Also, for what it's worth, I think with Unity's old 'game object' system, pretty much everything went through that system. I don't remember there being separate consideration for certain types of things. (I'm not familiar with Unity's new ECS system though. Maybe things are different with it than with the 'game object' system.)

Maybe you could start by asking, what possible benefits do you see in handling certain types of things (e.g. backgrounds and UI elements, to use your examples) outside the entity-component system? And/or, conversely, what possible disadvantages do you see in handling such things within the entity-component system? The answers to these questions might shed some light on the issue for you.

To address some things specifically:

Quote

However, there are things that I draw to the screen that I wouldn't describe as "entities" it would seem odd for an ECS system to draw these (e.g. background image, user-interface icons, etc.).

Personally it doesn't seem odd for an entity-component system to draw such things - it seems natural. Also, it sounds like maybe you might be reading too much into the word 'entity'. In this context, I'd interpret it just to mean 'thing', which is pretty all-inclusive.

Quote

But at the same time, it would seem that certain user interface items would need access to component information.

This seems like a hint that there may not be much if anything to be gained by handling such things separately.

Quote

I'm curious how you differentiate between tasks that should fall within ECS and tasks that fall outside of it (e.g. should a pop-up window be considered an "entity"?).

Something like an in-game pop-up window certainly seems like an entity to me, and I've treated such things as entities in my own projects. Again though, I've typically treated everything as an entity, with no exceptions.

Since discussion of topics related to entity-component systems can sometimes become contentious, let me reiterate that these are just my opinions and initial thoughts in response to what you posted. Maybe I'm completely off base and others will provide better feedback than I have here.

I agree with Zakwayda,

You're thinking of the ECS just for the in-game things... you should think of the architecture of your game as a whole system, maybe you'd like to think of a different type of component for those things that quite don't fit?

"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"

This topic is closed to new replies.

Advertisement