Hero Must Die



    Hero Must Die is a game created in 72 hours for the Ludum Dare 25 game jam. The theme of the jam was "You are the villain", so I made a puzzle game where you have to figure out how to make the levels impossible for an AI to beat them given limited resources.
The AI uses Neuro-Evolution of Augmenting Topologies (NEAT) to evolve a neural network capable of beating the levels.
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.

    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.



It currently runs on Windows only.

Video of the AI in action:

YouTube Video


Comments