Members - Reputation: 216
Posted 01 May 2012 - 06:09 AM
I'm working on an RTS in a relatively big world. The idea is that the world is a generated heightmap and that there are existing roads, swamps, deserts and so on. In other words, a basic A* based on a grid won't work as every direction is both navigable and weighted differently. I've tried running A* on a 1k*1k square and it took a few minutes as it expands a *lot* due to these constraints.
For in-game navigation using a grid is impossible, if only because the terrain is a relative 20km * 20km (12*12 mile) area. There are a lot of simplifying assumptions to be made though; for any reasonable-distance travel going by road is going to be the most likely fastest route.
The basic options to get some kind of navigation graph input are
- Use a grid. Not possible at an acceptable level of detail as it would be too unwieldy (20k*20k = 400M points) and too slow for navigation
- Use a navmesh. Possible in theory, but how do you use navmeshes with weights? Also, I think I couldn't use Recast as it tries to voxelize the terrain to get a navmesh, which is again unpractical.
I'm kind of lost what options exist. Doing a hierarchical plan would seem prudent. Having a toplevel road-network-graph with a rough map of point to point links with guesstimated delays sounds like a basic idea with possibly a grid-based A* below it for the final-mile navigation, but I get the feeling there should be a simpler solution.
Members - Reputation: 290
Posted 01 May 2012 - 08:13 AM
also a flow map will be great for automatically avoid certain obstacles/terrain types in certain cases.
you can also compute the path on your grid in async way if you don't need many path to be calculated (and your units start to following a path even if it is not ready, then they ahead correct way after computing finished)
Edited by DemonRad, 01 May 2012 - 08:15 AM.
Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!
Moderators - Reputation: 3456
Posted 01 May 2012 - 09:22 AM
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
Author of the book, Behavioral Mathematics for Game AI
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
Members - Reputation: 191
Posted 01 May 2012 - 09:36 AM
When the world is generated you might be able to cache the roads and the locations where they lead to and kinda "add them" into your current pathfinding solution.
For a case in which something is pathing from one side of the map to another, I imagine this would cut down the path generation time by a few orders of magnitude, in addition to having it so npcs actually use roads.
Crossbones+ - Reputation: 2485
Posted 01 May 2012 - 05:32 PM