Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

Pathfinding algorithm for AI selection

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Aurioch   Members   


Posted 12 January 2013 - 07:04 AM



Argh, I hate intruduction XD Oh well. I'm developing Battle City (check my journal for detailed explanation) and I wanted to improve AI for it soon (after I fix other issues). It's currently using something I dubbed for myself "stupid AI" - AI that decides where to go and when to shoot based on chance and randomizer. It works for start but isn't challenging for the player, making the game somewhat boring.


After finding link for this article here on GameDev.Net I learned about AI architectures and decided to go with Behavior tree with 3 states: Roaming, Attacking and Pushing. Roaming state would be the same as the AI that is currently in action; Attacking and Pushing state make things interesting.


My idea is this:

When AI tank comes to the set distance from base, he would enter into Pushing state and start going towards the base in order to destroy it.

When AI "sees" player (meaning AI tank came to a set distance from player tank and there are no walls between them) AI would start chasing player in order to destroy him.

Player is prioritized over base, meaning that when conditions from both states are met, AI goes into Attacking state.


For both these states, I need a suitable pathfinding algorithm. There are 2 things that need to be taken into consideration:

1) Level is tile based, but tanks are not limited to move from tile to tile. They still move in 4 directions only.

2) One type of obstacles is destructable. And by that I don't mean "shoot it and it's removed", I mean "destroy it piece by piece".


Attachement has an example of enemy tank (red circle) switching from Roaming to Pushing state. There are 4 possible attack paths.


I've did some research myself but was unable to find anything I could use. At least I think. I've considered A* and Influence map, but from what I understood A* is best for completely tile based movement, and my game is too simple for influence mapping.


After whole wall of text, finally the point of the post:


Which pathfinding algorithm would You suggest and could You explain it by little, either by general idea, pseudocode or link to an article that explains it?


Thanks for your time to read :)

Attached Thumbnails

  • Pathfinding.jpg

#2 Morphex   Members   


Posted 12 January 2013 - 07:23 AM

<p>Well, pathfinding you have the A* (read A star) pathfinding algorithm.</p>
<p>The concept is simple, you have your map nodes (tiles). And you try to find the perfect path to move toward the desired node by moving toward the desired location.</p>
<p>This tutorial series have good info:</p>
<p><a href="http://xnatd.blogspot.pt/2011/06/pathfinding-tutorial-part-1.html">PathFinding for XNA</a></p>
<p>Also by a general search here on gamedev you will get loads of information on the subject.</p>

Edited by Morphex, 12 January 2013 - 04:52 PM.

Check out my new blog: Morphexe 

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.