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 - Dependent Components #164

Open
MakoEnergy opened this issue Jun 10, 2017 · 0 comments
Open

ECS - Dependent Components #164

MakoEnergy opened this issue Jun 10, 2017 · 0 comments

Comments

@MakoEnergy
Copy link
Member

In a perfect world, each component would be completely autonomous and not need information on any other component, happily running in it's own little pocket of the simulation. Such a world isn't our world. Having one component per subsystem isn't practical or recommended. Many components can get by in simple cases without having to resort to getting information from another component, but some more sophisticated components cannot.

Some examples:

  1. We have a RenderableProxy and we have plans to extend the graphics system to wrap animations. It is commonplace in other ECSs to have a separate Mesh and Animation components. Simply omit the functionality if the object doesn't need it, the core goal of any ECS. An animation component would still need to have access to the Mesh, hence needs to be aware of another component.
  2. In the past I attempted to implement sticky behavior on RigidProxies. This was bad form due to not everything needing such functionality, but if I were to try this again post ECS refactor it would make sense to have a sticky component that would reference a RigidProxy and create a constraint as appropriate.

Sticking a pointer onto these proxies is straightforward, however may be unsafe to do so if components are removed at runtime during the Entity lifetime (which we currently support). Worse, if they truly depend on the other component(s) then they shouldn't continue to exist after the dependee component is removed. So at a minimum some mechanism will need to be made to allow some components to be notified about the removal of other components.

This is 11. on #134 .

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

No branches or pull requests

1 participant