Path Navigation AI


Introduction

Video game technology has come a long way since the early days of arcade games in the 70s and 80s. As games become more realistic, the challenges faced by game developers are increasingly similar to those encountered in serious simulations. One major challenge is creating self-controlling entities that can interact with unknown environments.

This project focuses on using artificial intelligence and machine learning in game development. We’re developing a game where players can create a course for a tank to navigate. The tank, controlled by AI, must learn to traverse the course efficiently while avoiding obstacles like mines and guns.

The game includes a scoring system that rewards players for creating more challenging courses. The more difficult it is for the tank to complete the course, the higher the player’s score.

The tank uses a neural network with 13 inputs to make decisions about movement and obstacle avoidance. It learns through an iterative process, improving its performance over multiple generations. If the tank collides with walls, runs over mines, or is destroyed by guns, the simulation restarts. The goal is for the tank to complete a set number of laps without incidents.

Genetic Algorithm Methodology

The project uses a genetic algorithm approach, which mimics natural selection. Here’s a simplified explanation of the key steps:

  1. Initialization: The process starts with a set of random solutions.

  2. Selection: The best solutions are chosen based on how well they perform.

  3. Reproduction: New solutions are created by combining and slightly changing the best existing solutions.

  4. Termination: This process repeats until certain conditions are met, such as reaching a specific number of generations or finding a satisfactory solution.

In this project, we use a method called Elitism, where the best solution is automatically selected to be part of the next generation.

Neural Network

The project uses a type of artificial intelligence called a neural network. Think of it as a simplified model of how a brain works. It takes in information (inputs), processes it through interconnected nodes (like brain cells), and produces an output (a decision).

In this case, the neural network takes information from 13 sensors on the tank. It processes this information to decide how the tank should move and steer.

Neuroevolution

Neuroevolution combines genetic algorithms with neural networks. It’s a way of improving the neural network over time, similar to how animals evolve to be better suited to their environment over generations.

In this project, we start with a simple version of the tank’s “brain” (the neural network). As the tank tries to navigate the course many times, we keep the versions that perform best and use them to create new, potentially better versions.

Implementation

Unity3D, a popular game development platform, is used to create this game. Here’s how to set it up:

  • The tank model has 13 sensors to detect obstacles around it.
  • The game environment includes walls, mines, and guns as obstacles.
  • The tank learns to navigate using information from its sensors.
  • Each time the tank runs the course, it’s called a generation.
  • We create multiple generations, with each one potentially better than the last.

The learning process works like this:

  1. We start with 50 generations maximum.
  2. For the first generation, we create 10 different versions of the tank’s “brain”.
  3. We test each version and see how far it can go without crashing.
  4. For the next generation, we create new versions by:
    • Combining the best performing versions (crossover)
    • Making small random changes (mutation)
    • Keeping the best version unchanged (elitism)
    • Adding some completely new random versions

This process repeats until the tank successfully completes the course or we reach the maximum number of generations.

Screenshots

Conclusion

This project shows how a relatively simple AI system can learn to navigate a complex environment. The tank, starting with only 13 input sensors and no specific instructions, learns to avoid obstacles and complete the course.

While this AI isn’t as advanced as human intelligence, it demonstrates the potential of artificial neural networks in handling complex, unpredictable scenarios. This approach could be valuable not just in games, but in various fields where systems need to adapt to new situations with minimal pre-programming.

Neuroevolution could become a powerful tool for creating adaptive systems in many areas. It allows for the development of AI that can learn and improve its performance over time, potentially leading to more robust and flexible solutions in fields ranging from robotics to data analysis.


Code - https://github.com/chiragbharambe/Path_Navigation_AI

Publication - Designing a Neural Network to Train a Bot to Traverse Through an Arbitrary Course. ISSN(e): 2321-2063, Volume 7, Issue 7