Pathfinding avoid a list of polygon

Started by
13 comments, last by ngoaho91 10 years, 1 month ago

Why don't you use the good old grid + A* pathfinding?

It is a pretty simple approach, limit the amount of paths calculated and you should have an OK FPS rate.

If you need better approachs you will have to look for a better graph representation for A* than a grid.

I suggest reading:

http://theory.stanford.edu/~amitp/GameProgramming/ (A LOT of information on A*)

http://theory.stanford.edu/~amitp/GameProgramming/MapRepresentations.html (Map representation only)

i'm not that good to make grid movement smooth biggrin.png. i compare AOE to starcraft, i think both use grid map, but starcraft has micro skill, AOE not. smooth unit movement is important for micro.


Alright so you have three major steps to use navmeshes.

i searched and found people talking about navigation mesh, but i don't understand why there are so many nodes that doesn't belong to any obstacle. i think a shortest path never travel through them. why are they there?

Advertisement


i compare AOE to starcraft, i think both use grid map, but starcraft has micro skill, AOE not.

StarCraft 2 uses navigation meshes with A* and a funnel algorithm for pathfinding. Unless you're talking about StarCraft 1, which used a 2D grid and A*.

"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty

yeah, starcraft 2 is my goal, i'm talking about it's terrain and moving system. i'm already have a set of 2D assets that can form the game. but building assets can't fit in grid. i mean it's shape isn't square or rectangle or diamond, so i think of 'polygon' solution above. but it's seem unofficial and no one do it. i feel a little awkward

As mentioned multiple times, use navigation meshes, they're your best bet.

Is there a more professional aproach to solve my problem?

The following are two libraries. Recast Navigation generates navigation meshes and Detour is a powerful pathfinder, capable of searching for paths as well as handling the movement of agents.

https://github.com/memononen/recastnavigation

With that you can

  1. Automatically re-generate navigation meshes on the fly.
  2. Search paths for different sized agents.
  3. Control movement of agents using advanced flocking algorithms.
"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty

yeah my problem seem solved, thank you all for the support.

This topic is closed to new replies.

Advertisement