A* and c++
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
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.
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.
The actual AI of Pac Man has nothing to do with A*, though.
enum Bool { True, False, FileNotFound };
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*'.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement