Jump to content
  • Advertisement
Sign in to follow this  
X5-Programmer

A* Into 3D Terrain.

This topic is 5386 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

Hi, I have made an 3D terrain and now I whant to insert an PathFinding of some sort, first I have think about using the A*. Allright I whant it to do this, I have an object in this case it is a stone on the left side on the terrain.. Now I whant the stone to move to the right side and search the best way to reach its goal(the right side), but it cant just take the straight way over the hills if you know what I meen, how do it setup the pathfinding on an terrain if I whant this to work? I have not to god knowledge about pathfinding so were can I find something about this? is there any examples out there source/tutorials? hope someone can point me somewere. Edit : I use 3D - OpenGL. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
There are some decent articles here at Gamedev about A* in the Articles -> Programming -> Artificial Intelligence section.

Share this post


Link to post
Share on other sites
Quote:
Original post by X5-Programmer
Edit : I use 3D - OpenGL.
Good thought, but pathfinding doesn't have anything to do with what 3d api you're using. It's only concerned with data structures.

I'm just pointing this out to get rid of this confusion early. We had one poor fellow in here once that just couldn't get it through his head that pathfinding didn't care about how he was drawing stuff to the screen.

Share this post


Link to post
Share on other sites
C-Junkie:

I have got this question 1000 times... What do you use opengl or directX, 2D or 3D so now I always say what I use...

I Know that pathfinding doesn't have anything with 3d api..

Share this post


Link to post
Share on other sites
Hi,

A quick google search will give you tons of infos on how to use / implement A*.

Check out the articles here on GameDev and check out James Matthews' Generation5.org website. He has a sweet "A* explorer" with code provided, so you can easily learn from that.

Cheers

Eric

Share this post


Link to post
Share on other sites
Hi there!

In my pathfinding I've used a cost for each "tile"... for instance; it´s cheaper to travel downhill (if the angle from the previous is within the allowed travel angle for the unit), and more expensive to go uphill.

Normal, flat ground = 5 points
Height difference = -+ up to 5 points
Type of Terrain = + up to 5 points.

Then simply do A* as normal.

This would make a unit for instance skip a high hill path if there's another, less demanding path... OR if there's a paved road through the hills, he would then take that path.

This works GREAT! :)


Hope it helps!


Regards;
Robert

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!