Natural Looking Pathfinding

Started by
13 comments, last by Blackheart 19 years, 10 months ago
Hi again,

Adjusting the diagonal cost helped a lot with the initial path - I feel really dumb for not thinking of that! The final path looks MUCH better now using the new heuristic and cutting out unnecessary nodes like Mark suggested. I''m also looking into splines to help smooth out the turns.

If anyone else is interested, both of the AI Game Programming Wisdom books have some excellent articles on pathfinding too.

Thanks for all the help and suggestions.
Advertisement
It seems to me that the path could be even shorter. If it is not too expensive then you could, when creating your white final path, have the program try moving the points further along the blue line - all the time testing if it still has line of sight. This would shorten your path from node 5 (counting in the start node) on the white path.
Dont know if the other solutions already solved your problem - if so: could you post an image of the new path? Anywho. Just thought I''d post this suggestion.
Now don''t slap me - I have no experience in pathfinding at all

Emil Johansen
- SMMOG AI division
http://smmog.com
Emil Johansen- SMMOG AI designerhttp://smmog.com
Ok, firstly, I am aware that there is possibly a bug in my own path optimisation code, it doesn''t always seem to work right (although I believe the principle is sound, which is why I posted the pic)

Secondly, I did originally allow diagonal movement in my A* algorithm, but I realised that it created a lot more work, and resulted in what was basically the same path after optimisation. So I removed the diagonals, hence the "zig-zag" of the blue path. My characters don''t actually use the blue path for walking around anyway.

What I did do, was left in the diagonal rule in the heuristic calculation, which causes it to zig-zag.

Mark
It''s not quite that easy because the line-of-sight path may be much more costly than the computed path. For example, the line of sight path may require you to cross rough terrain, while the computed path follows a road.

John Bolton
Page 44 Studios
Current project: NHL Faceoff 2005 PS2
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
I did consider that, I think the line-of-sight can work as long as you''re going across the same sort of ground.

The A* output should provide the least expensive route, then you apply the line-of-sight afterwards. If you only use the line-of-sight across consistent ground, it shouldn''t make the route any more expensive ever.

Mark

This topic is closed to new replies.

Advertisement