Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Path Finding Method??

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

Any Pathfinding is complex, however it varies in complexity from doing a simple 2d game, where we just move the computer''s pixel toward the player''s pixel. However when we get to more complex scenarios it can often come down to very very complex coding.

Much of my work in my game that I''ve been writing, involves a tree structure that is made up of all the possible routes, then I run another function and it get''s rid of all the inefficient paths, then another one sees how many units are moving to the location and breaks them up so as to move without having units clog up paths. This presents a problem however if the user wants them to stay together.

So all in all, there is no simple method, however if you post more details on what you would like your path-finding to do, I''m sure someone will give you some example code or at least explain the method.

My PathFinding algorithm takes about 2500 lines of code, but it is extremely complex, but slightly sluggish.

BTW: mine is being developed for a RTS where there are terrain blockages, trees and other obstacles to avoid.

I wish you luck.

Share this post

Link to post
Share on other sites
The simplest method is object search-around(I think there''s a better name than that - maybe edge-searching). You''ve generated a path( a series of lines or points) and you''ve figured out there''s a collision(you need a collision detection routine done up before anything). Figure out what object it is and keep that handy. Find the next point on your list that is not in collision and what you''re going to do is insert a few points that aren''t in collision with the blocking object. Place a point outside of the blocking object and then test the path again for collisions.
This method is a reasonable approximation if you''ve got wide open spaces with solitary objects hanging about and No thin walls.

Earlier there was
a long discussion on the GameDev of a more complex method that is preferred for more complex situations- A-Star path-finding. It has some links to path-finding discussions.

It really depends on what space you have and what you''re trying to do.

A 2D RPG with skills, weapons, and adventure.
See my character editor, Tile editor and diary at
Check out my web-site

Share this post

Link to post
Share on other sites
Guest Anonymous Poster


Share this post

Link to post
Share on other sites

  • 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!