Overview • Implementation • Screenshots • Application Project • Launcher • Requirements • Build • License
This project aims to design and implement an AI system for antagonists in cRPG games using the Unity 3D engine, with a focus on machine learning technologies. A key feature of this project is the use of the Unity MLAgents plugin, which facilitates the integration of advanced machine learning techniques within the Unity environment. The priority is to ensure that enemy behaviors and abilities adapt to their environment, situational context, or the player's skill level. Additionally, the system is designed to evolve through experience gained in combat against the player or other enemies, enhancing its predictive abilities, decision-making, and action selection in response to various scenarios. The system learns through successive interactions with players, thereby improving its combat skills and responses, ultimately presenting an increasing challenge to the player.
Two types of Machine Learning are employed in this project:
-
Behavioral Tree: Used for decision-making and action execution based on the current state of the environment surrounding the non-playable character (NPC). Responses include following the player when in sight, fleeing to safety when health is critically low, and roaming freely in the absence of nearby enemies.
-
Reinforcement Learning: This approach provides the enemy AI with numerous observations about its current state and the surrounding environment, as well as the state machine values of the enemy or player. Based on this information, the model decides on actions such as casting spells or refraining from action. Actions are evaluated, and the accumulated points in each episode are used to optimize decision-making in subsequent encounters.
Presentation of a battle between two learning bots.
The behavioural tree system, which is used by bots as a support for machine learning.
- Unity Version: The project is developed in Unity 2020.3.19f1 with the integration of the MLAgents plugin.
- Project Location: The content can be found in the folder
EnemyAI - Unity project
.
- Development Language: C# in the "Windows Forms Application" template.
- Project Location: The content can be found in the folder
EnemyAI- Launcher
.
- Python version 3.6 or 3.7
- Installation of Python plugins from the file
EnemyAI - Unity project/requirements.txt
- Unity 3D version 2020.3.19f1 or later, with MLAgents plugin installed
The build generation procedure is complex. Access to the latest available version can be found at the following link: Enemy AI Build
Python version 3.6 or 3.7 (Python is only necessary in training modes, the application allows gameplay mode without this requirement.)
This project is licensed under the MIT License - see the LICENSE file for details.