Skip to content

ActiveState/neuroblast

Repository files navigation

NeuroBlast

Overview

NeuroBlast is a classic arcade space shooter with ML-powered AI using TensorFlow. In this short demo intended to demonstrate the accessibility of open source tools for machine learning, you can train an enemy AI using machine learning.

How it Works

If you want to learn more about how the game works under the hood, and for a tour of the insides, see these two blog posts:

You can also watch my GopherCon 2017 Lightning talk about the game or view the slides.

Installation - Requirements

Before you start, you will require the following external libraries/tools:

Note: TensorFlow for Go is only available of macOS/Linux. Windows is NOT supported.

For any package dependencies, you can either install them via pip/dep or you can also install ActivePython 3.5.3 or ActiveGo 1.8 to have an environment with nearly all dependencies already pre-installed.

Windows Setup Instructions

To setup the game to run on Windows in Python 3:

  1. git clone https://github.com/ActiveState/neuroblast.git
  2. pip3 install -r requirements.txt
  3. Launch rungame.cmd (which will launch the Mongo server).

MacOS/Linux Setup Instructions

To setup the game to run on MacOS/Linux in Python 3:

  1. git clone https://github.com/ActiveState/neuroblast.git
  2. cd neuroblast
  3. mkdir db
  4. pip3 install -r requirements.txt
  5. Launch Mongo server: mongod --dbpath ./db
  6. Launch the game python3 game.py

Note: If you previously had Keras installed on your machine, and had run it using a different backend, make sure you configure your Keras backend to run using TensorFlow by following these instructions.

To setup the game to run on MacOS/Linux in Go 1.8:

Reminder: You must have the TensorFlow C libraries installed as per these instructions.

Note: You must clone the repo into your GOPATH, or add the folder you clone into to your GOPATH in order for dep ensure to work.

  1. git clone https://github.com/ActiveState/neuroblast.git
  2. cd go
  3. dep ensure
  4. go build
  5. Launch the game ./go

Command Line Arguments

There are a number of options available when running the game from Python:

  • -n changes the Neural Network model from using TensorFlow to using the "home grown" network model which is useful for prototyping/debugging.
  • -f launches the game in full screen.
  • -v changes the visualization method to use raw Keras/TensorFlow values. Warning: This is much slower!

Note: These options are not available in the Go version.

Controls

Movement

Control your ship with the arrow keys or the left-analog stick with a gamepad.

Firing

Use either SPACE or the A button on your gamepad to fire. You can hold the button down for continuous fire.

Debug Menu Commands

On the main menu of the Python version, you can use the following commands to export debug data:

x - Exports a model using the SavedModelBuilder functionality to use in the Go version
w - Exports weights.csv which are the trained weights of the current model
d - Exports traindata.csv which is a dump of the training data points currently in memory

Known Issues

  • Collision is not pixel-perfect
  • In the Python version, being hit will slow down your rate of movement
  • You can fly through the enemy ships with your ship (no collision between enemy ships/hero ship)
  • Some gamepad configurations may not work
  • Menu navigation with gamepad is inconsistent

License

Copyright (C) 2017 ActiveState. Licensed under the MIT License. See LICENSE file for details.

Credits

Written by Pete Garcin Twitter/GitHub and Tom Radcliffe.

Gopher Artwork appears courtesy of Ashley McNamara.

Contributing

If you would like to contribute to this project, please visit the Issues tab to see what open issues are available and flagged with Help Wanted. You can also submit a Pull Request with your proposed changes. If they are in response to an issue, please reference the issue in the pull request.

About

NeuroBlast is a classic arcade space shooter with ML-powered AI.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •