Git Product home page Git Product logo

winter-run's Introduction

NOTE: Winter Run has now been solved with PPO! Please navigate here to check it out and disregard everything below.

Winter Run is a game written in TypeScript, Angular, and Phaser that can learn to play itself via a custom genetic algorithm. You can play it live here! After 1000 generations of training over the span of three weeks, the best neural network can make it about halfway through the game. It's possible that a different learning algorithm (for instance, deep Q-learning) may have been able to successfully complete the game.

Installation

In order to run the project locally, you will need to make sure you have Node.js and Angular CLI installed. To check if you have Node, open a command prompt and type node -v and hit enter. If the prompt doesn't tell you the version of Node that you have, you don't have it installed. Here is a link to download it: I highly recommend installing the LTS (long-term support) version. Once the installer has finished, try node -v again and you should see your version of Node show up.

Node Version

From there, using the command prompt, navigate into the directory where you would like to install the Github repository. Then, perform the following five commands:

git clone https://github.com/hmomin/winter-run
cd winter-run
npm install -g @angular/cli
npm install
npm start

The first command clones the repository into your desired location - you can also download it manually off of Github if you don't have Git installed on your machine. The next commands move into the newly created winter-run directory, install Angular CLI globally, install all Node modules and dependencies, and then open the compiled Angular project in your browser.

Winter Run Layout

Functionality

You can start playing Winter Run just by pressing the play button in the middle. Use the arrow keys to move around, the 'g' key to whack enemies with your mallet, and the 'h' key to shoot fireballs at enemies. Each coin gives you a mallet strike and each diamond gives you a fireball you can throw.

Play Winter Run

Alternatively, you can hit the 'autoplay' button to play the best trained neural network from the 1000th generation.

Autoplay Winter Run

You can also click the 'train' button above the game window to initiate training neural networks on the game. Each network takes as inputs 36 values extracted from the scene, including the next drop off location, the next ledge, the nearest distance to a coin, etc. Each network also has 20 hidden nodes and an output layer of 5 nodes. The nodes in the output layer map to LEFT, UP, RIGHT, G, and H, i.e. the action the agent takes. Networks reproduce via simulated binary crossover (SBX) applied to a fitness-proportionate selection of the population. Weights and biases are mutated under a Gaussian distribution. For more information about SBX or mutation, here is a short reference.

Each run-through is a single iteration of a single generation - we can't perform all of the iterations for each generation at the same time within a single browser, since some of the players may affect their enemies and some may not. You can see how progress is being made by viewing the local storage within your browser as the game is training.

Winter Run Local Storage

License

All files in the repository are under the MIT license.

winter-run's People

Contributors

hmomin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.