State Space

In order for the agents to understand the game world, we need to convert the game state into a format that it can digest - we will call this the model's "state space".

Each model architecture will have different structure for the state space, so it is important to clearly define the features that are important to your game and the method to extract them. Developers can either use the built-in feature engineering module or create their own custom features.

Feature Engineering Module

The NRN agents SDK comes with an ability to automatically extract features from a game world. Developers only need to define a configuration so the SDK knows how to access certain values from the game world. Below we show an example getting the following features:

  • Raycasts that originate from the player and detect enemies around it

  • Relative position (distance and angle) to a powerup

The state config is comprised of an array of feature configs of the following format:

Features Available

In the configurations below, we use the notation string -> objectType to denote that the value for the key must be a string that points to an object of a particular type.

chevron-rightRaycasthashtag

Configuration

Returns: Array of Length numRays

chevron-rightRelative Positionhashtag

Configuration

Returns: Array of Length 3

chevron-rightRelative Position To Clusterhashtag

Configuration

Returns: Array of Length 3

chevron-rightOne Hot Encodinghashtag

Configuration

Returns: Array of Length N, where N = setup.options.length

chevron-rightBinaryhashtag

Configuration

Returns: Array of Length 1

chevron-rightRescalehashtag

Configuration

Returns: Array of Length 1

chevron-rightNormalizehashtag

Configuration

Returns: Array of Length 1

Custom Features

If developers want to create features that are currently not offered by the feature engineering module, then they are able to. Below we showcase how to convert a Pongarrow-up-right game world to a state matrix with custom feature engineering:

circle-info

Developers can also combine the built-in feature engineering functionality with their own custom features.

Last updated