indropal / CoinSnatcherAI

A micro-game based on gamified Reinforcement Learning where the Player competes against an AI Agent. The project has been built with Unity's ml-agents package.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CoinSnatcherAI



This project presents a micro-game which is based on the idea of Gamified Reinforcement Learning. The Player has to compete against an AI(RL) Agent to collect as many coins as possible within a constrained amount of time. The project has been built with Unity's ml-agents package.

The Game is available HERE for playing!
Try and beat the AI Agent! πŸ˜„

NOTE:

  1. You'll need a keyboard to play the game.
  2. Please give approximately 30 seconds for the game to load on your browser [Recommended: Google Chrome - other browsers should work fine].
  3. Enjoy! πŸ˜ƒ

Player Controls:

In order to collect coins, the player needs to navigate / control the player-avatar to the coin. Upon successful collection, the collected coin will disappear from the game & update the Player Score.

Movement Controls:
The following are the key mappings β€”

  • ↑ / W   : move Forward
  • ↓ / S    : move Backward
  • ← / A   : turn Left
  • β†’ / D   : turn Right
  • ⎡ (Spacebar key)   : Jump

Project Details

Environment:

The Game Environment has each individual Episode constrained by a limited time duration i.e. 20 seconds within which both Player & Agent must interact with the Environment & compete to collect as many coins as possible.

Before the game begins, Coins are spawned at random locations within the game environment. The positions of the coins will change with every reset of the environment - environment state reset occurs at the begin of each game session or episode.

The State Vector consists of a Vector of N features obtained from the agent's velocity, along with ray-based perception of objects around the agent's forward direction.


The Action-Space is composed of 5 Discrete Actions are available to the Agent which compose the . They are as follows:
  • 0 : Move Forward
  • 1 : Turn Left
  • 2 : Turn Right
  • 3 : Move Backward
  • 4 : Jump

The Agent can choose among 5 discrete actions at each timestep of an Episode.


Player:

The player can interact with the game Environment / Agent using the Player Controls


Agent:

The Reinforcement Learning Agent is based on the Proximal Policy Optimization algorithm, which is an advanced policy-based RL algorithm.

At each timestep in the Episode the Agent takes an action which follows the optimal policy learnt to collect maximum number of coins in an Episode.


Episode:

Each Episode / Game play-time session is restricted to 20 seconds within which the Agent must interact with the environment to collect as many Coins as possible.


Game Assets:

Most of the assets used in this project are available for free from the Unity Asset Store.

Player Avatar has been created with the Jammo Asset - a friendly bot character πŸ€– presented by Mix and Jam.

Agent Avatar is self-created.

All Avatar animations i.e. running, jumping - have been appropriated from Mixamo.


About

A micro-game based on gamified Reinforcement Learning where the Player competes against an AI Agent. The project has been built with Unity's ml-agents package.

License:MIT License


Languages

Language:C# 83.3%Language:HTML 13.0%Language:CSS 3.7%