Re: Boids: natural flight movement and behavior
Posted: Tue Feb 01, 2022 7:07 am
Seems to be fine to me. If the boid is not going to do anything with the player or monsters, you could add the +NOINTERACTION flag to make it need less attention from the game engine. If you want to give it sprites for an actual bird you'll need to add some states as well.
If you look at the main boid class, there are quite a few parameters you can change:
You can use something like HorizonNormalizer = 3, placed after DistanceFromMaster in the BoidFlight argument, if you want to level off erratic Z movement a bit, but keep in mind that 200 is quite a small area and this might cause it some pathing issues, so you might also want to fiddle with the other parameters, and allow it place closer beacons with a higher max angle or use a lower velocity.
If you look at the main boid class, there are quite a few parameters you can change:
Code: Select all
Action Void BoidFlight(
Class<Actor> BoidActor = "HXA_Boid", //This is the class type that boid will follow and try to match velocities with
double MaxVelocity = 20, //This is the max speed that it will go
double VelocityAcceleration = .2, //This is how fast the increases its speed
double WallDetectionDistance = 6, //How far away the Boid will detect walls. WallDetectionDistance * velocity, so the distance increases the faster it goes
Bool CloseToMaster = FALSE, //Will remain near master pointer if TRUE
double DistanceFromMaster = 400, //Max distance from master pointer
Bool CloseToTarget = FALSE, //Will remain near target pointer if TRUE. Overrides Close to master.
double DistanceFromTarget = 400,
double MinDistanceToBoid = 150, //Will try to move away from boids within this distance
double MaxDistanceToBoid = 900, //Will try to move toward boids if further than this distance
double BoidCohesion = 3, //How hard the boid will try to remain with other boids and match their velocities
double MinDistanceBeacon = 100, //Creates a beacon to move toward at least this far away
double MaxDistanceBeacon = 300, //Creates a beacon to move toward at most this far away
double MaxAngleBeacon = 100, //Creates a beacon at an angle at most this far from its current velocity
double MaxRandomMoveAngle = 120, //The max angle that the boid will randomly create a vector to move toward
double HorizonNormalizer = 1, //Adjusts all vectors in the array to turn toward the horizon. Higher than 1 moves them to horizontal faster, less than 1 lessens the effect
Bool UsePropertyValues = TRUE //If this is true and the default arguments have not changed, then the arguments will use the values of the actor's properties.
//Otherwise will force the use of the given argument values.