About NEAT Bullets

NEAT Bullets is a tool for Unity that allows you to create weapons that have unique 2D projectile flight patterns. Trajectory of projectiles is determined by a set of parameters and an artificial neural network generated using the NEAT algorithm1.


General Idea

flowchart TD
	NN([Network evolved by NEAT])
	input0(RelativePos.x)
	input1(RelativePos.y)
	input2(DistanceFromOrigin)
	input0 --> NN
  	input1 --> NN
	input2 --> NN

	output0(x)
	output1(y)
	output2(hue)
	output3(maxSpeed)
	output4(force)

	NN --> output0
	NN --> output1
	NN --> output2
	NN --> output3
	NN --> output4
  • Each weapon contains a single network evolved by the NEAT.

  • Every fixed update, every projectile instantiated by a weapon, inputs its current position relative to the position of its spawn point RelativePos.x, RelativePos.y and distance from the spawn point DistanceFromOrigin into the network.

  • The network is activated and outputs following values for this fixed update:

    1. x component of the projectile’s force or velocity vector
    2. y component of the projectile’s force or velocity vector
    3. hue component of the projectile’s color
    4. maxSpeed of the projectile
    5. force is the magnitude of force or velocity vector

Depending on Weapon Params, the projectile interprets outputs from a neural network differently.


  1. SharpNEAT - C# implementation of the NEAT algorithm used in this project. 


Back to top

Page last modified: Jun 25 2024 at 04:30 PM.