[casual_games] Pathfinding
Lennard
Lennard at RustyAxe.com
Thu Aug 30 16:16:11 EDT 2007
Here's an oldie:
If your background is a grid of walk/don't walk areas then you can flood
fill a similar grid with numbers filling from start to destination in
ascending values, only filling grids that can be walked on. Starting at
the destination you traverse down values until you get to the start.
Gives a tight path at the resolution of your grid spaces.
Austin Haas wrote:
> A* isn't the problem. If you want your paths to have a certain aesthetic value, then you need to program that into how A* calculates costs. For instance, you can add a higher cost to changing direction, or you can add a high cost penalty to changing direction several times within a set number of steps. If you want the character to change direction as few times as possible, then you might give each step a +1 cost, but each change of direction a +3 cost. Then you can manage the tradeoff between shortest distance and aesthetics by tweaking simple numbers.
>
> -austin
>
>
--
Lennard Feddersen
CEO, Rusty Axe Games, Inc.
www.RustyAxe.com
Lennard at RustyAxe.com
P. 250-635-7623 F. 1-309-422-2466
P. July & August 518-863-2317
5014 Walsh, Terrace, BC, Canada, V8G-4H2
More information about the Casual_Games
mailing list