I'm considering implementing A* pathing for dense terrain.
"dense" being defined as an 800x800 foot area with 1300 trees (1-2 foot diameter), 1300 fruit trees (2-4 ft diameter), and 1300 rocks (3-15 ft diameter) - placed at random.
the large number of obstacles and random placement can result in large concave obstacles composed of many rocks and trees. needless to say, simple heuristics don't do so well in these conditions.
how to code A* is not the issue. i've done that before.
the question is how to best use it.
the goal will usually be a target, a moving entity, whose location would change every update. if i use the existing collision maps for A*, which have a resolution of 1 foot, the goal node would change every time they moved 1 foot.
running A* every update is probably not happening, even if i limit the are to something like a AABrect that encloses both start and goal with 10 tiles to spare in all directions. ranges can be as great as 300 feet, yielding a max search area of about 320 x 320.
lower resolution grid for A* might help. tiles that are 5 or 10 feet wide, not 1 foot wide. at 10 feet, the search area drops to 32x32 tiles/nodes. but the lower the resolution the greater the chance that a path no longer exists.
round robin A* every N updates is another possibility. but the higher the value of N, the less responsive it is to changes in the goal node location.
right now everything is done every update just before moving an entity, so its always using the target's current location, as well as the true state of the entire simulation at that moment to determine the AI's move. so at the moment, all AI responds immediately to changes in the simulation.
i'm thinking that if the search area must be too limited, or running A* round-robin every N updates will be too slow, that i might as well try a modified version of the heuristic collision avoidance AI
the heuristic collision avoidance AI is your basic look ahead affair, designed to deal with isolated convex obstacles such as trees, rocks, people, and animals.
when an obstacle is detected ahead, it looks ahead left and right, and chooses an open path at random (a new point to move to). when it reaches that point, it exits collision avoidance mode, and normal line of sight pathing takes over again. bang and turn collision recovery is used when collisions occur. in dense terrain, collision avoidance is turned off at the moment, as it can seldom find an open path. so for the moment they bang and turn their way through.
the idea behind the modified collision avoidance would be to use a lower resolution grid. collision avoidance uses the collision maps, which have a resolution of 1 foot. the modified version would use something like 10 feet or perhaps bigger. if there were any obstacle in a tile, the entire tile would be marked impassable. by choosing a sufficiently large tile size, hopefully the map would degenerate to large individual convex obstacles (or at least fewer concave ones) that could be navigated with standard look ahead collision avoidance, perhaps combined with some look ahead wall following. if not, it would first degenerate to a map with so many impassable tiles that no path existed.
any suggestions? thoughts? comments? etc?
what would you try first?