That does get things much closer to the kind of behaviour that I was looking for. Thanks once again.4page wrote: HorizonNormalizer ... Try setting that to about 40 and it should work a bit better.
Boids: natural flight movement and behavior
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Boids: natural flight movement and behavior
-
- Posts: 121
- Joined: Tue Aug 06, 2019 5:08 pm
- Location: American Pacific Northwest
Re: Boids: natural flight movement and behavior
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.
-
- Posts: 121
- Joined: Tue Aug 06, 2019 5:08 pm
- Location: American Pacific Northwest
Re: Boids: natural flight movement and behavior
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.
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.
-
- Posts: 1060
- Joined: Sun Feb 25, 2018 2:30 am
- Location: UK
Re: Boids: natural flight movement and behavior
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.
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Boids: natural flight movement and behavior
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. 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.
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. 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.
-
- Posts: 46
- Joined: Mon Nov 20, 2017 8:24 pm
Re: Boids: natural flight movement and behavior
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.
-
- Posts: 121
- Joined: Tue Aug 06, 2019 5:08 pm
- Location: American Pacific Northwest
Re: Boids: natural flight movement and behavior
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.
-
- Posts: 46
- Joined: Mon Nov 20, 2017 8:24 pm
Re: Boids: natural flight movement and behavior
Yeah, I know I'm being that guy like "could you just" but I am excited to see this put to use in Doom.
-
- Posts: 2089
- Joined: Fri Feb 20, 2009 2:46 pm
- Location: somewhere with trees
Re: Boids: natural flight movement and behavior
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.
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.
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 all
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;
}
}
-
- Posts: 121
- Joined: Tue Aug 06, 2019 5:08 pm
- Location: American Pacific Northwest
Re: Boids: natural flight movement and behavior
You should stop running BoidFlight() when it's attacking. You could try something like:
That might help. But maybe not. I offer no guarantees.
Code: Select all
Override void Tick()
{
if(InStateSequence(CurState, FindState("See")))
{
BoidFlight(MaxVelocity: 30,HorizonNormalizer: 5);
}
super.tick()
}
-
- Posts: 121
- Joined: Tue Aug 06, 2019 5:08 pm
- Location: American Pacific Northwest
Re: Boids: natural flight movement and behavior
Finally been getting around to making some improvements to the Boid library. Update improves performance quite a bit on maps with many thinkers, and just slightly otherwise. I changed the names of the actors and such to remove the "HXA" prefix, so if you're already using the older version and are going to update, make sure you change the names of things to reflect the new naming scheme. I wasn't able to improve performance as much as I would like, but hopefully I'll be able to figure out a good way to do that soon.