Dodging algorithms
Anyway, what was your question exactly? You said you needed a 'dodging' algorithm, but it sounds like you have one. Does it work the way you want it to?
I didn't quite understand the part about damage, but other than that this seems pretty similar to the way I've handled projectile evasion for AI agents in the past (which always seemed to work well).
Quote: Original post by jyk
You can use HTML tags to link or embed images in posts.
Anyway, what was your question exactly? You said you needed a 'dodging' algorithm, but it sounds like you have one. Does it work the way you want it to?
thanks for help! Are there any general purpose algorithms for dodging?
About damage: if there was projectile moving under player, AI would take damage wherever player moves, so AI should go to projectile causing minimal damage.
This is a quick and dirty solution and would be a bit expensive because of the increased ray casts. *shrug*
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!"
Your world is 2d; adding time as a third dimension, your projectile trajectories are lines in 3d. Computing the Minkowski sum of these lines with your agent's shape, you get the free configuration space for your agent (all the points where its center can be). You start at some point (x,y,0) in spacetime and want to get to any point on the t=T plane (for some fixed lookahead T) while minimizing accumulated damage. In principle, this is just a pathfinding problem in 3d, with the one restriction that you cannot move backwards in the 't' direction.
http://www.red3d.com/cwr/boids/
and just made projectiles as repulsors and gave them high weight. If you are using some other general obstacle avoidance algorithm just consider projectiles as another obstacle with high repellence. This is very nice because the dodging is built-in and no need to do manual ray-casting or projectile prediction every update.
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!"
Quote: Original post by EJH
Another suggestion, on a game I did we used a modified boids for NPC steering:
http://www.red3d.com/cwr/boids/
and just made projectiles as repulsors and gave them high weight. If you are using some other general obstacle avoidance algorithm just consider projectiles as another obstacle with high repellence. This is very nice because the dodging is built-in and no need to do manual ray-casting or projectile prediction every update.
EJH,
I've read about boids and algorithm implementation (http://www.vergenet.net/~conrad/boids/pseudocode.html), but I don't understand how to apply this algorithm to my problem. As from algorithm overview, there are 3 corrections to velocity of boids: to center of mass, away from nearby boids and matching velocity. From this, how NPC agent velocity should be changed?
Steering Behaviors
Specifically if you use a hybrid of the techniques in "seek and evade" and "obstacle avoidance" you should be good to go.
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!"