project-navigation
Personal tools

Author Topic: Reaction Fire  (Read 30701 times)

Offline Battlescared

  • Squad Leader
  • ****
  • Posts: 107
    • View Profile
Re: Reaction Fire
« Reply #15 on: June 29, 2010, 11:54:12 pm »
In most cases that will work pretty well. Sometimes it really doesn't since aliens are suicidal bastards. E.g. what good is hiding behind a corner with no working RF if an Ortnok just closes in on you and finishes you off with a brutal head-butt. ;-)

I have not really seen this.  More times than not, those guys walk up to me and find me in the same spot they were trying to get to, and when they get there, they have no TU to fire with, so they just turn around and walk away.  POP!  One dead alien.  That's the tricky part, trying to position yourself somewhere they want to go just far enough ahead to be waiting for ambush.   Then you don't have to rely on reaction fire, you have the advantage on the next turn.  Realizing that, yeah, they are suicidal, and quite dumb, makes it a little easier to predict where to set yourself.

And a little bait now and then helps too :)

Offline TDarklighter

  • Rookie
  • ***
  • Posts: 12
    • View Profile
Re: Reaction Fire
« Reply #16 on: June 30, 2010, 02:17:00 am »
Yep.  And then there's the "You just landed and now three aliens are firing at your soldiers every step any of them takes" scenario.  It might not be bugged in the sense that it's crashing the game, but it's bugged in the sense that if you turn your guys towards the aliens and end turn with almost full TUs, the aliens will shoot or run out of sight while your guys just stand there.

On the other hand, I haven't built up any of my guys to very high levels of mind yet, so maybe that's the trick.  I recall in 2.2.1 that my starting guys at least fired off a shot every few aliens to go by.  I wouldn't mind having that, with accuracy and frequency increasing the higher their traits go up.  It would be better than sixty missions of watching them die horribly as entire squads of aliens frolick by them with plasma guns blazing.   :P

Offline Valaska

  • Rookie
  • ***
  • Posts: 17
    • View Profile
Re: Reaction Fire
« Reply #17 on: June 30, 2010, 10:21:27 am »
 Yeah the new reaction fire is.. Special... It's obviously broken to me at any rate. Or at least make speed easier to build up or build up at all.

Offline Jarkill

  • Rookie
  • ***
  • Posts: 25
    • View Profile
Re: Reaction Fire
« Reply #18 on: July 02, 2010, 06:11:51 am »
Is there any intention to change it so that timing runs more "fairly"?

IE you don't just get only one shot and then they get to shoot, regardless of TU cost?

For example, if it still cost 7 tu for the guy to stab twice in reaction fire, and the other guy was instead using an assault rifle w/ full auto (18 tu) the order would be

1)Stab
2)Stab
3)Full Auto
4)Stab
5)Stab

Whereas as it currently stands it would only check which had the lower cost for the purposes of whoever fires first

1)Stab
2)Full Auto
3)Stab
4)Stab
5)Stab

Is there any intention to change it to using the first one instead of the second one?

Offline Sarin

  • Sergeant
  • *****
  • Posts: 339
    • View Profile
Re: Reaction Fire
« Reply #19 on: July 02, 2010, 02:31:04 pm »
Actually, it works like neither of these.

There is no reliable info from developers yet, but from experience, I guess it is like this: every TU alien spends in soldiers view and soldiers mind stat increase the chance of RF, while TU cost of selected RF decreases the chance. There is no actual "hard" limit to TU alien has to spend before RF activates. I had a situations where alien just walked in and got killed by RF before having chance to do anything.

Offline queue

  • Rookie
  • ***
  • Posts: 10
    • View Profile
Re: Reaction Fire
« Reply #20 on: July 09, 2010, 03:07:34 am »
After examining the source of 2.3 some time, I've come to conclusions, that:
RF can only be used by right hand.
Mind or speed skills are meaningless for RF.
There are no random parts, RF is fully predictable (and thus avoidable by AI).
It's buggy. Badly.


RF will never happen, if:
1. RF is set to left hand
2. chance to hit is smaller than 30%
3. friendly fire possibility greater than 5% (depending on mental state higher)

RF will be triggered immediately, if:
1. target aimed at, while new enemy is moving or attacking in LOS (line of sight) OR enemy turn is ending
2. target is attacking with a fire mode, which uses more or equal TU than RF fire mode (buggy, won't work most time)


The intended logic for RF seems to be, that every soldier is aiming at a single target, while it is moving in his LOS. And when the target's TU drop below a certain number, he fires on every further move of the target. So every soldier has a reaction target and a reaction TU value. When reaction target is set (enters line of sight), reaction TU is set to [actual targets TU] - [rf fire mode TU] / 4.
If an alien enters LOS with 20 TU and the Soldier with assault rifle is in 3 shot rf mode (12 TU), reaction TU is 17. If the alien moves 2 squares, the soldier will open fire. The machine gunner on full auto will have a reaction TU of 14 on the alien.
If the alien moves out of sight and enters sight again with less TU, soldiers who spotted it first will open fire immediately. Also, if another enemy moves, execution of the reaction shot is performed on the spot (and hopefully also on the former, now deceased, target).

Now comes the buggy part. If the alien attacks with his crappy plasma pistol, the TU of the attack (for comparison with RF) is calculated by the same function, which calculates the TU of the RF. That's just plain wrong, because it checks the aliens rf mode instead of the actual attack. And this function is limited to the right hand. And there is a wrong parameter, the alien attack is checked with the reacting soldiers right hand weapon. So there are at least 3 reasons, why this results in an error nearly every time. The function gives back the number -1, but the error is not checked. Instead the remaining rf calculations will be based on an alien attacking with an -1 TU action. So the reacting soldier will lose the duel every time. Best part, now the reaction TU are recalculated on the formula [actual targets TU] - ([rf fire mode TU] - [targets fire mode TU]. With the miscalculated target attack value this results in 15 - (-1 - 12) = 2 TU. This means, the alien can move freely and even attacking multiple times, without triggering RF, as long the AI takes it out of line of sight in the end.


So, RF is flawed. Use any weapon, and RF won't be triggered. I'm not sure, if this TU recalculation on attack should happen at all.
I'm more into C# and .NET, but i will see the trunk code tomorrow and if the bug remains, try to fix it. Seems not too difficult.


Now, we are to discuss tactics here, are we?
In flawed 2.3, never act with more than one soldier in enemy sight. When entering enemy LOS, you can prevent RF by firing a snap shot, before moving in and burst aliens to bits. If you intend to use RF yourself, don't use aimed shots or full auto, better are snap shots or pistols. with 5 TU laser pistol shot, even the attacking bug would not extend the "free move" range to more than 3 squares.
If you feel lucky, try to use the same weapons than the aliens and win the RF duel.

Offline dodon

  • Rookie
  • ***
  • Posts: 48
    • View Profile
Re: Reaction Fire
« Reply #21 on: July 09, 2010, 08:06:37 am »
good breakdown :)

I think you missed the following (I work with trunk so there might be differences):

Mind or speed skills are meaningless for RF.
Soldierstats influence the chance to hit.


There are no random parts, RF is fully predictable (and thus avoidable by AI).
And the player can do the same :)


2. chance to hit is smaller than 30%
3. friendly fire possibility greater than 5% (depending on mental state higher)
I thinkthats the chance to hit with atlast one bullet, so burst mode improve the chances.


2. chance to hit is smaller than 30%
that seems to be the most important part for the RF not happening. Good soldiers and precise wappons  improve that chance

This means, the alien can move freely and even attacking multiple times, without triggering RF, as long the AI takes it out of line of sight in the end.
The code works for both sides the same way ;)


I'm not sure, if this TU recalculation on attack should happen at all
I think thats a bug


you missed the part where the react "reaction TU" are not reset after a shot so the next shot takes place on the "next step"
There is no test for reaction fire after crouche and turne.

Offline Ufanatic

  • Rookie
  • ***
  • Posts: 33
    • View Profile
Re: Reaction Fire
« Reply #22 on: July 09, 2010, 05:04:10 pm »
Now comes the buggy part. If the alien attacks with his crappy plasma pistol, the TU of the attack (for comparison with RF) is calculated by the same function, which calculates the TU of the RF. That's just plain wrong, because it checks the aliens rf mode instead of the actual attack. And this function is limited to the right hand. And there is a wrong parameter, the alien attack is checked with the reacting soldiers right hand weapon. So there are at least 3 reasons, why this results in an error nearly every time. The function gives back the number -1, but the error is not checked. Instead the remaining rf calculations will be based on an alien attacking with an -1 TU action. So the reacting soldier will lose the duel every time. Best part, now the reaction TU are recalculated on the formula [actual targets TU] - ([rf fire mode TU] - [targets fire mode TU]. With the miscalculated target attack value this results in 15 - (-1 - 12) = 2 TU. This means, the alien can move freely and even attacking multiple times, without triggering RF, as long the AI takes it out of line of sight in the end.
I don't get this part at all. Giving back a negative value? Second formula that compares used weapons by both fighters involved?
Could you break it down again while using 2 example weapons, e.g. MGunner VS Plasmapistol-Alien + Pistolsoldier VS Plasmapistol-Alien?


When entering enemy LOS, you can prevent RF by firing a snap shot, before moving in and burst aliens to bits.
Why will that change anything? Won't my soldier just be "the guy who entered my (aliens) LOS with only 22 TUs, then took two steps and thus cracked my plasma-pistols RF threshold ..." ?


I'm more into C# and .NET, but i will see the trunk code tomorrow and if the bug remains, try to fix it. Seems not too difficult.
Hell yeah! Medal of Awesomeness awarded in advance!  ;D

Offline queue

  • Rookie
  • ***
  • Posts: 10
    • View Profile
Re: Reaction Fire
« Reply #23 on: July 09, 2010, 09:23:33 pm »
I don't get this part at all. Giving back a negative value? Second formula that compares used weapons by both fighters involved?
Could you break it down again while using 2 example weapons, e.g. MGunner VS Plasmapistol-Alien + Pistolsoldier VS Plasmapistol-Alien?
I'll try.

James Bond (pistol snap shot) and John Rambo (MG full auto) are awaiting ET. ET came around the corner and enters both LOS with 20 TU left. Both aim at ET, Bond will fire at 20-(6/4) = 18,5 TU, next alien step. Rambo will fire at 20-(25/4) = 13,75 TU, allowing ET to move up to 4 further steps into his LOS, before reaction is triggered. Seems fine.
But ET does not take a walk, instead it fires at Bond with plasma pistol snap shot. Bonds reaction would take 6 TU, ET's attack equals at 6 TU, attacker shoots first on draw. Rambo is even slower, so no reaction before the shot. In theory, laser pistol snap shots with 5 TU should fire before ET's attack. There is a recalculation of the reaction TU, which should IMO not happen, if reaction TU is already set. Bond, probably taking the hit, will now fire at 20-(6-6)= 20 TU, next alien step if he survives. Rambo will fire at 20-(25-6) = 1 TU, giving up reaction without reason.
Now the actual attack takes place, ET loose 6 TU, 14 remaining. After attack, movement reaction will be triggered, allowing both soldiers to check their reaction. Bond, if he survived, will now react, if he gets the 30% chance. He will also react on every alien movement, as long ET remains visible and Bond has TU left.

Thats the theory, in fact it is even worse. The reaction fire code knows only, ET is about to attack, but has no clue, how this will happen. Instead of comparing with the alien attack TU (plasma pistol snap shot = 6), the code checks ET's reaction fire settings with the soldiers weapon. So, all calculations are completely fucked up and there is a good chance, the function can't calculate a result at all. Some examples:
- ET does not have reaction fire activated (why should it? its attacking) on right hand
- soldiers weapon cannot be used on reaction fire mode of ET (f.e. it uses the third fire mode for reaction, pistol has no third mode, mg cannot react with it) or the range is too far

Ancient coding rule #1 says "Thou shall return a value of -1, if no sane result can be calculated.". While there should be better ways nowadays, UFO:AI stand by the traditional rules. But there is no further check for this error, instead the -1 is interpreted as -1 TU attack and the RF code thinks, ET has become Lucky Luke. So not even Flash Gordons laser pistol snap shot stands a chance against the alien, shooting faster than its shadow. Miscalculated reaction TU for Bond is in fact 20-(6-(-1))=13, meaning he will not even react after the alien attack. No chance for Flash Gordon also, he has a reaction TU of 14.
RF only gets you a countershot at aliens using slower fire modes.

Why will that change anything? Won't my soldier just be "the guy who entered my (aliens) LOS with only 22 TUs, then took two steps and thus cracked my plasma-pistols RF threshold ..." ?
Not if you become Lucky Luke, because the reaction TU is reset on the attack.


Soldierstats influence the chance to hit.
that seems to be the most important part for the RF not happening. Good soldiers and precise wappons  improve that chance
That's right. But stats inflicts RF only indirect on rare occasions. Weapons are more important than soldier stats, the weapon has to be much faster than the alien weapon and you have to survive the alien shot.

I thinkthats the chance to hit with atlast one bullet, so burst mode improve the chances.
Could be. But you will rarely get a reaction fire check in burst mode, if AI follows its usual tactic "step in sight, fire at will, step out sight".
Which seems to be a great tactic.

And the player can do the same :)
The code works for both sides the same way ;)
Right, if the player has red and understand the C source code, gets very detailed instructions or has a very good observation skill over a long time.
Not all players like to learn game rules this way. ;)

you missed the part where the react "reaction TU" are not reset after a shot so the next shot takes place on the "next step"
There is no test for reaction fire after crouche and turne.
Both right. I didn't mention these, because they seem to be more clearly to the non-coding player.


Well, time to see the trunk.
« Last Edit: July 09, 2010, 09:31:55 pm by queue »

Offline Ufanatic

  • Rookie
  • ***
  • Posts: 33
    • View Profile
Re: Reaction Fire
« Reply #24 on: July 10, 2010, 05:04:09 am »

Thanks for the explanation queue. I think I get it now ... possibly not how that influences a whole soldier/alien squad:

The "Lucky Luke"-phenomenon is caused by low TU firemodes that reset the RF-calculation for the entire following series of actions, hence your "tactical hint" translates as:
Enter Aliens LOS, jam his RF-calculation by using a low-TU snap shot, then proceed to move in with your squad and blast them to hell with full-automatic fire. (?)

I guess that would explain all those reports about Aliens doing complete moonwalks right in the LOS of soldiers without RF happening:
If they were only walking, RF would be very likely to happen. Unfortunately, some Alien had fired a single snap shot before which results in the complete squad of soldiers staring at the end of their barrel while the entire Alien-army performs a parade right in front of them. (?)

Offline queue

  • Rookie
  • ***
  • Posts: 10
    • View Profile
Re: Reaction Fire
« Reply #25 on: July 10, 2010, 04:03:09 pm »
I'm finished with bug fixing.
changes:
- no recalculation of reaction TU, when enemy attacks faster
- shooting will trigger reaction targetting before the actual shoot, not after, allowing soldiers to react, who didn't see the enemy until he shoots
- draw duel is resolved with the right values, allowing faster reaction shooters to fire before enemy attacks
- after reaction shot took place, reaction TU is reset according to full TU cost of the reaction, giving the enemy new time to act


Test Scenario: New standard game, unchanged equipment (did not even give combat armor to every soldier), first mission, excavation terror

1st Turn: moving soldiers into position, switch one Sniper to pistol, all on snap shot rf
Team 1 ended round
Team 7's round started!
3 taman enter LOS of 4 of my soldiers, all stay in sight, one shooting, getting first rf
Team 7 ended round
Team 1's round started!
2nd Turn: don't move
Team 1 ended round
Team 7's round started!
aliens try to rush the soldiers, heavy fire from both sides, wounding one soldier severely (3 hp left) and multiple aliens
Team 7 ended round
Team 1's round started!
3rd Turn: stand the urge to save private Ryan and hold the line
Team 1 ended round
Team 7's round started!
- First alien try to chop wounded soldiers head off, getting shot while closing
[STATS] queue (Bjorn Assar) kills alien (Krrnaak Tkr Hruk) with Snap Shot of sniper_ammo
- Second alien aims bad and is shot in the back while retreating
[STATS] queue (Ahalya Baldwin) kills alien (Uonak Pt Mrlkuk) with Snap Shot of assault_ammo
- poor Pvt. Herring is out of luck
[STATS] alien (Krrnaak Kr Zrrosk) kills queue (Leza Herring) with Snap Shot of plaspistol_ammo
- and the reaction of a further attack of alien 3
[STATS] queue (James Ramirez) kills alien (Krrnaak Kr Zrrosk) with Snap Shot of pistol_ammo
Team 7 ended round

That was amazing, perhaps even too strong. On the other hand without RF all aliens, standing close to each other, could be killed on second turn with grenades or burst fire. Aliens hat bad luck and did only land very few hits with very many shots. So, it works for me.

Offline Sarin

  • Sergeant
  • *****
  • Posts: 339
    • View Profile
Re: Reaction Fire
« Reply #26 on: July 10, 2010, 06:15:08 pm »
Great...

Now it's my time to as a noobish question...how do I apply the patch?

Offline queue

  • Rookie
  • ***
  • Posts: 10
    • View Profile
Re: Reaction Fire
« Reply #27 on: July 10, 2010, 11:33:46 pm »
If you ask this question, chances are high, you can not.
It is a patch for the source code.
You have to apply the patch to the source and compile the game yourself, to run it.

The patch is in tracker http://sourceforge.net/tracker/?func=detail&aid=3027802&group_id=157793&atid=805244 . If one of the developers apply it and approve the changes to subversion, it will be in future versions.
But there is also a much larger patch, rewriting the whole reaction fire and parts of the combat system. It is not implemented since 4 months. Perhaps my changes will get approval faster, because changes are small and simple.

Offline dingoperson

  • Rookie
  • ***
  • Posts: 11
    • View Profile
Re: Reaction Fire
« Reply #28 on: July 11, 2010, 05:43:57 pm »
Heyhey, fellow reaction fire enthusiasts  ;)
I just joined the forum after playing quite a bit, but I'll plonk down my RF thoughts here instead of in a general thread. I understand it's a hot topic.

Maybe I just didn't find the right button, but I get the impression that to get RF you must activate RF _which also_ reserves the RF number of TUs. So any turn in which you want RF you have to activate this, and when you want to move your full movement you have to deactivate it.

If so, it really boggles the mind. I mean, just needing to 'activate RF' alone seems a bit silly. A bit like:

"Lt. Johnson, this is your commander"
J: "Sir?"
"You know how for the last hour you have been sitting around with your sniper rifle while all your squaddies have been running around  chasing aliens?"
J: "Yes Sir, what about it?"
"Have you seen any aliens?"
J: "Two Sir, over at the field, they were walking from the UFO to inside the farmhouse"
"OK, do you think that next time you see them move, you can shoot your gun at them? I forgot to tell you but that's actually what I want you to do."
J: "Wow, OK Sir, I'll do that"

And then activating/deactivating RF each turn to turn on or off RF reservation is fully redundant in favour of simply using RF _if_ you have the TUs from it. Seriously, do we need that much to be "protected" from spending too many TUs so we don't "accidentally" make ourselves unable to use RF? After a couple of missions I know precisely the TU cost of every firing mode for every weapon.

With the current system, let's say you start with 2 soldiers by your craft, and you want to move them both next to a house one at a time.
- Turn 1 you activate RF with soldier 1, and move soldier 2 next to the house.
- Turn 2 you activate RF with soldier 2 and point him towards the door in case an alien walks out. You deactivate RF with soldier 1, and move him next to house as well.
- Turn 3 you activate RF with soldier 1 as well.
- Turn 4 you deactivate RF with soldier 1 and move him inside the house, and deactivate RF with 2 and do the same.

Compared to:
- Turn 1 you move soldier 2 and let soldier 1 stay behind
- Turn 2 you move soldier 1 as well.
- Turn 3 you click 'next turn'
- Turn 4 you move them both inside

So basically, I would be really happy with the current system IF you didn't have to click the button all the time to reserve/unreserve TUs.

This was the way it was done in UFO 1 and it seemed to work quite well. Is there any reason why the same mechanism can't be adopted? Any feelings about turtling/overpowered etc could be taken care of by introducing variable chances for RF not to happen.

Offline Ufanatic

  • Rookie
  • ***
  • Posts: 33
    • View Profile
Re: Reaction Fire
« Reply #29 on: July 12, 2010, 05:45:49 am »
It is a patch for the source code.
You have to apply the patch to the source and compile the game yourself, to run it.

Bummer  :(

So there is no way to insert those lines into the respective files on an already installed (and loaded with savegames) version?

I hardly know anything about programming (or what a source actually is for that matter)
but won't the scripts for RF have to be somewhere?