Skip to main content
grammar and punctuation and formatting; removed blacklisted engine tag
Source Link
Gnemlock
  • 5.3k
  • 5
  • 30
  • 60

Currently, I am still learning about entity-component-systementity-component-systems, and I have the followinga question concerning the components. How would the systems handle dependent components?

How would the systems handle dependent components?

 

For example, In a 2D game, I have an entity (game unit)a game object entity 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

  • RenderComponent - contains current character sprite

  • AnimationComponent - contains set of sprites and frame index

  • CharacterStateComponent - tells what the character is actually doing

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

Process 1 - System Polling

  1. InputSystem Polling:

  2. Input notifies StateSystemStateSystem.

  3. StateSystemStateSystem updates CharacterStateComponentCharacterStateComponent.

  4. AnimationSystemAnimationSystem reads CharacterStateComponentCharacterStateComponent changes.

  5. AnimationSystemAnimationSystem updates AnimationComponentAnimationComponent.

  6. RenderSystemRenderSystem reads AnimationComponentAnimationComponent changes.

  7. RenderSystemRenderSystem updates RenderComponentRenderComponent.

  8. RenderSystemRenderSystem draws RenderComponentRenderComponent normally.

Process 2 - All-in-one Updates

  1. InputAll-in-one Updates:

  2. Input notifies CharacterSystemCharacterSystem.

  3. CharacterSystemCharacterSystem updates CharacterStateComponentCharacterStateComponent, AnimationComponent,AnimationComponent and RenderComponentRenderComponent.

  4. AnimationSystem iteratesAnimationSystemiterates AnimationSystemAnimationSystem normally.

  5. RenderSystem drawsRenderSystemdraws RenderComponentRenderComponent normally.

 

I am not quite sure how the engine would respond to a change in one component that is 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 (Asas shown in Process 1System Polling).

Thus, how do you guy normally deal with thisHow would the entity system handle dependent components?

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?

Currently, I am learning about entity-component-systems, and I have a question concerning the components. How would the systems handle dependent components?

 

For example, In a 2D game, I have a game object entity 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

Given player input, such as "move_forward", I am not sure which of the following procedures should happen:

  1. System Polling:

  2. Input notifies StateSystem.

  3. StateSystem updates CharacterStateComponent.

  4. AnimationSystem reads CharacterStateComponent changes.

  5. AnimationSystem updates AnimationComponent.

  6. RenderSystem reads AnimationComponent changes.

  7. RenderSystem updates RenderComponent.

  8. RenderSystem draws RenderComponent normally.

  9. All-in-one Updates:

  10. Input notifies CharacterSystem.

  11. CharacterSystem updates CharacterStateComponent, AnimationComponent and RenderComponent.

  12. AnimationSystemiterates AnimationSystem normally.

  13. RenderSystemdraws RenderComponent normally.

 

I am not quite sure how the engine would respond to a change in one component that is 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 System Polling).

How would the entity system handle dependent components?

Tweeted twitter.com/#!/StackGameDev/status/296786761911255040
retagged
Link
ashes999
  • 11.3k
  • 9
  • 62
  • 97
Source Link

How would the entity system handle dependent components?

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?