Sign in to follow this  
020644

When A* [seemingly] isn't enough...

Recommended Posts

020644    132
Here's the problem. I have a 2D map in the form of a simple grid. I need to find the shortest distance from point A to point B. Seems easy so far... The problem is that movement is not restricted to 8 directions! It seems that this would be a common problem, and it also seems that the solution to this problem should start with the A* path. Can anyone give me a nudge in the right direction?

Share this post


Link to post
Share on other sites
strtok    191
You can try A* in 8 directions and then add path smoothing (i.e. remove nodes from the path if doing so still represents a valid path).

Share this post


Link to post
Share on other sites
Telastyn    3777
Quote:
Original post by 020644
Units can move at any angle. Sorry if I'm being dense!


Not if your map is a 'simple grid'.

How about you explain, nice and explicitly how your map is structured...

Share this post


Link to post
Share on other sites
020644    132
strtok's solution works.

Telastyn, while the game map is a stored as a simple grid of passable and non-passable tiles, units on the map can move in any direction and aren't constricted to moving "tile-to-tile".

Thank both of your for your help! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this