# Navigation in a big world

This topic is 2297 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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) Edited by DemonRad

##### Share on other sites
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.

##### Share on other sites
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.

1. 1
2. 2
3. 3
frob
12
4. 4
5. 5

• 13
• 14
• 65
• 14
• 15
• ### Forum Statistics

• Total Topics
632130
• Total Posts
3004286

×