Neuroevolution in Unity
A downloadable project
Maze Runners: Neuroevolution in Unity
50 AI agents learn to escape a maze from scratch, using a genetic algorithm and small neural networks. There’s no pathfinding and there are no scripted routes; every path is discovered by evolution.
I originally made this in an airplane ride, i achieved agents that learn how to find a goal, although they struggled a lot with walls. They were simple genetic code based algorithms though.
Recently i updated it with some more functionality like a small neural net for agent, so they learn behaviors (like not bouncing into walls) rather than a specific map.
How it works
- Each agent has a neural network that reads 8 wall-sensing rays and a line of sight to the goal, then decides how to turn.
- The best agents survive each generation. The rest are bred from them with crossover and mutation.
Problems solved
- Agents spinning in circles: fixed with a no-progress timeout, loop detection and novelty search.
- Dead ends that look close to the goal: fixed with line-of-sight rewards for seeing the goal and leaving spawn behind.
- Inconsistent results from the same brain: fixed with a deterministic, fixed-timestep simulation.
- Progress stalling: fixed with adaptive mutation and growing episode lengths.
Features- 4 levels of increasing difficulty, plus a test arena.
- Start, pause and restart, with simulation speed from 0.1× to 30×.
- Replay any past generation’s best agents, with their paths drawn on screen.
- Toggleable sensor and goal-ray visualisation.
- Live stats.
| Published | 5 days ago |
| Status | On hold |
| Category | Other |
| Author | RomaPrats |
| AI Disclosure | AI Assisted, Code |
Download
Download
Mlbuild (2).zip 43 MB



Leave a comment
Log in with itch.io to leave a comment.