Skip to content

Relationship between game objects and components #53

@frostney

Description

@frostney

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

  • Prefabs are just a scene (in fact, they do provide too much overhead currently as prefabs do have some events and methods that don't make sense in this context)
  • Game objects and their relationship to other objects is non-existent
  • Game objects have no purpose currently - it's easier to either to a prefab or write all the needed stuff in the scene itself
  • Objects that should have GameObjects as its base (lyria/sprite) only exist as a shell

What I propose is the following structure:

  • GameObjects have markup and code like scenes & prefabs (definition of an object)
  • GameObjects can attach components to them
  • Components only have code and no markup (logic for an object)
  • Prefabs can attach GameObjects and Components to themselves
  • Scenes can attach Prefabs and GameObjects to themselves
  • GameObjects can bind to an object and load its default values from it
  • Sprites would logically be a GameObject with a or multiple components attached to it
  • It should be easy to interact with a GameObject from a container object (Prefabs, Scenes)

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions