Entities
Ball
Directions
Directions enum class to store the directions in the game.
Door
Bases: Entity
, Openable
, HasColour
Consumable items are world objects that can be consumed by the player.
Consuming an item requires a tool (e.g. a key to open a door).
A tool is an id (int) of another item, specified in the requires
field (-1 if no tool is required).
After an item is consumed, it is both removed from the state.entities
collection, and replaced in the grid
by the item specified in the replacement
field (0 = floor by default).
Examples of consumables are doors (to open) food (to eat) and water (to drink), etc.
symbolic_state
property
Returns an integer array encoding the symbolic state of the door:
- 0: Door is open
- 1: Door is closed but not locked
- 2: Door is closed and locked (requires a key or tool)
Examples:
- If open = 1 and locked = 0: symbolic_state = 0 (open)
- If open = 0 and locked = 0: symbolic_state = 1 (closed, not locked)
- If open = 0 and locked = 1: symbolic_state = 2 (closed and locked)
Entities
Bases: PyTreeNode
Entities enum class to store the names of the entities in the game.
Entity
Bases: Positionable
, HasTag
, HasSprite
Entities are components that can be placed in the environment, and have a position and a tag.
To create an entity, use the create
method.
name
property
The name of the entity
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the name of the entity |
ndim
property
The number of dimensions of the entity. The number of dimensions is the number of dimensions of the position minus 1.
shape
property
The batch shape of the entity. The batch shape is the shape of the entity excluding the dimensions of the component. For example, if the entity has a position of shape (batch_size, 2), the shape of the entity is (batch_size,).
symbolic_state
property
The symbolic state representation of the entity. The symbolic state is as the last channel in the symbolic_observation function.
transparent
property
The transparent attribute of the entity. The transparent attribute is a boolean array that indicates if the entity is transparent to rendering.
walkable
property
The walkable attribute of the entity. The walkable attribute is a boolean array that indicates if the entity can be walked on.
EntityIds
EntityIds enum class to store the ids of the entities in the game.