Git Product home page Git Product logo

ml-agents-snowball-fight's Introduction

Snowball Fight 🎄☃️, a multi-agent environment for ML-Agents

A multi-agent environment using Unity ML-Agents Toolkit where four agents compete in a 2vs2 snowball fight game.

The Environment

  • Four agents compete in a 2 vs 2 snowball fight game.
  • The goal is to hit the opponent team while avoiding the opponent and your teammate snowballs ❄️.
  • The aesthetics follows the ML-Agents and the implementation is inspired by the SoccerTwo environment.

Observation Space

  • Vector Observation space: 336
    • 11 ray-casts forward distributed over 100 degrees.
    • 3 ray-casts backward distributed over 90 degrees.
    • Each of the raycasts detecting 6 possible object types, along with the object's distance.
      • Hence each raycast state dimensions = nb of possible object (6) + Vector3 object's distance (3) * three obs stack (3) = 6+3*3 = 27.
      • Therefore, the forward ray-casts contribute 264 state dimensions and backward 72 state dimensions over three observation stacks.
    • Bool canShoot (you can only shoot a snowball every 2 seconds).

Action Space (Discrete)

  • Vector Action space:
    • Four branched actions corresponding to forward, backward, sideways movement, rotation, and snowball shoot.

Agent Reward Function (dependant):

  • (1 - accumulated time penalty): when a snowball hit one of the opponents accumulated time penalty is incremented by (1 / MaxStep) every fixed update and is reset to 0 at the beginning of an episode.
  • (-1) When a snowball hit one of the agent of the team.

How to use it

On ML-Agents

  • 3️⃣ Put the SnowballFight.yaml file to your ML-Agents folder into .\config\ppo.

On Unity

  • 4️ Open the Unity Project Project in ML-Agents repo.
  • 5️ Import package > Custom package snowballfight.unitypackage file.

The next steps

  • (Currently updating it) Allow the simulation to continue until one of the team is completely defeated.
  • Preparing an article that explains how Snowball fight works and multi-agents (Elo rating system, self-play etc), in the meantime if you want to know more about multi-agents check this amazing blogpost from Unity team.

ml-agents-snowball-fight's People

Contributors

simoninithomas 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.