Skip to content

crismariudenis/DotsAi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DotsAi

My first attempt at using an Neural Networks with an evolution algorithm.

Game Rules

1.The goal(red dot) spawns at the top and bounces against the walls
2.The players(black dots) spawns at the bottom
3.The best player in previous generation(green dot)
4.The dots die if they touch the wall
5.The dots are removed if they touch the goal
6.The dots receive point every frame if they're near the goal
7.The game end when the all dots are dead or the time passed

Editable neural network shape

In the Main class

public static int[] nnShape = new int[]{4, 8, 4};

Change these values to create different behaviors

Input Layer

ArrayList<Float> input = new ArrayList<>(Arrays.asList(pos.x + vel.x - (goal.x + goalVel.x), pos.y + vel.y - (goal.y + goalVel.y), pos.x - goal.x, pos.y - goal.y));

Output Layer

ArrayList<Float> ans = nn.process(pos, vel);
float up = ans.get(0);
float down = ans.get(1);
float right = ans.get(2);
float left = ans.get(3);

The goal is to create a spinning behaviour around the target with a minimum numbers of inputs

Something like this

NoiseSpinning.mp4

About

This project was my first attempt to use Neural Networks using an evolution algorithm.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages