AI Projects

Hello!
If you're viewing this page, you're probably from my stream
where I've been streaming an AI trying to learn a simple game.

Watch live video from Pieking1215 on www.twitch.tv

Example

Info

The AI in my streams is an implementation of the NEAT algorithm
which was developed by Kenneth O. Stanley and Risto Miikkulainen
to address some of the problems with neural network evolution
algorithms of the time. You can view their paper here.

This specific implementation of the algorithm is loosely inspired by
Sethbling's MarI/O which was originally written in lua.
My version is written in Java, and is fairly similar in structure the
MarI/O code. I'm fairly sure there's some major bugs in my version
though which is why it takes so long to learn.

Common Questions

What's happening? During the stream, the AI is training. This means it is trying to optimize
itself towards a goal (in this case getting as far to the right as possible).
It does this through evolution. Each attempt at completing the course
uses a different genome, representing a different layout of the network.
The initial set of genomes is generated randomly at the start of the training,
and every n (variable) genomes is considered a generation. At the end of each generation,
the genomes that performed relatively well are bred to produce more genomes that
will (hopefully) perform better. These children can also be mutated randomly to
help develop new behavior.

How does the GUI work?
There's a few different areas in the GUI (shown above) that give different information.
(Please note that the current GUI is mostly a direct port of MarI/O's, so credit to Sethbling again.)

The text at the top:


"Gen x" shows what generation the network is in (described above).
"species x" shows what species the current genome is in (Genomes are sorted
into species by their similarity where they compete among themselves instead
of the entire population. This allows room for more diversity.)
"genome x" shows the current genome's id within the current species (described above).
The percentage is how far through the generation the network is.
"Fitness: x" shows the fitness of the current simulation/genome. For this implementation,
the fitness is simply the maximum distance the player moves to the right (if the player gets
to the end, a bonus is added as well). Normally the fitness factors in time, but I simplified
it to make sure the algorithm works first (I also don't care how long it takes).
"Max: x" shows the maximum fitness that was achieved during the current training session.
"Elapsed: x" shows how long the simulation has been running. If "(paused)" is displayed
next to it, the training is currently paused and is being controlled manually (which could
be for a number of reasons).

The boxes and lines in the middle:


The middle represents the network of the current genome. The boxes on the left
are the inputs from the level, where white is positive and black is negative.
The boxes on the right are the outputs, with their corresponding button labeled
next to them. The boxes in the open area in the middle are neurons, which allow
the inputs to be mapped to outputs. The lines represent the connections between
the neurons, and their color shows how they pass their signal. (I suggest watching
Sethbling's video (2:40 to 3:30) for a much better description of this concept.)

Misc:


The chart labelled "average fitness" graphs the average fitness for every previous
generation. It's super fancy and auto-scales to fit the data.
Any text on the bottom is just extra information that I feel like throwing on there.

What language is this written in? / Is there a download? The network code itself is written in Java using mainly core Java libraries. The network code does
depend on the game to feed it events and updates, as well as for some utility functions, so it
is not a standalone program in its current state. There is no download or repo for it because it's
too buggy and sloppy right now. Once it is fully functional and written well, I will probably
upload it here so check back for updates.
(Sethbling's video does have a link to the original MarI/O code, which is somewhat similar and pretty much accomplishes the same task.)
The game the AI is playing (currently unnamed) is in development and as such is not
available for download (again, check back for updates).

I don't remember the other questions asked because I refreshed the Twitch tab and there's no log.
Feel free to ask questions in the Twitch chat if I'm streaming because I'll probably see them this time.