Re: [entityx] Establishing Dependencies
- Alec Thomas
- 2014-08-11 @ 07:03
While it may be more “correct” to have systems define dependencies in
isolation, it’s less efficient because each dependency creates a new
receiver for ComponentAddedEvents. If you have partially overlapping
dependencies, you’ll create redundant listeners.
Truthfully, the deps code is most useful as an example. For a truly
efficient implementation you’d want a single DepsSystem with one
ComponentAddedEvent receiver, that you add dependencies to. You could then
pass this to your System’s constructor.
On Monday, 11 August 2014 at 4:43 pm, ryan alexander wrote:
> Hi! I just picked up EntityX. It looks nice so far!
> I'm curious about where you'd suggest setting up dependencies. It seems
like Systems should be able to specify deps for their own Components, but
they do not have access to the SystemManager. The example seems to suggest
that you'd do this wherever the SystemManager is defined, which seems like
it would require the user of a System / Component to know and reiterate
its deps. Alternatively, I could pass the SystemManager to the System's
constructor, but that seems like a kludge.
> Where do you normally set up these relationships?
> Any insight would be appreciated! :)
> # Ryan Alexander
> # http://onecm.com