Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently, I am still learning about entity-component-system, and I have the following question concerning the components.

How would the systems handle dependent components?

For example, In a 2D game, I have an entity (game unit) that has the following components:

RenderComponent - contains current character sprite

AnimationComponent - contains set of sprites and frame index

CharacterStateComponent - tells what the character is actually doing

Now, given a character input such as "move_forward", I am not sure which one of the following procedures should happen:

Process 1 - System Polling

  1. Input notifies StateSystem.

  2. StateSystem updates CharacterStateComponent.

  3. AnimationSystem reads CharacterStateComponent changes.

  4. AnimationSystem updates AnimationComponent.

  5. RenderSystem reads AnimationComponent changes.

  6. RenderSystem updates RenderComponent.

  7. RenderSystem draws RenderComponent normally.

Process 2 - All-in-one Updates

  1. Input notifies CharacterSystem.

  2. CharacterSystem updates CharacterStateComponent, AnimationComponent, and RenderComponent.

  3. AnimationSystem iterates AnimationSystem normally.

  4. RenderSystem draws RenderComponent normally.

I am not quite sure how the engine would respond to a change in one component that suppose to update other components as well. I believe there will be performance issue when it comes to each system having to poll its prerequisite component changes (As shown in Process 1).

Thus, how do you guy normally deal with this?

share|improve this question
This has been asked many times already. Check the right side for clues and be open to different naming since everyone hits this problem somewhat differently. – snake5 Jan 30 '13 at 12:07
Here's an answer of mine from another question, that is also relevant here:… – Paul Manta Jan 30 '13 at 16:21
I've found this to be an excellent answer. – NoobsArePeople2 Jan 30 '13 at 16:35
@NoobsArePeople2 That answer is "OK" for learning about how systems work, but it doesn't really address the ordering for system processing. I guess the author wasn't complete enough. – Byte56 Jan 30 '13 at 18:07

I wouldn't suggest having your systems be triggered by input. The systems should run in your update loop and should poll input when they start. You can solve that by having an input component and system. That also means that only entities controlled by the keyboard have an inputComponent, so they're the only ones that get updated on keyboard input. Pressed keys should be queued in the inputSystem when they happens. Then the inputSystem will process the input when it's time to run. Similar to your first scenario, they would run in order:


Just make sure to order your systems so that you're not a frame behind. At the moment there's no cyclic dependencies in your systems, so you have no problems.

share|improve this answer

Components should be independent, and Systems should communicate via some indirection such as a message bus/event aggregator. Your input system can publish an event to the message bus, and any other interested systems can opt to subscribe to the event, thus decoupling the two systems in this way:

InputSystem --> MessageBus.Publish(MoveForwardEvent)

MovementSystem --> MessageBus.Subscribe(MoveForwardEvent, MovementSystem.MovePlayerForward)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.