Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ECS approach to calculate available options for drop-down list (or similar)

Discussion in 'Entity Component System' started by Goldseeker, Jun 14, 2019.

  1. Goldseeker

    Goldseeker

    Joined:
    Apr 2, 2013
    Posts:
    42
    So I'm designing a character creation tool for an rpg game, often I need to present for a user a list of options available for selection, for example, choose an ability for level up, among all abilities the game should pick those that character fulfills prerequisites of and promt the user to choose. It is quite a nightmare in OOP as in order to check for prerequisites one usually needs to access all character data.

    I'm trying to imaging how it can be done in ECS:
    Have an Entity with ChosenAbility component that contains entity of a chosen option, for each entity with ChosenAbility have an Entity with AbilityOption component that contains a link to some external data describing this option and for each such entity have an Entity with AbilityOptionPrerequisite component.

    And have systems that
    1) That verify all AbilityOptionPrerequisites and mark them as passed/failed
    2) System that marks option as available/unavailable depending on its prerequisites

    3) System that fills UI dropdown list with available options for given ChoseAbility

    So my questions are:
    1) Am I on the right track?
    2) Should I use dynamic buffer instead of entities for prerequisites/options or maybe use dynamic buffer only to have a link from parent to child
    3) Is there any literature available with patterns and common design problems/solutions for Dataoriented Design and ECS in particular?
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    upload_2019-6-15_9-13-49.jpeg
     
    5argon likes this.