A
amusudan
Guest
GM Version: Game Maker: Studio
Target Platform: ALL
Download: Clicky
Links: Original Post, and follow-up of the original post (Please do check them out). And also this very helpful gallery with an explaination of each behaviour.
Summary:
This is a re-post of two reddit posts made a while back by PixelatedPope and devlkore, and the file (See "Download" above) contains all you need to add steering behaviours to your GM:S game!
Tutorial (Directly copied (almost) from the "follow-up" post):
I needed steering behaviours for my game, but there was nothing prebuilt, so I followed the breadcrumbs. Thanks to PixelatedPope, The Mojo Collective (TMC), http://tutsplus.com/authors/fernando-bevilacqua and Craig Reynolds ( http://www.red3d.com/cwr/steer/ ).
So what are these steering behaviours? Think swarms, think basic pathing, following and avoiding.
I've tried to make the project as simple to understand how to use as possible. There are a bunch of scripts that handle the steering behaviours, they all begin with "sb_..." and they are dependant on the scripts in the Vector folder and a few need the 2 scripts from GMLscripts.com (included).
There are a few objects (obj_drone...) set up already to show you how to use the scripts. The scripts themselves have some comments, but if you really want to understand what's going on, check out the tutorial by PixelatedPope and this series of tutorials (this is exactly what I did).
If you run the project as is (or standalone exe), you can see a bunch of steering behaviours running in various combinations to get an idea of what you can do with these, though the potential is far greater.
There is likely a bunch of optimisation to be done, but I wanted to get my head round the concepts involved before tightening it up fully. Most of the behaviours seem to have a pretty low CPU overhead EXCEPT the ones used for flocking (alignment, cohesion and separation) and to a lesser extent obstacle avoidance.
Target Platform: ALL
Download: Clicky
Links: Original Post, and follow-up of the original post (Please do check them out). And also this very helpful gallery with an explaination of each behaviour.
Summary:
This is a re-post of two reddit posts made a while back by PixelatedPope and devlkore, and the file (See "Download" above) contains all you need to add steering behaviours to your GM:S game!
Tutorial (Directly copied (almost) from the "follow-up" post):
I needed steering behaviours for my game, but there was nothing prebuilt, so I followed the breadcrumbs. Thanks to PixelatedPope, The Mojo Collective (TMC), http://tutsplus.com/authors/fernando-bevilacqua and Craig Reynolds ( http://www.red3d.com/cwr/steer/ ).
So what are these steering behaviours? Think swarms, think basic pathing, following and avoiding.
I've tried to make the project as simple to understand how to use as possible. There are a bunch of scripts that handle the steering behaviours, they all begin with "sb_..." and they are dependant on the scripts in the Vector folder and a few need the 2 scripts from GMLscripts.com (included).
There are a few objects (obj_drone...) set up already to show you how to use the scripts. The scripts themselves have some comments, but if you really want to understand what's going on, check out the tutorial by PixelatedPope and this series of tutorials (this is exactly what I did).
If you run the project as is (or standalone exe), you can see a bunch of steering behaviours running in various combinations to get an idea of what you can do with these, though the potential is far greater.
There is likely a bunch of optimisation to be done, but I wanted to get my head round the concepts involved before tightening it up fully. Most of the behaviours seem to have a pretty low CPU overhead EXCEPT the ones used for flocking (alignment, cohesion and separation) and to a lesser extent obstacle avoidance.
List of behaviours:
sb_seek - Basic "go to here" behaviour (WILL constantly overshoot the destination).
sb_seek_arrive - Same as above except it will slow down and stop at the destination.
sb_flee - Opposite of seek, will move away from the specified point.
sb_pursuit - specify an object (must have position and velocity variables) and it will try to intercept it based on it's velocity. Look inside the script to change how T (time) is calculated from dynamic to fixed if desired.
sb_evade - Opposite of pursuit.
sb_wander - Will constantly change direction, amount and angle offset can be configured.
sb_path_loop - Will follow a path and start again from the beginning. Works on closed or unclosed paths.
sb_path_tofro - Follows a path then turns around when it reaches the end/beginning.
sb_obstacle_avoidance - Specify an object to avoid and a distance to "see", tries to avoid the object.
sb_alignment - Flocking. Tries to align its velocity to the average velocity of its neighbours.
sb_cohesion - Flocking. Tries to move to the centre of mass of its neighbours.
sb_separation - Flocking. Tries to move away from the centre of mass of it's neighbours.
sb_seek_arrive - Same as above except it will slow down and stop at the destination.
sb_flee - Opposite of seek, will move away from the specified point.
sb_pursuit - specify an object (must have position and velocity variables) and it will try to intercept it based on it's velocity. Look inside the script to change how T (time) is calculated from dynamic to fixed if desired.
sb_evade - Opposite of pursuit.
sb_wander - Will constantly change direction, amount and angle offset can be configured.
sb_path_loop - Will follow a path and start again from the beginning. Works on closed or unclosed paths.
sb_path_tofro - Follows a path then turns around when it reaches the end/beginning.
sb_obstacle_avoidance - Specify an object to avoid and a distance to "see", tries to avoid the object.
sb_alignment - Flocking. Tries to align its velocity to the average velocity of its neighbours.
sb_cohesion - Flocking. Tries to move to the centre of mass of its neighbours.
sb_separation - Flocking. Tries to move away from the centre of mass of it's neighbours.