Reinforcement Learning in Unreal Engine 4 (4.27)
Study / Research work using Unreal Engine 4 in Blueprint 2021
Git
The full project git is available here : https://github.com/LucasKyinn/TERProject
Please clone the project instead of downloading it, as downloading may cause issues with GIT LFS and prevent you from seeing UAssets within Unreal Engine.
[Fr] Videos : Français avec les explications
Description
Introduction to reinforcement learning
Reinforcement learning is a approach used when there is no dataset, data is obtained from within the environment in which an actor operates. The actor will be able to interact with its environment and recover data to build its own dataset. The agent, which is the actor equipped with the reinforcement algorithm, will then be able to use its dataset to take actions that will be beneficial in the long term, it will be able to optimize the number of rewards attributed by the environment.
The goal of reinforcement learning is therefore to maximize the number of rewards where the goal of supervised learning algorithms is to minimize an error function.
The notions that are important to understand here are the notions of agent, state, action and rewards.
An agent is an actor inside the environment that has the ability to interact with it through predefined actions. This agent is constantly in a state that is defined by variables that the agent retrieves from the environment, this state will vary according to the actions taken by the agent. Finally, each change in state will result in the attribution of a reward to the agent by the environment, these rewards are a way of judging whether the change in state has been beneficial or not for the agent.
Gameplay video:
The Agent
A fully Animated German Shepherd from GiM Animalia – German Shepherd.
The State
The state is defined by :
A Boolean representing whether the player is dead.
A Boolean indicating whether the agent has low hit points (HP).
A Boolean representing whether the agent is dead.
An Integer representing the number of enemies attacking the player.
An Integer representing the number of enemies attacking the agent.
The Actions
Attack
Heal
Flee
The rewards
• -100 if the player or agent dies.
• +2 if the agent exits the critical health zone.
• -1 if it remains in this zone.
• +1 or -1 depending on the number of zombies attacking the player.
• +5 if the total number of zombies attacking decreases.
Experiment
Since training the AI would take to much time I aslo made a smaller scale experiment in order to showcase the AI learning.