Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about modeling "relationship" as an entity instead of as a component? #10

Open
XCYRKDSDA opened this issue Jun 15, 2023 · 1 comment
Labels
question Further information is requested

Comments

@XCYRKDSDA
Copy link

  1. Whenever a new type of relationship component is added to an entity, the entity's archetype changes. This is also mentioned in the wiki. If there are multiple types of relationships, say three, then there may be as many as eight different archetypes generated during the world updating. On the other hand, being added to a relationship should not be considered a 'structural change', literally.
  2. A relationship can be complex, and can be accessed from more than one system. If a relationship is an entity, it could contain as many components as it needs.
  3. A relationship may be related to more than two entities. The current modeling approach allows each relationship to be related to only two entities.
  4. Instead of firstly iterate through entities and then iterate through other entities that related to the former, I think it's more intuitive to directly iterate through all relationships and then process all entities in each relationship.
@XCYRKDSDA XCYRKDSDA changed the title How about modeling "relationship" as an entity instead of a component? How about modeling "relationship" as an entity instead of as a component? Jun 15, 2023
@genaray genaray added the question Further information is requested label Jun 15, 2023
@genaray genaray moved this to Todo in Arch Roadmap Jun 15, 2023
@genaray
Copy link
Owner

genaray commented Jun 15, 2023

Interesting idea! :) We could look into this, unfortunately i dont have that much time atm, finishing my bachelor thesis.

  1. Thats true, however it only happens once. The first time a relationship between two entities is established, if a relation changes or grows, it will not cause a new structural change each time.
  2. Thats true, however that would also cause structural changes. The current solution can use anything as relationship data without additional changes.
  3. Its 1 to n actually. One entity can have a relation to many other ones.
  4. Theres actually not such a huge difference, the overhead is the same.

In the current solution, the source entity acts as the "relationship" entity. To see what performs better, a benchmark is required. But i actually assume that the current solution is "faster", since it does not require one additional entity per relation. The cache should also be utilized more due to the fact that the source entity acts as the relation itself. But to verify or refute this, a benchmark is required ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: Todo
Development

No branches or pull requests

2 participants