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 pointDistanceFromOrigin
into the network. -
The network is activated and outputs following values for this fixed update:
x
component of the projectile’s force or velocity vectory
component of the projectile’s force or velocity vectorhue
component of the projectile’s colormaxSpeed
of the projectileforce
is the magnitude of force or velocity vector
Depending on Weapon Params, the projectile interprets outputs from a neural network differently.