Advertisement

AI avoiding terrain at high speed

Started by February 14, 2003 06:58 PM
13 comments, last by Waverider 21 years, 6 months ago
Maybe I''m oversimplifying things, but wouldn''t steering in such a way as to make the direction of movement rotate in the direction of the surface normal at the point of projected collision cause the aircraft to avoid all possible terrains represented by a heightmap (it would not be able to avoid a concavity in both directions at the point of collision)?
So I keep turning the craft in that direction until a collision is no longer predicted? Interesting... I'll keep that one in mind

It wouldn't handle the case of a plane diving towards a mountain face (adjusting its travel path by the normal would drive it into the ground, which in turn causes it to turn towards the mountain - add kaboomy)

I suppose I could have the craft only turn upwards, but I would like to see the craft avoid terrain horizontally too, to add variety to the dogfights.


[edited by - Waverider on February 23, 2003 11:40:03 PM]
It's not what you're taught, it's what you learn.
Advertisement
The surface normal always points at least somewhat up except on a completely vertical cliff (which cannot be represented by a height map) In the case of a mountain, it points back towards the plane and up (if it were down, the mountain would be concave, which cannot be represented by a height map)

Then you want your plane to steer such that its new direction is more like the direction of the surface normal (i.e. the angle between the surface normal and the direction of flight is smaller)

A plane diving towards a mountain face would try to pull up. A plane diving towards a spire would pull up and turn to the side nearest safety.

You would have the balance several parameters: the importance of the disparity between the angles, the ease of turning right/left vs. up/down, the urgency of the necessary turn.
"Maybe I''m oversimplifying things, but wouldn''t steering in such a way as to make the direction of movement rotate in the direction of the surface normal at the point of projected collision cause the aircraft to avoid all possible terrains represented by a heightmap (it would not be able to avoid a concavity in both directions at the point of collision)?"


This is more or less what Geta suggested in the first response to this post. Except you are calculating the normal directly from the heightmap rather than the geometry.






ai-junkie.com
quote: Original post by Anonymous Poster
If I were approaching this problem, I would convert the height information into a low-resolution boolean grid, where "true" in the grid means "you might crash into something flying into this square at your current altitude" and "false" is "there is nothing in this grid to hit at your altitude". Then do an easy pathfinding search through the grid.



If you do use this idea, you can pre-compute the grid for all n-levels of altitude your cpu player will fly. This would make it very very fast, so you can spend those CPU cycles on something else.

Will
------------------http://www.nentari.com

This topic is closed to new replies.

Advertisement