skip to Main Content


Given a 2-dimensional plane (say, 800×600 pixels or even 4000×4000) that can contain obstacles (static objects) or entities (like tanks, or vehicles), how can computer-controlled tanks navigate the map without colliding with static objects while pursuing other tanks? Please note that every static object or entity has the ability to freely rotate at 360 degrees and has an arbitrary size.


What I am really trying to do is to develop a game with tanks. It initially started as a modern alternative to an old arcade game called “Battle City”. At first, it might have been easy to develop an AI, considering the 13×13 grid, fixed sizes and no rotation. But now, with free rotation and arbitrary sizes, I am unable to find a way of replicating such behavior in these circumstances.

The computer-controlled tanks must be able to navigate a map full of obstacles and pursue the player. I think that the main problem is generating all the possibilities for a tank to go to; the collision system is already implemented and awaiting to be used. For example, tanks might be able to fit through tight spaces (which can be diagonal, for instance) just by adjusting its angle of rotation.

Although I have quite some experience in programming, this is way beyond my reach. Even though I would prefer a broader answer regarding the implementationn of tank’s artificial intelligence, a method for generating the said paths might suffice.

I initially though about using graphs, but I do not know how to apply them considering different tanks have different sizes and the rotation thing gives me a headache. Then again, if I would be using graphs, what will a node represent? A pixel? 16,000,000 nodes would be quite a large number.

What I am using

I am looking forward for your guidelines. Thank you for your time!



  1. I’ve been working on a project of crowd simulation that included path finding and obstacles/other people avoidance.

    We’ve used the Recast Navigation, a all-in-one library which implements state-of-the-art navigation mesh algorithms.
    You can get more info here :

    In our project, it has proven to be reliable and very configurable. Even if it’s written in C++, you can easily find/make a wrapper (in our case, we’ve been using it wrapped in Javascript on a Nodejs server!)

    If you don’t want to use this library, you can still take a look at Navigation Meshes, which is the underlying theory behind Recast.

    I hope it will help!

    Login or Signup to reply.
  2. Navigation Mesh, that’s what ur looking for. To explain a bit, it’s in theory really easy. U build ur World (2D/3D) and after creation u generate a new mesh, that tells entities where they are allowed to move, without colliding with the surroundings. They then move on this mesh. Next is the path generation algorithm which is basically nothing else then checking in any mathematically form how to get on this mesh to it’s target. On an actual navigation mesh, this get’s rather complicated but easy if u think of a grid where u check which fields to move to get the shortest way.

    So short answered, u need any type of additional layer of ur world, that tells the AI where it is allowed to move, and any kind of algorithm that fits ur type of layer to calculate the path.

    As a hint, for unity as an example, there are many free good build solutions. Also u will find a bunch of good libraries to achieve this without a game engine like unity.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top