Boids: natural flight movement and behavior

Post your example zscripts/ACS scripts/etc here.

Re: Boids: natural flight movement and behavior

Postby Enjay » Thu Feb 03, 2022 1:52 pm

4page wrote: HorizonNormalizer ... Try setting that to about 40 and it should work a bit better.

That does get things much closer to the kind of behaviour that I was looking for. Thanks once again.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Boids: natural flight movement and behavior

Postby 4page » Thu Feb 03, 2022 2:17 pm

No problem. I tried to make it easy to understand, but I get that there's a lot in there. I'm happy to try to provide solutions and help.
User avatar
4page
 
Joined: 06 Aug 2019
Location: American Pacific Northwest
Discord: 4page#3223

Re: Boids: natural flight movement and behavior

Postby 4page » Fri Feb 04, 2022 9:13 am

UPDATED THE LIBRARY:
Function to generate a new FlockID. Pretty much only useful for a spawner so it can spawn boids that will only flock together and with nothing else.
Function to inherit the FlockID of its master pointer. Again only really useful for boids spawned by a spawner.
Fixed the issue with the boids preferring to fly up and down. Turns out in a part that I wrote specifically to try to avoid this behavior I accidentally had a positive instead of a negative. Then I realized I didn't need that section at all so removed it. Now it's much more natural looking and its vertical movement is no more significant than its horizontal movement. However, the HorizonNormalizer field is still necessary if you want it not moving up or down so much.
User avatar
4page
 
Joined: 06 Aug 2019
Location: American Pacific Northwest
Discord: 4page#3223

Re: Boids: natural flight movement and behavior

Postby eharper256 » Fri Feb 04, 2022 11:33 am

Just tested this; definately an improvement. The birb can now sometimes even manage to get into small tunnels to follow if you give it a bit of time; and the circling master behaviour is much tighter.
User avatar
eharper256
Author of Hexen: Walpurgis
 
Joined: 25 Feb 2018
Location: UK

Re: Boids: natural flight movement and behavior

Postby Enjay » Fri Feb 04, 2022 12:43 pm

Very nice. Definitely more natural looking.

These all probably still require a bit of tweaking to make them a) better and b) more distinct from each other but here are a few bird types that I have been messing with:




Demo file (slightly different to the one in the video) - use the switches in the maps to change the kind of birds that are flying around.
NJ_BirbDemo.pk3


You need to load this on top of 4page's library.
As before, these will probably need a bit of tweaking, and I am sure that I will have made some coding errors/inefficient entries, but all three bird types fly slightly differently and do pretty much what I was hoping they would.
You do not have the required permissions to view the files attached to this post.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Boids: natural flight movement and behavior

Postby 00face » Wed Feb 16, 2022 4:31 pm

Okay, now for a practical request. Can you bind this behavior to the lost souls that come out of the Pain Elemental? As in, swarming in defense, attacking, and frenzy (no Pain Elemental around). Thank you so much for your impressive work so far.
User avatar
00face
 
Joined: 20 Nov 2017
Discord: 00face#7808

Re: Boids: natural flight movement and behavior

Postby 4page » Thu Feb 17, 2022 6:18 am

Theoretically, yeah, you should be able to, but you'd have to rewrite Lost Souls completely, and Pain Elementals partially. It could be quite a bit of work to have it behave correctly, depending on how complex you want the behaviors to interact with each other.
User avatar
4page
 
Joined: 06 Aug 2019
Location: American Pacific Northwest
Discord: 4page#3223

Re: Boids: natural flight movement and behavior

Postby 00face » Fri Feb 25, 2022 4:49 pm

Yeah, I know I'm being that guy like "could you just" but I am excited to see this put to use in Doom.
User avatar
00face
 
Joined: 20 Nov 2017
Discord: 00face#7808

Re: Boids: natural flight movement and behavior

Postby Xim » Thu Apr 07, 2022 12:23 pm

Just checked this out today, and it's pretty cool. I too was interested in making a Lost Soul that uses this behavior.

Here's my fairly simple attempt, pretty much just the default lost soul zscript with the boidflight tick added without particles. It seems okay, but maybe could be improved. After all these years I'm still learning.
Code: Select allExpand view
Class LostSoulBoid : HXA_Boid
{

   Override Void Tick()
   {
      BoidFlight(MaxVelocity: 30,HorizonNormalizer: 5);
      super.tick();
   }
   
   Default
   {
      Monster
      -NOBLOCKMONST;
      -FRIENDLY;
      +COUNTKILL;
      +MISSILEMORE;
      +NOICEDEATH;
      +ZDOOMTRANS;
      +RETARGETAFTERSLAM;
      Scale 0.75;
      Health 100;
      Radius 16;
      Height 56;
      Mass 50;
      Speed 8;
      Damage 3;
      PainChance 256;   
      AttackSound "skull/melee";
      PainSound "skull/pain";
      DeathSound "skull/death";
      ActiveSound "skull/active";
      RenderStyle "SoulTrans";
      Obituary "$OB_SKULL";
      Tag "$FN_LOST";      
      HXA_Boid.BoidActor "LostSoulBoid";
   }
   
   States
   {
      Spawn:
         SKUL AB 10 BRIGHT A_Look();
         Loop;
      See:
         SKUL AB 6 BRIGHT A_Chase();
         Loop;
      Missile:
         SKUL C 10 BRIGHT A_FaceTarget();
         SKUL D 4 A_SkullAttack();
         SKUL CD 4 BRIGHT;
         Goto See;
      Pain:
         SKUL E 3 BRIGHT;
         SKUL E 3 BRIGHT A_Pain;
         Goto See;         
      Death:
         SKUL F 6 BRIGHT;
         SKUL G 6 BRIGHT A_Scream;
         SKUL H 6 BRIGHT;
         SKUL I 6 BRIGHT A_NoBlocking;
         SKUL J 6;
         SKUL K 6;
         Stop;
   }
}


EDIT: It's seems to be kind of tricky getting a swarm to be hostile to the player. Sometimes they attack you, but a lot of the time they just fly around.
User avatar
Xim
 
Joined: 20 Feb 2009
Location: Somewhere with trees

Re: Boids: natural flight movement and behavior

Postby 4page » Fri Apr 08, 2022 11:30 pm

You should stop running BoidFlight() when it's attacking. You could try something like:
Code: Select allExpand view
Override void Tick()
{
    if(InStateSequence(CurState, FindState("See")))
    {
        BoidFlight(MaxVelocity: 30,HorizonNormalizer: 5);
    }
    super.tick()
}


That might help. But maybe not. I offer no guarantees. :lol:
User avatar
4page
 
Joined: 06 Aug 2019
Location: American Pacific Northwest
Discord: 4page#3223

Previous

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests