Avoid getting into Lava circles

I am trying to figure out how to write an AI avoidance algorithm for a game so as not to step on lava areas. The safe distance from the center of the lava object is a static range of 25. If it were only 1 lava object, I would calculate the distance between the Player and the Object, then calculate the angle and move the range x back to 25 range.

But since there can be more than 1 lava object, each of which has a radius of action of 25 radii. All 3 must be taken into account, otherwise it can move away from 1 and go to another.

Any help would be appreciated.

1

+4
source share
1 answer

If it were just 1 lava object, I would calculate the distance between the Player and the Object, then calculate the angle and move the range x back to 25 range.

This is, in fact, the right idea, you just need to scale it. Create a vector for each lava circle. The angle should represent “away” from the circle, and the magnitude shows how far it is. You can then add them together to represent the control vector. This is not ideal, but you can customize it to suit your specific needs.

These are just basic principles, but the principle can be applied to all types of steering, for example, pursuit, avoidance, walls, etc.

The best link I know to send you is "Behavior Management for Offline Symbols" by Craig Reynolds (creator of BOIDS). The site is pretty old, but the information is better than ever.

0
source

Source: https://habr.com/ru/post/1492604/


All Articles