Gez Posted April 16, 2017 An explanation I can see is that they target the center of mass of their enemy. Look at the last line of code in their attack function: // // SkullAttack // Fly at the player like a missile. // #define SKULLSPEED (20*FRACUNIT) void A_SkullAttack (mobj_t* actor) { mobj_t* dest; angle_t an; int dist; if (!actor->target) return; dest = actor->target; actor->flags |= MF_SKULLFLY; S_StartSound (actor, actor->info->attacksound); A_FaceTarget (actor); an = actor->angle >> ANGLETOFINESHIFT; actor->momx = FixedMul (SKULLSPEED, finecosine[an]); actor->momy = FixedMul (SKULLSPEED, finesine[an]); dist = P_AproxDistance (dest->x - actor->x, dest->y - actor->y); dist = dist / SKULLSPEED; if (dist < 1) dist = 1; actor->momz = (dest->z+(dest->height>>1) - actor->z) / dist; } Let's say you have two lost souls, A and B, at 0 height initially. Let's note hA and hB their respective z height. A lost soul is 56 units tall, so their center is 28 higher than their z height. Round #1: A charges at B. A aims to reach height 28 at the end of its charge. So we end this round with hA 28, hB 0. Round #2: B charges at A. B aims to reach height 56 at the end of its charge. So we end this round with hA 28, hB 56. Round #3: This continues, so hA 84, hB 56. Round #4: And so on: hA 84, hB 112. What happens if that they factor in the target's half-height, but not the charging lost soul's own half-height. So each lost soul tries to hit the center of their target with the bottom of their own collision box, instead of center-to-center. In a way it makes sense if you figure they're trying to hit with their jaws, rather than their nostrils. 17 Share this post Link to post
Deleted_Account Posted April 16, 2017 Because they want to feel taller. 3 Share this post Link to post
Pencil of Doom Posted April 16, 2017 So no one watches them trying to kiss each other. 1 Share this post Link to post
Torturephile Posted April 16, 2017 To piss off some players since they can't aim up. 1 Share this post Link to post
Job Posted April 16, 2017 6 hours ago, Piper Maru said: Because they want to feel taller. Head and shoulders above the rest. 2 Share this post Link to post
Nevander Posted April 17, 2017 On a related note, why are Cacodemons so damn annoying when they get blasted? Why can't they stop themselves from being blown back and regain the distance they lost after each blast? How could one fix this irritating behavior in DECORATE? 1 Share this post Link to post
RjY Posted April 17, 2017 (edited) 59 minutes ago, Nevander said: On a related note, why are Cacodemons so damn annoying when they get blasted? Why can't they stop themselves from being blown back and regain the distance they lost after each blast? How could one fix this irritating behavior in DECORATE? There's no friction applied to flying monsters which are not on ground level, so they retain the momentum imparted by the blast until they collide with something. (The monster movement code does not affect the actor's momentum, instead it moves in little jumps that are too small to distinguish. Enough momentum will cancel out the monster's attempts to move.) I find the behaviour of lost souls in this situation just as annoying, as a single bullet will halt their charge and leave them to float very slowly across the landscape until a collision which may be several minutes away. No idea if decorate can apply friction to actors in the air. 0 Share this post Link to post
Gez Posted April 17, 2017 (edited) You can gradually scale down a monster's velocity with A_ScaleVelocity, put that in their See state sequence and it should let them cease their drifting around. It has no impact on their normal movement since that works differently, by making steps when calling A_Chase instead of by acquiring a momentum. 0 Share this post Link to post
kb1 Posted April 17, 2017 (edited) 1 hour ago, Nevander said: On a related note, why are Cacodemons so damn annoying when they get blasted? Why can't they stop themselves from being blown back and regain the distance they lost after each blast? How could one fix this irritating behavior in DECORATE? I think you could increase their mass, which would keep them from being knocked back as much (could be wrong, though). I kinda like their behavior, myself, though. It keeps them from all being in your face all the time, and it let's you knock 'em around a bit :) 0 Share this post Link to post
FreightMan07 Posted April 17, 2017 (edited) 33 minutes ago, kb1 said: I think you could increase their mass, which would keep them from being knocked back as much (could be wrong, though). I kinda like their behavior, myself, though. It keeps them from all being in your face all the time, and it let's you knock 'em around a bit :) I sorta look at it this way: You blast a bully like a Cacodemon with a shotgun, and he 'begs off' while still trying to hit you with a fireball, but realizing you aren't a simple pushover and COULD kill it, he floats away, only to come back at you when you forget about him or are occupied with other monsters. Sure, I understand the TECHNICAL reasons why the Cacos do what they do, but that shit is boring! I like to think they just go into "tactical retreat" then regroup. =) As for the Lost Souls, well, when they face off, it's like a hell version of when two toughs meet in a bar... "Let's take this thing outside, tough guy!" But in their case, it's, "Ok flamehead, let's take this thing to the ceiling, you and me, punk!" Hah.. 0 Share this post Link to post
Nevander Posted April 17, 2017 (edited) 1 hour ago, Gez said: You can gradually scale down a monster's velocity with A_ScaleVelocity, put that in their See state sequence and it should let them cease their drifting around. It has no impact on their normal movement since that works differently, by making steps when calling A_Chase instead of by acquiring a momentum. Something like this maybe? Seems to be working but I want to know if I did it right: See: HEAD A 0 A_ScaleVelocity(0.80) HEAD AA 3 A_Chase HEAD B 0 A_ScaleVelocity(0.60) HEAD BB 3 A_Chase HEAD C 0 A_ScaleVelocity(0.40) HEAD CC 3 A_Chase HEAD D 0 A_ScaleVelocity(0.20) HEAD DD 3 A_Chase HEAD D 0 A_ScaleVelocity(0.0) Loop 0 Share this post Link to post
Gez Posted April 18, 2017 (edited) Oh god that's ugly. Why do you go through ABCD? Custom cacos? Normal cacodemons only use frame A for their chase, since they don't have legs to move. BCD are the attack frames. Anyway just do that for regular cacos with your extra frames. See: HEAD ABCD 3 { A_Chase; A_ScaleVelocity(0.50); } Loop Note: scale velocity is a scale. That means that when you call it with 0.5, it halves the current velocity. Then when it loops back and call it again, it halves the velocity again -- so it's a quarter of its initial value. Next loop it halves again, so 1/8. Then again (1/16), and again (1/32), and again (1/64)... It'll be reset to zero pretty soon. No need to scale it by 0. 0 Share this post Link to post
silentzorah Posted April 18, 2017 I always figured it had something to do with basic animal instincts, similar to animals trying to make themselves look big to intimidate aggressors. 0 Share this post Link to post
Nevander Posted April 18, 2017 (edited) 55 minutes ago, Gez said: Oh god that's ugly. Why do you go through ABCD? Custom cacos? Normal cacodemons only use frame A for their chase, since they don't have legs to move. BCD are the attack frames. Note: scale velocity is a scale. That means that when you call it with 0.5, it halves the current velocity. Then when it loops back and call it again, it halves the velocity again -- so it's a quarter of its initial value. Next loop it halves again, so 1/8. Then again (1/16), and again (1/32), and again (1/64)... It'll be reset to zero pretty soon. No need to scale it by 0. It's the Doom 64 Cacodemon, it has A-D for movement because it "moves" side to side. I did the above because I prefer not to use anonymous functions. They are still pretty new and a ton of people still run older versions of GZDoom before they were added. I don't want to break my mod on every version up to when they were added when it can be done without them. How would you write it without them? I know it's a scale, that's why I took 95% of the velocity, then 60% of that, and so on. I don't want to instantly reduce to half and then 0 because that's too fast of a stop. Does velocity automatically get reduced to 0 even if you don't call scale velocity? And just to ask, what's ugly exactly about my approach? Is it just preference or is there actually something wrong with it? Meaning something that could produce errors or undesired behavior? 0 Share this post Link to post
Empyre Posted April 18, 2017 (edited) It wouldn't be 50% and then 0. Like Gez said, it would 50%, and then 50% of 50% (25%), then 50% of that (12.5%), and so on. If you want it to slow down more gradually, make it 60% or even more. To do exactly the same thing as the code Gez posted without an anonymous function: See: HEAD A 0 A_Chase HEAD A 3 A_ScaleVelocity(0.50) HEAD B 0 A_Chase HEAD B 3 A_ScaleVelocity(0.50) HEAD C 0 A_Chase HEAD C 3 A_ScaleVelocity(0.50) HEAD D 0 A_Chase HEAD D 3 A_ScaleVelocity(0.50) Loop This is similar to what you posted, but with 3 tics per frame instead of 6, and the velocity scaling is done better. If it is supposed to be 6 tic per frame with that sprite, then just change each 3 into a 6. 0 Share this post Link to post
axdoomer Posted April 18, 2017 6 hours ago, RjY said: I find the behaviour of lost souls in this situation just as annoying, as a single bullet will halt their charge and leave them to float very slowly across the landscape until a collision which may be several minutes away. That's a different issue from the Cacodemon one. When a charging Lost Soul gets hit, they (the developers at id) forgot to set it into its pain state and make it fight back. They also set its momentum to 0, so the result is that it drifts away in the direction of the damage you have applied to it. Sometimes I look at the source code and a wonder what they were trying to do. Maybe they wanted the Lost Soul to go to its pain state when it was hit, that way it could recover and fight back. Maybe they wanted it to continue its charge toward the player even though it was being hit. Either way, they screwed up and as a result, the Lost Soul is not a dangerous monster unless you use -fast or play on Nightmare. I had some hilarious time on E2M8 with the Lost Souls. You wait for it to charge, then you shoot it with the pistol so it drifts in the direction that you want. If the Cyberdemon wasn't there, you could easily organize races where a player would have to push his Lost Soul around the level and the first one to complete a lap wins the race. 1 Share this post Link to post
Arctangent Posted April 18, 2017 1 hour ago, Empyre said: If it is supposed to be 6 tic per frame with that sprite, then just change each 3 into a 6. That's not remotely the same thing. Changing it to 6 would cause it to move at half speed and be half as aggressive - meanwhile, defining two states with the same sprite at duration 3, each calling A_Chase causes it to animate the same as changing the frames to 6, but without halving the speed - since, y'know, you're not calling the function that moves the actor half as often. 0 Share this post Link to post
Nevander Posted April 18, 2017 Decided to go with this: See: HEAD A 0 A_ScaleVelocity(0.50) HEAD AABBCCDD 3 A_Chase Loop 0 Share this post Link to post
RjY Posted April 18, 2017 (edited) 3 hours ago, axdoomer said: When a charging Lost Soul gets hit, they (the developers at id) forgot to set it into its pain state and make it fight back. They also set its momentum to 0, so the result is that it drifts away in the direction of the damage you have applied to it. Indeed. I made the change 9 years ago now ;) (and it's based on something even older) 3 hours ago, axdoomer said: I had some hilarious time on E2M8 with the Lost Souls. You wait for it to charge, then you shoot it with the pistol so it drifts in the direction that you want. If the Cyberdemon wasn't there, you could easily organize races where a player would have to push his Lost Soul around the level and the first one to complete a lap wins the race. Haha, I used to play pigeon shooting. Wait for the thing to charge, then run out of the way, and try to shoot it as it flies past you perpendicularly. Shouting "PULL!" is optional. Edited April 18, 2017 by RjY 0 Share this post Link to post
Empyre Posted April 18, 2017 4 hours ago, Arctangent said: That's not remotely the same thing. Changing it to 6 would cause it to move at half speed and be half as aggressive - meanwhile, defining two states with the same sprite at duration 3, each calling A_Chase causes it to animate the same as changing the frames to 6, but without halving the speed - since, y'know, you're not calling the function that moves the actor half as often. Thanks! Now I have learned something new. I have not yet made monsters, only weapons and pick-ups. 0 Share this post Link to post
Nevander Posted April 19, 2017 On 4/17/2017 at 6:19 PM, RjY said: I find the behaviour of lost souls in this situation just as annoying, as a single bullet will halt their charge and leave them to float very slowly across the landscape until a collision which may be several minutes away. How would one fix this behavior in DECORATE? I just had it happen to me and remembered this thread, so maybe there's a way to fix it in DECORATE like the Cacodemon drifting away too. 0 Share this post Link to post
Graf Zahl Posted April 19, 2017 That cannot be changed from DECORATE. The code fragment responsible here is deep inside P_DamageMobj: if (target->flags & MF_SKULLFLY) { target->Vel.Zero(); } Without some actual scripting to clear the flag you won't be able to do anything about it, but even if you got that far, you'd have problems deciding afterward what to do with the flag because it is not particularly straightforward to decide whether to set it again or not. 0 Share this post Link to post
HorrorMovieRei Posted April 19, 2017 This is a little known fact, but Lost Souls are actually very polite. Unlike the other demons who just duke it out in front of everyone, Lost Souls prefer to resolve their conflicts in private, even if it is just a few meters above your head. 4 Share this post Link to post