A star Tutorials - SFML

Started by
1 comment, last by EWClay 11 years, 2 months ago

Hi, I am developing a game in C++ with SFML. I have got to the point where I need AI movement and path finding. I have heard that the way forward is using an A star algorithm, but there seems to be such little help on the internet. I have no knowledge of advanced C++ features such as maps, search cells...

Does anyone have some source code I can use for my game or a good tutorial on how to do it (I don't need a tutorial on the principles, I know them; I just don't know how to implement it on C++) I found a good code from

http://code.activestate.com/recipes/577457-a-star-shortest-path-algorithm/

It works very nicely on its own, but as soon as I bring it onto my project in CodeBlocks it shows lots of compiler errors.

Come on, let's get some good stuff in here so that anyone googling this problem can have some good helo

Advertisement

I have no knowledge of advanced C++ features such as maps, search cells...

You also seem to have no knowledge of basic C++ features such as preprocessing, compiling and linking. Go back to the previous thread you made on A* and read the last post again. The way you are trying to integrate external code in your project is fundamentally flawed. You need to figure out how to create and use header files and put multiple source files in a project. If you don't understand advice you are getting in an existing conversation, ask questions rather than giving up and creating a new thread in hopes someone will spoon feed you the answer. Here's the main point you should be concentrating on from that last post: "It's generally a bad idea to #include a .cpp file. You should include only .h header files."
In the event that someone looking for help with A* does stumble on this thread, don't use that that code: it's awful, verging on ridiculous.

It would be better to understand the algorithm and write the code yourself. There's a good explanation here:

http://www.policyalmanac.org/games/aStarTutorial.htm

This topic is closed to new replies.

Advertisement