メインコンテンツへスキップ

Entities and Components

Introduction

Niantic Studio utilizes an Entity Component System (ECS) architecture to manage entities and their behaviors. An entity represents a distinct object in your game world, while components define the specific data or functionality that entities possess. This design allows for a flexible and modular way to build complex systems by combining various components with different entities.

Relationships

Entities and components work together in a hierarchical manner. An entity is essentially an identifier that can have one or more components associated with it. Components contain the actual data or logic that defines what an entity can do or how it behaves. By composing entities out of different components, you can build diverse and complex game objects without the need for rigid inheritance structures.

Example

An entity exists within a space, which is owned by a world. The world represents the overarching environment or context, while spaces group entities together. For example, a world could contain a game level, with spaces organizing different areas or scenes. Entities within each space can have components such as position, rotation, scale, health, geometry, and material. Each component defines a distinct characteristic or behavior of the entity, enabling modular control over its attributes.