Advertisement

Do I have the idea of Entity-Component System done right? I'm doing it for GUIs and here's an example.

Started by April 30, 2018 01:41 AM
10 comments, last by CircleOfAwesome 6 years, 4 months ago
On 5/2/2018 at 3:09 AM, Kylotan said:

The ECS paradigm is not designed for GUIs - it's designed for 'entities' (hence the name) which, in games, refers to any of the many objects that inhabit the world and interact with each other, but where the objects are likely to vary in ways that don't fit a traditional inheritance-based approach.

There are many existing patterns for GUIs - Model-View-Controller is the standard one regarding how to structure them, although there are alternatives. Additionally, UI widgets and windows are examples of things that fit a standard inheritance system very well.

I would strongly advise looking at existing UI systems and emulating one of those, rather than trying to wedge ECS into somewhere it wasn't designed for and offers no benefits to.

I've heard of the MVC pattern before. Basically, you have the model which deals with all the data-manipulations, etc. correct? Then you have the controller which sends control signals to the view and the view gets its data from the model. Am I correct?

So with that in mind, for every unique gui interact-able item in the game, I would have a model class, view class, and controller class? Am I right on that or are we doing something else? I did read up some examples on it and it seems like this is how the MVC pattern works. 

If I have to have a model class, view class, and controller class for every unique gui in the game, would it actually be practical? Maybe I'm misunderstanding something.

This topic is closed to new replies.

Advertisement