[No] A_CustomMissileIntercept

Moderator: Developers

A_CustomMissileIntercept

Postby SFJake » Wed Sep 02, 2009 12:28 am

This has been suggested before, I think.. There never was anything else about this but positive thoughts, but its just forgotten.

Basically, this: http://zdoom.org/wiki/Thing_ProjectileIntercept, for monsters.

This would add so much to custom monsters if such a thing was possible. In fact, a simple flag to make a monster predict its attack would already add a lot.

I'm personally tired that even the most fearsome of monsters can't actually aim where you will be. ZDoom can already do something similar with Thing_ProjectileIntercept, so I was wondering if it would be hard to make it work with CustomMissile?

Its feature I have been dying to see for years, now. If there ever was a definite "no" with a good reason over this feature, I'd at least want to know that reason..
User avatar
SFJake
 
Joined: 03 Nov 2007

Re: A_CustomMissileIntercept

Postby Tormentor667 » Wed Sep 02, 2009 5:48 am

Seconded
User avatar
Tormentor667
 
Joined: 16 Jul 2003
Location: Germany

Re: A_CustomMissileIntercept

Postby Mikk- » Wed Sep 02, 2009 6:28 am

This would be awesome,
If I understand correctly, a monster would fire a missile with much more accuracy, instead of firing where the target was when the attack function was called?
User avatar
Mikk-
I found a gun in the Laundry Cart, guess someone didn't like the room service.
 
Joined: 30 Jun 2009
Location: Space station base of the UAC

Re: A_CustomMissileIntercept

Postby Cutmanmike » Wed Sep 02, 2009 6:50 am

It would fire a missile at a player in the direction of where he would be if he kept running in that direction at the same speed. An interesting calculation I would like to see (and probably give up trying to work it out).

Oh btw can't we turn this into a flag or something rather than a completely new function?
User avatar
Cutmanmike
Not dead
 
Joined: 06 Oct 2003
Location: United Kingdom

Re: A_CustomMissileIntercept

Postby Gez » Wed Sep 02, 2009 7:12 am

Cutmanmike wrote:Oh btw can't we turn this into a flag or something rather than a completely new function?

Yup. There's even already an aimmode parameter for A_CustomMissile!
Gez
 
Joined: 06 Jul 2007

Re: A_CustomMissileIntercept

Postby Ichor » Wed Sep 02, 2009 7:31 am

Gez wrote:
Cutmanmike wrote:Oh btw can't we turn this into a flag or something rather than a completely new function?

Yup. There's even already an aimmode parameter for A_CustomMissile!

I guess the wiki needs updating then. Aimmode 16 is it?
User avatar
Ichor
42
 
Joined: 23 Jul 2003

Re: A_CustomMissileIntercept

Postby Cutmanmike » Wed Sep 02, 2009 7:41 am

I think Gez means that "aimmode" is already a field in the function to allow more flags to be added, such as Intercept.
User avatar
Cutmanmike
Not dead
 
Joined: 06 Oct 2003
Location: United Kingdom

Re: A_CustomMissileIntercept

Postby CaptainToenail » Wed Sep 02, 2009 9:28 am

YES!
User avatar
CaptainToenail
 
Joined: 06 Jul 2007

Re: A_CustomMissileIntercept

Postby HotWax » Wed Sep 02, 2009 5:46 pm

Cutmanmike wrote:An interesting calculation I would like to see (and probably give up trying to work it out).

Simple trigonometry. :) A line drawn from the shooter to the target makes up one side of a triangle, and the target's rate of movement makes up another. Using some trigonometric calculations, it's possible to determine the angle at which to fire to form the third side of the triangle and cause the shot to connect.

Code: Select allExpand view
if (leadTarget && speed > 0 && (targ->velx | targ->vely | targ->velz))
{
    // Aiming at the target's position some time in the future
    // is basically just an application of the law of sines:
    //     a/sin(A) = b/sin(B)
    // Thanks to all those on the notgod phorum for helping me
    // with the math. I don't think I would have thought of using
    // trig alone had I been left to solve it by myself.

    FVector3 tvel(targ->velx, targ->vely, targ->velz);
    if (!(targ->flags & MF_NOGRAVITY) && targ->waterlevel < 3)
    { // If the target is subject to gravity and not underwater,
      // assume that it isn't moving vertically. Thanks to gravity,
      // even if we did consider the vertical component of the target's
      // velocity, we would still miss more often than not.
        tvel.= 0.0;
        if ((targ->velx | targ->vely) == 0)
        {
            goto nolead;
        }
    }
    double dist = aim.Length();
    double targspeed = tvel.Length();
    double ydotx = -aim | tvel;
    double a = acos (clamp (ydotx / targspeed / dist, -1.0, 1.0));
    double multiplier = double(pr_leadtarget.Random2())*0.1/255+1.1;
    double sinb = -clamp (targspeed*multiplier * sin(a) / fspeed, -1.0, 1.0);

    // Use the cross product of two of the triangle's sides to get a
    // rotation vector.
    FVector3 rv(tvel ^ aim);
    // The vector must be normalized.
    rv.MakeUnit();
    // Now combine the rotation vector with angle b to get a rotation matrix.
    FMatrix3x3 rm(rv, cos(asin(sinb)), sinb);
    // And multiply the original aim vector with the matrix to get a
    // new aim vector that leads the target.
    FVector3 aimvec = rm * aim;
    // And make the projectile follow that vector at the desired speed.
    double aimscale = fspeed / dist;
    mobj->velx = fixed_t (aimvec[0] * aimscale);
    mobj->vely = fixed_t (aimvec[1] * aimscale);
    mobj->velz = fixed_t (aimvec[2] * aimscale);
    mobj->angle = R_PointToAngle2 (0, 0, mobj->velx, mobj->vely);
}
 
User avatar
HotWax
Do what you must, and pay the price later.
 
Joined: 18 Jul 2003
Location: Idaho Falls, ID

Re: A_CustomMissileIntercept

Postby Eriance » Thu Sep 03, 2009 8:29 pm

Hellsmith with intercepting power-ed up Hellstaff balls....awww yeah.... :P
User avatar
Eriance
Now delivering MORE of LESS!
 
Joined: 26 Jul 2004
Location: Somewhere in nowhere

Re: A_CustomMissileIntercept

Postby Ryan Cordell » Thu Sep 03, 2009 11:22 pm

Eriance wrote:.. with intercepting power-ed up Hellstaff balls....awww yeah.... :P


.. Some vicious balls there. :mrgreen:
User avatar
Ryan Cordell
Smashing!
 
Joined: 06 Feb 2005
Location: Capital of Explodistan.

Re: A_CustomMissileIntercept

Postby SFJake » Mon Sep 07, 2009 3:46 pm

Glad to see this is supported. So, no need for a new command altogether, but just another "setting" for aimmode. I still wonder if thats too much trouble to add, though.
User avatar
SFJake
 
Joined: 03 Nov 2007

Re: A_CustomMissileIntercept

Postby The Slimeinator » Mon Sep 07, 2009 4:38 pm

DO WANT.
User avatar
The Slimeinator
 
Joined: 26 Jun 2009

Re: A_CustomMissileIntercept

Postby SFJake » Sat Sep 19, 2009 12:33 pm

..is there anything special I need to do to get a feature noticed and answered? I'm all for patience, but it just feels like this is going to fall through the forum into nothingness.
User avatar
SFJake
 
Joined: 03 Nov 2007

Re: A_CustomMissileIntercept

Postby Gez » Sat Sep 19, 2009 1:37 pm

SFJake wrote:..is there anything special I need to do to get a feature noticed and answered?

No. The best you can obtain by bumping stuff in this way is annoy the devs, who could then just move the thread to closed feature suggestions with a [No].

The thing would be to put the intercept logic in the core missile spawning code, to unify the missile spawning functions and remove redundancy. But they're written very differently so it's tedious work.
Gez
 
Joined: 06 Jul 2007

Next

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: Yandex [Bot] and 1 guest