How I Trained an AI to Play My Mobile Game

Reinforcement Learning

The Game

The Observation Space

Game board with 5 basic colors

The Action Space

Making the Game Playable by a Computer

Agent using a gym environment with external game logic

Obtaining a Working PPO Agent

Things I Learned While Training My Agent

Start Small

Input Encoding

Network Architecture

Training for a 3x3 board with 2 colors

Scaling Is Hard

Performance for pre-trained network on 7x7 board with 5 colors
Network architecture for 7x7 board with 5 colors

Integrating the Agent Into the Game

So, how does it perform?

GIF of agent playing the game

What Can It Be Used For?

Balancing and Level Design

NPC or Opponent

Assistant

Final Thoughts

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store