A system is logic that operates on data arrays. In enemy movement, the index identifies an entity, the EnemyPosition array holds component data, and the position update is the system. section 12.3
Listing 12.10 Original enemy movement before DOTS
static void moveEnemies(GameData gameData, Balance balance, float dt)
{
for (int i = 0; i < balance.NumEnemies; i++)
{
Vector2 dir = -gameData.EnemyPosition[i].normalized;
gameData.EnemyPosition[i] = gameData.EnemyPosition[i] +
dir * balance.EnemyVelocity * dt;
}
}The movement loop shows the calculation that modifies each enemy’s position array entry. section 12.3
ECS separates data and calculations into Components and Systems, which can add code and architectural overhead. Array-based data and static logic can support data-oriented design without adopting ECS. section 12.3 section 12.5
