Skip to content

Developers' complaints #31

Description

@Adnn

The design around phases to commit is not convenient:

  • Have to commit phases between each node added to a scene graph (i.e. parent add phase must be committed, before starting the child add phase.

ECS queries:

  • Implicit lists (ent::Query) couple the taken actions (i.e. system iterations) to composition. This means the taken actions are coupled to all code (current, and future) that is touching to composition.

       // Removing players
      mPlayers.each([&destroyLevel](EntHandle aHandle,
                                    component::PlayerLifeCycle & lifeCycle,
                                    component::PlayerPowerUp & aPowerup) {
          // Reset alive status so that player can be spawned
          lifeCycle.mIsAlive = false;
          lifeCycle.mTimeToRespawn = component::gBaseTimeToRespawn;
    
          removeRoundTransientPlayerComponent(destroyLevel, aHandle);
          removeEntityFromScene(aHandle);
      });
    
    • In the real code above, if player do no have a power-up when round i ending, they are not going through this loop.
    • Corollary: If a new component is required in an existing system, it is tempting to add the component to the Query. Yet, if this query is also used in some unrelated system (benefiting from query caching), it might introduce a logic error because this other system might also be interested in entities without the new component. This kind of error invalidates the "implicit validation" conducted by the iterative manual tests.
  • Queries without an explicit tag are a very brittle way to keep lists (basically an ivitation to bugs related to violating the open-closed priniciple)

    ent::Query<component::GlobalPose,
               component::InGamePowerup,
               component::Collision,
               component::Geometry,
               component::LevelEntity>
      mInGameDogPowerups;
    
    ent::Query<component::GlobalPose,
               component::InGamePowerup,
               component::Speed,
               component::Geometry,
               component::LevelEntity>
      mInGameMissilePowerups;code
    
    • From that, it seems that adding a collision to a missile also make it a dog. (or Speed to a dog to make it a missile)
  • Optionals are another way to introduce dangling pointers.

    • coupling invariants validity to objects lifetime would be the Cpp way to statically get rid of this category of errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions