Giter Site home page Giter Site logo

magodev / agario-ai Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wagenaartje/agario-ai

0.0 1.0 0.0 239 KB

Neural agents learn to play in an agario-like environment with Neataptic

Home Page: https://wagenaartje.github.io/agario-ai/

License: MIT License

HTML 0.06% JavaScript 99.94%

agario-ai's Introduction

Agar.io-AI

This repository shows how you can use Neataptic to succesfully teach neural networks to play Agar.io. You can see the genomes live in action here. These genomes have been trained for over 1000 generations, and definetely show sume human-like traits. Visualisation done with P5.js.

Read an article on this repo here.

Settings

If you manage to optimize the settings, please perform either a pull request or create an issue here.

Settings (contained in js/main.js):

  • WIDTH set the width of the playing field
  • HEIGHT set the height of the playing field
  • MAX_AREA set the maximal area a genome can acquire
  • MIN_AREA set the minimal area of a genome
  • RELATIVE_SIZE set how much migger a genome should be to eat a blob
  • DECREASE_SIZE set how much area is kept each round
  • DETECTION_RADIUS set how far a genome can see (pixels)
  • FOOD_DETECTION set the maximal amount of food blobs a genome can detect
  • PLAYER_DETECTION set the maximal amount of other genomes a genome can detect
  • MIN_SPEED set the minimal multiplier speed a genome can have (bigger genomes move slower)
  • MAX_SPEED set the maximal multiplier speed a genome can have (smaller genomes move faster)
  • FOOD_AREA set the area of food blobs
  • FOOD_AMOUNT set the amount of food blobs on the field
  • PLAYER_AMOUNT set the amount of genomes that play on the field (population size)
  • ITERATIONS set the amount of iterations/frames each generation is tested for
  • START_HIDDEN_SIZE set the amount of hidden nodes each genome starts witch
  • MUTATION_RATE set the mutation rate
  • ELITISM_PERCENT set the percentage of elitism

Most important setting:

  • USE_TRAINED_POP setting this to false will start the evolution from scratch (USE THIS WHEN OPTIMIZING THE SETTINGS), setting this to true will use the pre-trained population

Default setting values

var WIDTH            = $('#field').width();
var HEIGHT           = 800;

var MAX_AREA         = 10000;
var MIN_AREA         = 400;

var RELATIVE_SIZE    = 1.1;
var DECREASE_SIZE    = 0.998;

var DETECTION_RADIUS = 150;
var FOOD_DETECTION   = 3;
var PLAYER_DETECTION = 3;

var MIN_SPEED        = 0.6;
var SPEED            = 3;

var FOOD_AREA        = 80;
var FOOD_AMOUNT      = Math.round(WIDTH * HEIGHT * 4e-4);

// GA settings
var PLAYER_AMOUNT     = Math.round(WIDTH * HEIGHT * 8e-5);
var ITERATIONS        = 1000;
var START_HIDDEN_SIZE = 0;
var MUTATION_RATE     = 0.3;
var ELITISM_PERCENT   = 0.1;

// Trained population
var USE_TRAINED_POP = true;

agario-ai's People

Contributors

wagenaartje avatar

Watchers

James Cloos 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.