Components
Component
Bases: PyTreeNode
Base class for all components in the game. Components are used to store the data of the entities in the game.
Directional
Bases: Component
Flags an entity as directional, and provides the direction
attribute
direction = field(shape=())
class-attribute
instance-attribute
The direction the entity: 0 = east, 1 = south, 2 = west, 3 = north
HasColour
Bases: Component
Flags an entity as having a colour, and provides the colour
attribute
colour = field(shape=())
class-attribute
instance-attribute
The colour of the object for rendering.
HasSprite
Bases: Component
Flags an entity as having a sprite, and provides the sprite
attribute. The sprite is used to render the entity in the game.
HasTag
Bases: Component
Flags an entity as having a tag, and provides the tag
attribute. The tag is used to identify the type of the entity in the observations.
tag
property
The tag of the component, used to identify the type of the component in observations.categorical
Holder
Bases: Component
Flags an entity as a holder, and provides the pocket
attribute. The pocket is used to store the id of the item in the pocket.
pocket = field(shape=())
class-attribute
instance-attribute
The id of the item in the pocket (0 if empty)
Openable
Bases: Component
Flags an entity as openable, and provides the requires
and open
attributes
open = field(shape=())
class-attribute
instance-attribute
Open is jnp.asarray(0) if the entity is closed and 1 if open.
requires = field(shape=())
class-attribute
instance-attribute
The id of the item required to consume this item. If set, it must be > 0. If -1, the door is unlocked and does not require any key to open.
Pickable
Bases: Component
Flags an entity as pickable, and provides the id
attribute, which is used to identify the item in the inventory
id = field(shape=())
class-attribute
instance-attribute
The id of the item. If set, it must be >= 1.
Positionable
Bases: Component
Flags an entity as positionable in the grid, and provides the position
attribute
position = field(shape=(2,))
class-attribute
instance-attribute
The (row, column) position of the entity in the grid as a JAX array, defaults to the discard pile (-1, -1)
Stochastic
Bases: Component
Flags an entity as stochastic, and provides the probability
attribute
TODO
- consider replace probability (Array) with a distrax.Distribution
probability = field(shape=())
class-attribute
instance-attribute
The probability of receiving the reward, if reached.