Skip to content

Has-if36/EnemyReadPlayerAtkPattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

Enemy’s Reaction to Player’s Attack using Reinforcement Learning (RL) on Unity

Introduction

Most games that have fighting elements usually have many kinds of attack pattern. The purpose for this is to have better gameplay experience. Some games have a mechanic where the enemy can block or evade player’s attack. Using probability to make enemy dodge is really common. However, there is a is not much factor that can affect this randomness. You can however add some elements to affect this randomness such as Accuracy Stats or Agility Stats, but that's not the point for this project. Therefore, I would like to make an enemy that will dodge based on player's attack pattern. Player's attack pattern will be the factor which will affect enemy's behaviour to dodge.

Why using Reinforcement Learning?

When you want to implement AI in games, you have to make sure the algorithm is efficient so that player can enjoy smoother game experience. Reinforcement Learning is quite efficient, at least when comparing with Neural Networ or Deep Learning. The model itself is also fairly easy to understand compared to other AI Algorithm and the implementation is also not very difficult.

RL Component

Component Value
Agent Enemy
Environment The game itself
Observation Player’s Attack Pattern
Action Enemy’s Prediction on Player’s Attack Pattern
Reward&nbsp
  • Right Guess Seen
  • Player’s Current Attack Pattern
Punishment
  • Wrong Guess

Result

Probability VS Reinforcement Learning

Probability (50% Dodge Rate) Reinforcement Learning
EvadeProb.gif EvadeRL.gif

Beating Enemy with RL


Beating Enemy with RL

To beat it, you basically need to change your attack pattern. Having multiple enemy attacking the player can be a bit tricky to deal with.

Implemented Game

The current project has been implemented into this game.
Please do play the game and give me a feedback :D

Surveys

Whole Gameplay Survey
The point of this survey is to some feedback about the game itself and the potential of this AI

Demo Survey
The point of this survey is to some feedback about Player's experience in dealing enemy with Probability and Reinforcement Learning

About

Enemy’s Reaction to Player’s Attack using Reinforcement Learning (RL)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages