Skip to content

Latest commit

 

History

History
130 lines (78 loc) · 3.87 KB

components.md

File metadata and controls

130 lines (78 loc) · 3.87 KB

Built-in Components

Overview of the built-in game entity components in the game simulation.

  1. Internal
    1. Activity
    2. CommandQueue
    3. Ownership
    4. Position
  2. API
    1. Idle
    2. Live
    3. Move
    4. Turn

Internal

Internal components do not have a corresponding nyan API object and thus only store runtime data.

Activity

Activity Component UML

The Activity component stores a reference to the top-level activity for the game entity. Essentially, this gives access to the entire activity node graph used by the entity.

Additionally, the current activity state is stored on a discrete curve that contains the last visited node.

Activity also stores the handles of events initiated by the activity system for advancing to the next node. Once the next node is visited, these events should be canceled via the cancel_events(..) method.

CommandQueue

CommandQueue Component UML

The CommandQueue component stores commands for the game entity in a queue curve container.

Commands in the queue use Command class derivatives which specify a command type and payload for the command.

Ownership

Ownership Component UML

The Ownership component stores the ID of the player who owns the game entity.

Position

Position Component UML

The Position component stores the location and direction of the game entity inside the game world.

The 3D position of the game entity is stored on a continuous curve with value type phys3.

Directions are stored as angles relative to the camera vector using clock-wise rotation. Here are some example values for reference to see how that works in practice:

Angle (degrees) Direction
0 look towards camera
90 look left
180 look away from camera
270 look right

Angles are stored on a segmented curve.

API

API components have a corresponding nyan API object of type engine.ability.Ability defined in the nyan API. This API object can be retrieved using the get_ability(..) method of the component.

Idle

Idle Component UML

nyan API object: engine.ability.type.Idle

The Idle component represents the ingame "idle" state of the game entity, i.e. when it is doing nothing.

The component stores no runtime data.

Live

Live Component UML

nyan API object: engine.ability.type.Live

The Live component represents the game entity's ability to have attributes (e.g. health).

An attribute's maximum limit is stored in the nyan API object, while the game entity's current attribute values are stored in the component on a discrete curve.

Move

Move Component UML

nyan API object: engine.ability.type.Move

The Move component represents the game entity's ability to move in the game world. This also allows moving the game entity with move commands.

The component stores no runtime data.

Turn

Turn Component UML

nyan API object: engine.ability.type.Turn

The Turn component represents the game entity's ability to change directions in the game world. Turning is implicitely required for moving but it also works on its own.

The component stores no runtime data.