gaoyuankidult / Whiteboxing-UnityMLAgents

Experimental testbed where I test various Machine Learning & AI concepts using Unity ML Agents.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Whiteboxing-UnityMLAgents

Experimental testbed where I test various Machine Learning & AI concepts using Unity ML Agents. Note that this is a work in progress that I am sharing "as is" as I build and expand new ML scenarios.

Unity version: 2018.1.0b13 (beta) Unity ML-Agents version: 0.3.1b

Environments

Rat & Cheese (single): The rat (gray ball) should run to the piece of cheese (yellow cube). The rat is given the relative position of the cheese in relationship to itself. Agent Reward Function:

  • +0.1 if getting closer.
  • -0.05 time penalty.
  • +1.0 when reaching target.

Rat & Cheese (single) at runtime after training

Rat & Cheese (multiple cheese): The rat (gray cube) collects all the pieces of cheese (yellow cube) on the board. The rat does not know where the cheese pieces are, it uses raycasts to detect the cheese as it moves around. Agent Reward Function:

  • -0.2 penalty if the rat hits a wall.
  • -0.005 time penalty.
  • +1.0 when reaching a piece of cheese.

Rat & Cheese (multiple cheese) at runtime after training

Civilization: The goal is to re-create an ML-based AI for an RTS-style game like Age of Empires, such as gathering resources, building structures, and eventually fight other units. The current iteration shows a single "villager" unit, gathering wood from nearby trees, and eventually building a farm, which costs 100 units of wood. The models included here are far from perfect and this is still very much a work in progress. Stay tuned for more updates.

Civilization/Villager at runtime after training

Project Setup

  • The TensorflowSharp plugins folder was omitted from this project due to the massive file sizes. You will need to import this set of Unity plugins yourself. You can download the TensorFlowSharp plugin as a Unity package here.
  • There is currently a bug where if you use all the duplicate platforms for training, all the rats & cheese will spawn on the same platform since the initial spawn values are hard-coded and not relative to each board. regardless, it does not affect the training as they all still run independently from one another.

Follow Me

About

Experimental testbed where I test various Machine Learning & AI concepts using Unity ML Agents.


Languages

Language:C# 100.0%