I had a lot of fun this Ludum Dare, and I think that of all of my submissions the one I submitted this time is the best.
Here is a link to my submission: Link
There is also a post-compo version available, with more items and levels (as well as a smarter AI).
When I first saw the theme, I wasn’t sure if I should participate. But, I came up with an idea that tied in with some AI research I was doing. The game uses neural networks, which is pretty uncommon. But, it really is the only way to do it in this case. Path-finding and other methods are far too rigid to be able to adapt to arbitrary environments. Also, it is difficult to create a character control system that can predict how to move in the air in order to land on a platform. Path-finding can be complementary to the neural network, but I left it out since it is too processing intensive. I instead just made all levels pretty linear (the AI always moves to the right).
When I started out writing the game, I was pretty sure that the AI would fail miserably. But I at least wanted to try it out. To my surprise, however, it almost immediately (usually in less than 10 generations) was able to comprehend how to jump from platform to platform. However, by the time I got it working, I squandered too much time on YouTube to be able to submit it for the 48 hour compo. So I submitted it for the Jam.
I started out the AI with 25 inputs, arranged in a rectangular grid around the hero. These inputs were set to the corresponding tile values. This acts as vision.
I later added the signed x and y distances of the player from the goal (princess), so it could learn the map better and not be fooled by structures that look the same from its point of view in different locations.
In the post-compo version, I also added the x and y velocities, which improved the behavior significantly.
The outputs of the network are arrow-key controls (left, right, up). To test the physics, I started by having the controls respond to keys, and I then later let the AI control it. If a output is greater than 0.5, then the key was activated. Otherwise, it was left inactive.
The neural network is recurrent, and is evolved using the NEAT (Neuro-Evolution of Augmenting Topologies) technique to evolve connection weights as well as network structure simultaneously. I had the NEAT algorithm coded prior to the competition. It comes with a visualizer, which uses another genetic algorithm to produce images of the networks. Check it out here: Link
The NEAT algorithm itself is very generic, feel free to use it in any of your own projects. The visualizer uses SFML, but you can leave it out if you don’t want it.
Here is an example of what the NEAT visualizer shows. In this image, it learned a XOR gate.
Other than the AI, the game is nothing special.
What went right:
– AI was able to beat levels as intended.
– The training process ran at an acceptable rate.
– The map editing interface was relatively easy to use.
– Sounds were indicative of events (thanks to BFXR).
What went wrong:
– The menu system (there is none).
– The graphics. It was an ugly grid with rectangles with legs as characters. Also, some people got black screens. This was fixed, but perhaps too late.
– The items. There were only 3, which made puzzles repetitive.
– The levels. They were mostly too easy, I ran out of time when making them. Also, there were not enough of them.
– No music.
I might make a post-post-compo version. I kind of like designing puzzles for this game.