freezedev / lyria

Lightweight DOM-based game framework
The Unlicense
8 stars 0 forks source link

Relationship between game objects and components #53

Open frostney opened 10 years ago

frostney commented 10 years ago

Currently, there are a few software design-related problems in Lyria:

What I propose is the following structure:

In my opinion, this helps to separate each aspect of Lyria and gives it a specific purpose. (And it resembles the entity-component pattern to a high degree.) Let's take a player as an example: Instead of it being a markup and code in every scene/prefab we need it to be, it would a GameObject and can be inserted in any number of scenes and prefabs reducing maintainability.

@Polooo2 I would really appreciate your feedback on this.

Polooo2 commented 10 years ago

Sry for late answer.

I have the same opinion. In my experience you often need a prefab by several scenes and some "components" from several prefabs. Currently I often created small prefabs (e.g. slider elements or some ui element with minimal logic) to be used in "bigger" prefabs.

I would only change the structure a little bit:

Furthermore I think it would be nice if one component could be used by several GameObjects (same for template). It would create the possibility to have several GameObjects with similar functionality.