Planning routes on a grid system

Hello!

So in this thread (Moving around obstacles - Unity Engine - Unity Discussions) I explained what I wanted to do: make batalions of soldiers move from point A to point B, while avoiding obstacles. I was suggested to use the AI system. For the most part, it sort of works, but it makes the army’s movements look very sloppy and overall I don’t like it.

So I’ve decided to do a grid system, not only to avoid using the Unity AI, but also as kind of a C# practice project for me as well. I’m curious, how would you plan routes based on what grids you can and can’t go on?

For example, here a route is possible:

But here a route is impossible:

Basically, how would you go about detecting if a route is possible in such a grid system? Would I have to use Matrixes?

Thanks for any ideas, happy coding :slight_smile:

You’ll want to read up on the A* pathfinding algorithm.

1 Like