Advertisement

Navigation in a big world

Started by May 01, 2012 12:09 PM
3 comments, last by jefferytitan 12 years, 6 months ago
Hi all,

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.

Any ideas?
what about a simple quadtree?. Also instead of assuming the shortest, simplest or fastest path you can simply accept an approximation. (so ideal path will be never used, but path similiars to that path are used).

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)

Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!

Advertisement
Yeah, it sounds like either hierarchical A* or a quadtree would be your best bet. If there are natural division points between sections, HA* is good because you are pathing between logical areas. Think of it as knowing what rooms you need to travel through and then pathing through each room once you get to it.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
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!"

I believe this may be a scenario where it would be a good idea to assist with pathing speeds through caching. I assume you're making some kind of adventure game with towns and roads and such.

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.
One recent post on the topic:
http://www.gamedev.net/topic/609332-fast-pathfinding-via-symmetry-breaking/

This topic is closed to new replies.

Advertisement