• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Altaf

Need Code for A star path finding

16 posts in this topic

Hi guys, Can any body send me A star ( A* ) path finding code in C++ for DirectX. Thanks in advance.
0

Share this post


Link to post
Share on other sites
A* pathfinding has exactly nothing to do with DirectX.

I googled for "a star pathfinding" and the first result leads you to a very accurate description of the algorithm. If you know C++ to begin with, it is a quite simple task to write an implementation of your own.
0

Share this post


Link to post
Share on other sites
I specified DirectX because I googled for A* code & i found some source code which was either complete C code or a C++ code made using some library which I don't have. I am working on building my own code. Hopefully I`ll finish it soon, but I need a working code for reference.
0

Share this post


Link to post
Share on other sites
As Nik02 pointed out - searching and pathfinding algorithms such as A* are independent of a multimedia technology such as DirectX. Or, more specifically, there is nothing in the DirectX suite that is directly related to A* implementations therefore this thread is better served by another forum - I'm moving this to AI [smile].

Also, I strongly suggest that you do some more research into example code - path finding is a very thoroughly covered subject. There are a huge number of books devoted to the subject and I've got several gaming-specific books on my shelf that discuss A* and related topics.

Cheers,
Jack
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Altaf
I am working on building my own code. Hopefully I`ll finish it soon, but I need a working code for reference.

You can check out this link. It has binary and source code (chapter5 is about path finding).
I find "Programming Game AI by Example" to be a pretty good book, and I would recommend you to buy it if you want to learn further AI techniques.
Cheers
StratBoy61
0

Share this post


Link to post
Share on other sites
Quote:
Original post by StratBoy61
Quote:
Original post by Altaf
I am working on building my own code. Hopefully I`ll finish it soon, but I need a working code for reference.

You can check out this link. It has binary and source code (chapter5 is about path finding).
I find "Programming Game AI by Example" to be a pretty good book, and I would recommend you to buy it if you want to learn further AI techniques.
Cheers
StratBoy61




Amazing that they have all that soutce online ....


This one also looks like it has A* source code
http://www.wordware.com/files/games/
0

Share this post


Link to post
Share on other sites
http://www.google.com

or

http://www.please-do-my-homework-assignment.for.me.com
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
http://www.please-do-my-homework-assignment.for.me.com

There's no need to assume bad faith. Someone working in DirectX is far more likely to be making a game than taking an AI class.

0

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
http://www.please-do-my-homework-assignment.for.me.com


Amazingly, that website *is* valid, altough its the same as just www.me.com.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Altaf
Thanks a lot guys....


They did actually give you quite a bit of help, you know. Programming is not about copy-pasting tutorials and piecing a game together. It's about understanding algorithms and being able to code them yourself. You've gotten to the point in your game (if you're looking for A* code) where you can't copy-paste tutorials anymore. Everything from this point forward is going to be writing code that works with your engine. So... read the algorithm descriptions and write it. It'll take you a few days, but it's really not that hard.

And as mentioned DirectX is zero-percent related to A*. DirectX is rendering. A* is game-logic. Game logic should never be dependant on rendering. i.e. you can write A* code for a game that uses DirectX and then switch the engine to openGL and not have to touch a single line of code in your A* code.

The format of the A* grid, for instance, is going to be dependent on how your level geometry works.

Anyway, did you have questions specifically about how the A* algorithm works? Are there parts you don't understand that are preventing you from coding it?

-me
0

Share this post


Link to post
Share on other sites
I wrote a working code. My problem is the returned path is correct but not the shortest path. I guess my parent list has a problem.
0

Share this post


Link to post
Share on other sites
Or your heuristic is not correct, if your heuristic is too high or too low you won't get the best results. If you always set your heuristic to 0, do you get the shortest path?

Try not to compute your heuristic, so that the A* formula F = G + H is F = G, that way your algorithm will become Djisktra's, it will search alot more nodes, but it should give you the shortest path. If it doesn't, check your parents, etc.. if you do get the shortest path.. make sure your heuristic is good.
0

Share this post


Link to post
Share on other sites
http://www.cs.ualberta.ca/~games/pathfind/libpathfind/0.1.0/doc/index.html

This is exactly what you need. I use it and it's great!
0

Share this post


Link to post
Share on other sites
Developing Games in Java by Laurence Vanhelswue will definitely help you getting to learn many AI techniques.
Also I will create a C++ version of A Star path finding on my site http://www.01fes.com/
-1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0