• Advertisement
Sign in to follow this  

some question about A*

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

i have some problems about A* that i think its about extensions and adaptations of it for games.

 

1) most of examples of A star i see they just use a wall as an obstacle. but i want to know what if there is neck in the map. i want to know how can i do that the agent dont throw in necks and holes.

 

2) basic A* makes current position as seen list to dont search for it again but it doesnt work that the goal is moving. sometimes you have to see a point many times to follow the agent. i want to know how to fix it.

 

as you may find, i know the basics of A* but i dont know how to adapt it to work well in a comprehensive game. i have read that navigation meshesh are just complex extension of A*. is there a good advanced reference to tell what are good techniques to make best path finding in a game?

 

thank you for helping.

Share this post


Link to post
Share on other sites
Advertisement


1) most of examples of A star i see they just use a wall as an obstacle. but i want to know what if there is neck in the map. i want to know how can i do that the agent dont throw in necks and holes.

 

Can you clarrify this question? I'm a little uncertain what you mean by neck. If you have a hole in your map (rather than a wall) which you don't want the AI to go into you treat it exactly the same way, you would just build your pathing graph to avoid the hole. If you have a place that is too thin for an AI to pass but can let other AI through then you just need to add some extra information to the graph such as maximum width possible for each edge. That will allow you to avoid edges/paths that are too thin for some of your AI.


2) basic A* makes current position as seen list to dont search for it again but it doesnt work that the goal is moving. sometimes you have to see a point many times to follow the agent. i want to know how to fix it.

 

If the goal is moving you have no choice but to recalculate a path. What people typically do is calculate a path once, then start following it for a few a short time, then if the target has moved you recalculate the path and follow that again for a short time. You repeat that until you get close to your target, at that point you stop pathfinding and instead switch to some other kind of movement e.g. chase/interception type behaviour. 

Share this post


Link to post
Share on other sites


Can you clarrify this question? I'm a little uncertain what you mean by neck. If you have a hole in your map (rather than a wall) which you don't want the AI to go into you treat it exactly the same way

i mean a closed place that it is nearer than gol but goalin behind it and agent can simply move beside it.

Share this post


Link to post
Share on other sites

In A* all locations in your graph (map) are weighted with a preference score.

 

You can simply weight the preference score of the places you want the agent to go with a high value to encourage the agent to travel there. You'd have to manually paint these places in your map data using your level editor or similar, or, you could make the agent discover these locations somehow as it explores the map, by recognising the shapes of the 'neck' on the floor. The second would be harder in terms of programming, and in terms of cpu time, i would recommend instead pre-programming the preferred locations into the map data.

 

Good luck!

Share this post


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

  • Advertisement