Player Brain

March 12, 2018 · View on GitHub

The Player brain type allows you to control an agent using keyboard commands. You can use Player brains to control a "teacher" agent that trains other agents during imitation learning. You can also use Player brains to test your agents and environment before changing their brain types to External and running the training process.

Player Brain properties

The Player brain properties allow you to assign one or more keyboard keys to each action and a unique value to send when a key is pressed.

Player Brain Inspector

Note the differences between the discrete and continuous action spaces. When a brain uses the discrete action space, you can send one integer value as the action per step. In contrast, when a brain uses the continuous action space you can send any number of floating point values (up to the Vector Action Space Size setting).

PropertyDescription
Continuous Player ActionsThe mapping for the continuous vector action space. Shown when the action space is Continuous
SizeThe number of key commands defined. You can assign more than one command to the same action index in order to send different values for that action. (If you press both keys at the same time, deterministic results are not guaranteed.)
Element 0–NThe mapping of keys to action values.
KeyThe key on the keyboard.
IndexThe element of the agent's action vector to set when this key is pressed. The index value cannot exceed the size of the Action Space (minus 1, since it is an array index).
ValueThe value to send to the agent as its action for the specified index when the mapped key is pressed. All other members of the action vector are set to 0.
Discrete Player ActionsThe mapping for the discrete vector action space. Shown when the action space is Discrete.
Default ActionThe value to send when no keys are pressed.
SizeThe number of key commands defined.
Element 0–NThe mapping of keys to action values.
KeyThe key on the keyboard.
ValueThe value to send to the agent as its action when the mapped key is pressed.

For more information about the Unity input system, see Input.