liveBook · Manning

Entity

As explained in High Performance Unity Game Development

In this section's ECS representation, an entity is an index in data arrays that identifies an individual record.

In this array-based ECS mapping, an entity is an index—not the component data or system logic. During enemy movement, i selects EnemyPosition[i]. Data-oriented design does not require adopting ECS. section 12.3 section 1.5

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 enemy-movement loop shows the entity index selecting and updating a position record. section 12.3

How High Performance Unity Game Development covers it

How deep it goes
Defines entities as array indices and illustrates their use in enemy movement.
Examples
Uses index i to access and update enemy positions in an array.
What you can do after
Understand how an entity index selects a record during array-based movement.
How it connects
Connects entities to components, systems, and data-oriented design.

Also explained in

Compare how 14 books explain entity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of High Performance Unity Game Development. The section links point to the parts of the book it draws on.