RTS Pathingmap
I want to create a RTS game like Warcraft 3/Starcraft 2. For the pathfinding I want to use a modified A*Star and steering behaviours.
There are 4 different pathingmaps for ground-,air-,water-units and for buildings and all these pathingmaps should be grids.
Each of this submaps should contain one Grid for the detailed pathing information and one quad tree which contains the Obstacles for the steering behaviors.
Here is one example how the grid could look like:
The negative values represent fields which are blocked (red) and arround these blocked fields there is an information how large the units can be which can pass these fields. (for the A*Star)
Besides I could use different negative numbers for different layers. (Example:A building blocks a path, than a trigger says that the area where the building stand is blocked for units and after this the building is killed.)
I am not sure if a QuadTree would be useful in this case because there a many different values.
Here is an image how the obstacles could look like:
I think the obstacle tree is okay but the other map has some problems.
For example every time a pathing blocker is deleted I would need to check all field arround and recalculate the value by searching the nearby blocked fields. This would mean that about 25*25 fields must be checked -> high costs...
The only way to fix this would be to support only 3 unit sizes and than i would only need to check about 9*9 fields. Or the A*Star needs to check for the size every time but I cant imagine that this could be better.
But maybe this could be a tip that i generaly made some mistakes in my structure.
So I am intrested in the opinion of some experts.Is everything alright?
(Atm I would implement the simlple version but maybe there exists a solution with a good performance and many different unit sizes?)
I was a little bit surprised that you chose the values that you did.[/quote]
I found this thread here:
http://www.gamedev.net/topic/511923-pathfindinga-with-variable-unit-size-in-rts/
and I think your maps is maybe useful for other strategy games but in my case I dont have hilly grounds nore I want to save the HP of a building in the map.
Are you thinking of using steering behaviours for path smoothing, or for flying units where obstacles aren't really a problem?[/quote]
I think in a rts game an A* is used to find the way arround buildings and trees and the steering behaviours to smooth the path and avoid other units.
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 found this thread here:
http://www.gamedev.n...it-size-in-rts/
and I think your maps is maybe useful for other strategy games but in my case I dont have hilly grounds nore I want to save the HP of a building in the map.
Right, it's a perfectly valid way to determine the minimum approach distance for different size units to the terrain. However I would then process that further to turn it into a cost map for A*. A* is designed to find the minimum cost path between A and B where all costs are positive and represent the difficulty of traversing that area.
Looking at your example I think perhaps I'm barking up the wrong tree - your 1-4 aren't meant to represent costs at all, they're just a way of determining how big the impassible area should be for later A* pathfinding. So if you were pathfinding for a unit of size 3, you would turn cells marked 1 and 2 into red cells, correct?
I'm still not seeing the point of the quadmaps unless perhaps it's for a steering behaviour?
your 1-4 aren't meant to represent costs at all, they're just a way of determining how big the impassible area should be for later A* pathfinding. So if you were pathfinding for a unit of size 3, you would turn cells marked 1 and 2 into red cells, correct?[/quote]
Yep. The only costs of terrain I could imagin are hills but for this I would use the heightmap of the terrain.
I'm still not seeing the point of the quadmaps unless perhaps it's for a steering behaviour?[/quote]
Youre right that is not useful for the grid but the quadtree for Obstacles is a better way than creating one obstacle for every blocked cell.
I believe that I have seen people just have separate pathing maps for objects of different sizes. Can't remember where I saw it recently though.
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!"
http://aigamedev.com/open/tutorial/clearance-based-pathfinding/
http://aigamedev.com/open/tutorial/symmetry-in-pathfinding/
http://www.moddb.com/games/0-ad/news/the-pathfinding-saga-continues
Every field gets the value by checking how large we could expand the rectangle.
This is useful because it is easy to change blocking fields and to recalculate the size for the units.
I can simply start at the bottom right position I want to change and than always determine the new value by looking at the right/bottom/diagonal neighbour of this field. (if it exists)
Therefore I have a larger if construct but I dont need to visit some field "twice". I already tested it and it works fine. (+ should be fast)