Jump to content

  • Log In with Google      Sign In   
  • Create Account

Navigation in a big world

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 dascandy   Members   -  Reputation: 216


Posted 01 May 2012 - 06:09 AM

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?


#2 DemonRad   Members   -  Reputation: 290


Posted 01 May 2012 - 08:13 AM

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, 01 May 2012 - 08:15 AM.

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

#3 IADaveMark   Moderators   -  Reputation: 3321


Posted 01 May 2012 - 09:22 AM

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-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
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!"

#4 zalzane   Members   -  Reputation: 191


Posted 01 May 2012 - 09:36 AM

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.

#5 jefferytitan   Crossbones+   -  Reputation: 2460


Posted 01 May 2012 - 05:32 PM

One recent post on the topic:

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.