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
- C# as the main programming language;
- MonoGame (XNA Framework alternative) for rendering;
- RotatedRectangle class (http://www.xnadevelopment.com/tutorials/rotatedrectanglecollisions/rotatedrectanglecollisions.shtml).
I am looking forward for your guidelines. Thank you for your time!