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

ECS: Remove Flyweight Component Type #110

Closed
wants to merge 2 commits into from

Conversation

christopher-buss
Copy link
Member

@christopher-buss christopher-buss commented Jun 13, 2023

Description

After considering the different options for flyweights, it is clear that the current approach does not live up to standard due to them being practically a singleton globally accessible state that can be assigned to a set of entities. If two sets of entities have different data, we would need to create a new flyweight to encapsulate this data.

One approach to fix this was to create a map where we would have a getter and setter for the data on the flyweight, and then we could map an entityid > flyweight data. The issue here is in cases where there is no easy concern about who "owns" the flyweight data. If for example, we had a pack of mobs, with a leader and six other mobs, then the leader is typically the one that controls all the data, but there is no easy way to ensure this. To sort this we need to start creating abstractions for the flyweight data that can become very specific depending on the issue we wish to solve (see https://skypjack.github.io/2020-02-02-ecs-baf-part-7/).

The best way to resolve these issues is to just remove the flyweight entirely, and then users at their own discretion can create abstractions over components to solve the issues they wish to solve, as creating a one solution fits all approach would be very costly, and likely never cover all the possible use cases anyway.

Proposed Changes
  • Remove Flyweights
Linked

Resolves #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ECS: Change to flyweight behavior
3 participants