Subscribe to library updates

Informatix

Expert
Licensed User
Longtime User
Steering Behaviors

This library will bring life to the animated characters of your game by giving them autonomy. It is based on the Craig Reynold's article: Steering Behaviors For Autonomous Characters.

Let's imagine a game where a cat pursues a mouse. You have to write the code to move the mouse, to move the cat and to take the right decisions for both: the cat wants to catch the mouse, the mouse wants to evade the cat. This library will do this very easily. You create two vehicles: a cat and a mouse, with an initial location, a maximum speed, a mass, etc. Then you add their behaviors (with the Steer function) in the main loop: Pursue for the cat, Evade for the mouse. You apply these behaviors with Cat.Move and Mouse.Move, and that's it. You're ready to watch them running around.

You have twelve behaviors available: Align, Arrive, AvoidObstacles, Cohere, Evade, Flee, FollowPath, Pursue, Seek, Separate, View, and Wander.
And twelve examples to see them in action. By combining them, you can create new behaviors like Flock, FollowLeader, StayOnPath...

You may also use the library for your vector calculations (class SB_Vector2D).

This library is a donationware.
 

Informatix

Expert
Licensed User
Longtime User
Steering Behaviors

Thanks to the financial support of Sterlingy, I added to my library a vision angle parameter to all group behaviors and an optimized A* algorithm for pathfinding.
This version is only available to donators. You can try the FindPath demo here. It shows four heuristics in action (Manhattan, diagonal, euclidian and fudge):

attachment.php


As you can see, my algorithm has no problem with curved obstacles. It supports different movement costs (you travel faster on a road than through woods) and it is two times faster than the fastest code I've found on Internet. You can run it in the background if needed.
 

Attachments

  • FindPath.png
    FindPath.png
    23.7 KB · Views: 469
Last edited:

stevel05

Expert
Licensed User
Longtime User
[Class] and [CodeModule] HotSpots

Upgraded with polygons and draw routines and InitComplete callback routine for customview in the class version.

Class V1.1

Module V1.6
 
Top