• Advertisement
Sign in to follow this  

A* and c++

This topic is 4662 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need just a snippet of code and what I can apply this ai approach to such as pac man , I am just learning A* pathfinding

Share this post


Link to post
Share on other sites
Advertisement
A quick google search of astar c++ source comes up with quite a few implementations.

For a game like PacMan, you would build a connectivity graph of all the intersections, give it the point you are at and the point you are interested in, then run the algorithm. If you aren't familiar with the algorithm, Game Programming Gems 1 covers the algorithm pretty well.

frob.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
The actual AI of Pac Man has nothing to do with A*, though.


Yep... there have been several good expositions of how the AI in Pacman worked posted within this forum. Search the forum archives and you should find them without much effort! If you just want to learn A*, just restrict yourself to finding a simple path in a 'grid world'. Start with no obstacles to ensure that you have the algorithm working properly, then add static obstacles. Finally you can deal with dynamic obstacles, which will require you to extend the algorithm beyond what would be classed as 'A*'.

Share this post


Link to post
Share on other sites
this tutorial seems kindoff pacmanish http://www.geocities.com/jheyesjones/astar.html

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement