Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
entryway

I'm surprised: revenants have two sorts of missiles: unguided and homing

Recommended Posts

Five minutes ago I got to know, that a revenant can spawn two kinds of missiles: unguided and homing (with smoke). All my life I thought, that the revenant's missiles are homing always, heh. I have checked up. It is the truth! Now I must know, what is the algorithm of select of the missile type. When it's unguided and when it's homing. Please.

Share this post


Link to post

I've known this for awhile (it's been discussed here even), though I didn't notice for a long time.

Share this post


Link to post

Yes, it's pretty easy to see when it's a homing missile because it has a smoke trail. I tend to still overreact a bit to Revenant attacks because I used to think they always homed in on you, but it's better to look at each missile to see whether it's worth taking extra precautions, and only against those that will follow you.

EDIT: As for where this is determined, there's a section on A_SkelMissile in p_enemy.c, perhaps it's there?

Share this post


Link to post

Yes, and this is a major demosynch issue, given that the decision whether the missile homes depends on the gametic number (modulo 4). So I am surprised you weren't very familiar with this.

Some earlier discussion here (the linked post and several following), and, much earlier, in the LMPC documentation by Uwe Girlich.

I was at some point toying with the idea of a prboom-plus feature request along the lines of "when pausing during a recording, ensure the pause is always a multiple of four tics" - the point being that it can then be removed entirely without causing a desync.

Share this post


Link to post

I would have wrote that Mancubi have also 3 ranged attacks.
But after checking it, I was wrong.
It seems that they have 1 one ranged attack consisting of 6 projectiles, fired in 3 shots. In the last shot his projectiles will always go to the left and the right. In the first two shots one will always go straight, the other either to the right or to the left.
Once it start firing it will always end it's attack unless it's killed.
So getting out of his line of sight or inflicting pain won't help to stop his 3 shots.

Share this post


Link to post

Coldfusio said:
Once it start firing it will always end it's attack unless it's killed.
So getting out of his line of sight or inflicting pain won't help to stop his 3 shots.

Actually, the pain state will stop them, just like it stops a Cyberdemon's slew of rockets, even though they will also finish firing all their shots when the target is out of sight.

Share this post


Link to post

The type of missile depends upon the gametic on which the missile is fired. Code from A_Tracer:

   if((gametic-basetic) & 3)
      return;
In the original code, this only checks if(gametic & 3), causing internal demos with Revenants to desync. This was fixed with the basetic in BOOM by Lee Killough.

Note that this is sensitive also to the duration of the Revenant's missile frames, since it is expecting a certain periodicity to the A_Tracer calls. If you mess with those durations, it will mess with the homing, possibly causing the missiles to alternate between homing and non-homing in flight.

Basically, all of the missiles are set up to home, but the ones that don't home and don't smoke are calling A_Tracer on the wrong gametics.

Share this post


Link to post
myk said:

EDIT: As for where this is determined, there's a section on A_SkelMissile in p_enemy.c, perhaps it's there?

I can't find a piece of code with check about type of spawned missile :( At least in first look

A_SkelMissile always spawn P_SpawnMissile (actor, actor->target, MT_TRACER) without any conditions and calls of P_Random()

Share this post


Link to post
Quasar said:

The type of missile depends upon the gametic on which the missile is fired. Code from A_Tracer:

   if((gametic-basetic) & 3)
      return;

hmm, my understanding of A_Tracer was "this function is called every tick for every missile and does something (changes an angle) only each fourth tic"

Share this post


Link to post

The duration of the Revenant's missile's states is 2. So depending whether it is spawned in an even or odd tic it's either homing or not. It wouldn't surprise me the least if this was actually a bug nobody noticed when Doom 2 was released.

Share this post


Link to post
Graf Zahl said:

The duration of the Revenant's missile's states is 2. So depending whether it is spawned in an even or odd tic it's either homing or not. It wouldn't surprise me the least if this was actually a bug nobody noticed when Doom 2 was released.

Thanks. I have understood the behaviour

Share this post


Link to post
Quasar said:

The type of missile depends upon the gametic on which the missile is fired. Code from A_Tracer:

   if((gametic-basetic) & 3)
      return;

So if gametic is not divisible by 4, it returns. Note that your EE codepointer reference has an error at Tracer's description :) I previously thought it has to be a multiple of 2, not 4.

If there weren't a projectile first frame length randomization (which is visible at blue plasma), a Revenant, whose sequences of life are all of even duration, would keep shooting missiles of one designated type until hurt repeatedly at correct timing. Sometimes it happens in game, a Revenant repeatedly shooting blind missiles till harmed - not proven.

How shots will act depending on state duration... some durations:

  • 1: always homing,
  • 1,2: 2/3 homing,
  • 2,2: 1/2 chance homing
  • 2,3: 2/5 homing,
  • 3,3: 1/3 homing,
  • 3,4: 2/7 homing
  • 4,4: 1/4 chance homing
  • 6,6: 1/2 chance 1/3 homing
Before I make up my mind, let's guess that the homing has a quality equaling 1/average_of_durations.

Edit: If durations are equal, if both are odd, then it ALWAYS homes at 1/duration sensitivity. If both are even and not divisible by 4, then it has half chance to home at 2/duration sensitivity. If both are even and divisible by 4, then the chance is 1/factor_of_4 to fully home.

Share this post


Link to post

Yeah there are several minor errors in the codepointer ref. This was caused by me simply skimming over the source very quickly to get the jist of what every function was doing. In some cases I read a few lines too quickly and misinterpreted them ;) I intend to fix such things as I find them, but I haven't had time for a while.

Graf Zahl: I agree. I believe that statement was meant to limit the homing precision of the missiles, so that on some frames they would not home toward you. But using gametic instead of some kind of other non-global timer doesn't work that way for obvious reasons. It's possible, of course, that they saw the code working this way and liked it. Having homing vs. non-homing missiles does add an element of surprise to the Revenant, intentional or otherwise :)

However, due to the seestate duration tic randomization that printz mentioned, it's not as simple as whether it is spawned on an even or odd tic. That randomization can throw the whole thing off.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×