Hello All.
I would like to know how to work out the cost(or blocking) of each cell based on the terrain under the cell.
What I have is a grid of cells that overlay's the terrain. This I will use the A* algorithm on, but I need my cells set up based on the terrain.
I have a image that has the terrain and the grid overlyed onto the terrain with black dots to show what I mean.
Like I want the unit to walk up the ramp but not the cliff wall and on the ridge. But the ridge cell covers to whole of the top(See Image).
How to handle that sort of thing
How To Block(Cost)Cells Based on the Terrain ready for A* path finding.
Calculate the slope between adjacent cells and then construct a formula to convert that slope into a movement cost. If the slope exceeds a certain value, the terrain is too steep and you can simply treat that cell as inaccessible.
In my current project I actually use the height difference, since the slope is deltaHeight/deltaX and deltaX is always 1 in my case. If it exceeds 1m, which corresponds to a 45 degree angle, I consider the cell to be inaccessible. Otherwise I multiply the current movement cost (calculated from factors such as the terrain underfoot) by 1 + deltaHeight. So at maximum it increases the movement cost of that tile by about 2x. That might not be realistic, but in testing its behaviour looks ok to me at the moment.
I should mention this is for creatures walking around. Slope affects vehicles much more severely I believe.
In my current project I actually use the height difference, since the slope is deltaHeight/deltaX and deltaX is always 1 in my case. If it exceeds 1m, which corresponds to a 45 degree angle, I consider the cell to be inaccessible. Otherwise I multiply the current movement cost (calculated from factors such as the terrain underfoot) by 1 + deltaHeight. So at maximum it increases the movement cost of that tile by about 2x. That might not be realistic, but in testing its behaviour looks ok to me at the moment.
I should mention this is for creatures walking around. Slope affects vehicles much more severely I believe.
Only one reply thanks.
You know the articles don't talk about setting up the cost and things.
You know the articles don't talk about setting up the cost and things.
I'm sorry but I've seen way too many people acting as if this community owes them their time. This is FREE advice you're getting here, try to respect it a bit better. One reply is better than none.
His advice is sound. There is nothing wrong with it. Perhaps if you provided a little more information about your A* implementation then people would be able to tailor their answers better to your... ability... to comprehend.
I sounds to me like you're using an A* algorithm that was coded by someone else and you don't really understand how it works.
There is a great section on pathfinding here:
http://theory.stanfo...ameProgramming/
Specifically to costs:
http://theory.stanford.edu/~amitp/GameProgramming/MovementCosts.html
This is all I needed to write any pathfinders I've ever wanted.
His advice is sound. There is nothing wrong with it. Perhaps if you provided a little more information about your A* implementation then people would be able to tailor their answers better to your... ability... to comprehend.
I sounds to me like you're using an A* algorithm that was coded by someone else and you don't really understand how it works.
There is a great section on pathfinding here:
http://theory.stanfo...ameProgramming/
Specifically to costs:
http://theory.stanford.edu/~amitp/GameProgramming/MovementCosts.html
This is all I needed to write any pathfinders I've ever wanted.
firstly I would like to thank you for your time and link. As I don't have that a* link in my collection of links on a*.
And I am part of this community as well and I hope I have helped others.
and No I have not stolen some ones A* algo. This will in fact be my second A* algo, My first one only used blocking or not blocking and it was on a smaller scale then the one
I need now as my cells are larger.
And a point for you in future is not to assume things, It will just make you and me look like an ass.
And I am part of this community as well and I hope I have helped others.
and No I have not stolen some ones A* algo. This will in fact be my second A* algo, My first one only used blocking or not blocking and it was on a smaller scale then the one
I need now as my cells are larger.
And a point for you in future is not to assume things, It will just make you and me look like an ass.
now back to the problem at hand.
See the cliff at the left top the cell covers the top and the wall of the cliff how should I handle that sort of thing besides making smaller cells.
I want the units to go up there if they need to. thanks.
See the cliff at the left top the cell covers the top and the wall of the cliff how should I handle that sort of thing besides making smaller cells.
I want the units to go up there if they need to. thanks.
now back to the problem at hand.
See the cliff at the left top the cell covers the top and the wall of the cliff how should I handle that sort of thing besides making smaller cells.
I want the units to go up there if they need to. thanks.
If you want to deal with variable size pathfinding nodes then perhaps it's worth looking into using Quadtree nodes for pathfinding.
This isn't a completed algorithm (and it's not my video either) but this demonstrates the idea well:
[media]
[/media]
This may or may not be helpful:
http://www.stanford....pen_terrain.pdf
Essentially, from the sounds of it, you're looking for pathfinding on a variable-size grid. If not, then I can think of only two other options. Place custom nodes manually or make the grid finer.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement