Author Topic: Unequal LOS - what's going on here?  (Read 9946 times)

Offline Markus Ramikin

  • Captain
  • ***
  • Posts: 83
    • View Profile
Unequal LOS - what's going on here?
« on: January 30, 2015, 11:14:15 am »
Savegame attached.

The soldier on 32,19, Niahm O'neill vs Floater on 24,31.

If the soldier moves left, to 31,20, she dies from the Floater's reaction fire. No mutual-surprise.
Other approaches, either to 32, 20, or to 31,19 then 30,20, result in mutual surprise.

What's going on here? Something wrong with smoke calculations? Assymetry in LoS shapes?

What's especially weird is that the "bad" spot, 31,20, from which she can't see the floater, is between the two "good" ones, 32,20 and 30,20.
« Last Edit: January 30, 2015, 01:39:46 pm by Markus Ramikin »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #1 on: January 30, 2015, 04:04:05 pm »
soldier B isn't taking reaction fire AFTER the alien already reacted to soldier A. if you move soldier B first, he gets shot just the same. the aliens spend TUs when performing reaction shots, and so their reaction score drops.
as for the alien seeing you when you can't see it, think of it this way: your soldier's line of sight is a line, traced from near the top center of the soldier, which is represented in 3d space by a cylinder of diameter 3. the alien can see you because of these 3 voxels: the alien's line of sight has to travel through say, 320 voxels to spot you, 17 of which are smoke, your soldier has the same 320 length line, but because his is starting from inside the smoke, it has to go through 20 voxels filled with smoke, hence the difference.

Offline Markus Ramikin

  • Captain
  • ***
  • Posts: 83
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #2 on: January 30, 2015, 04:54:00 pm »
soldier B isn't taking reaction fire AFTER the alien already reacted to soldier A. if you move soldier B first, he gets shot just the same. the aliens spend TUs when performing reaction shots, and so their reaction score drops.
I know how reaction fire works. Are you responding to this? "Other approaches, either to 32, 20, or to 31,19 then 30,20, result in mutual surprise". I didn't mean "the other soldier approaches". I meant other lines of approach. With the Floater still having his TUs, if you move the first soldier to 32, 20 you get mutual surprise.

Quote
as for the alien seeing you when you can't see it, think of it this way: your soldier's line of sight is a line, traced from near the top center of the soldier, which is represented in 3d space by a cylinder of diameter 3. the alien can see you because of these 3 voxels: the alien's line of sight has to travel through say, 320 voxels to spot you, 17 of which are smoke, your soldier has the same 320 length line, but because his is starting from inside the smoke, it has to go through 20 voxels filled with smoke, hence the difference.

But wait, 31, 20 is closer to the Floater than 32, 20, so the path should be shorter. Why would the soldier be able to see from 32, 20 but not 31, 20? I suppose there could be some quirk in how the smoke got distributed, since the epicenter was on the other side of the Skyranger and it could have shielded that square better...

If so, then yeah, that explains it. So, this wouldn't be a problem if the smoke cloud was entirely between them, as both of them would go through the same number of smoke and non-smoke voxels, right? And this means you're potentially putting yourself at a disadvantage whenever advancing through smoke cover... so every time you exit the Skyranger for instance.

But from the point of view of the player this is arbitary. There is nothing that can be inferred from the battlescape that says "tactical mistake" about moving to 31, 20 but not 32, 20.

Do you think it could be fixed by simply not including those 3 "inner" voxels in the calculations? Then they'd both be counting a path of 317, of which 17 would be smoke.
« Last Edit: January 30, 2015, 05:07:45 pm by Markus Ramikin »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #3 on: January 30, 2015, 05:08:13 pm »
think of a circle within a square. it's further from the corner than it is from the side. the "mutual surprise" scenario relies on you actually spotting the alien.

Offline Markus Ramikin

  • Captain
  • ***
  • Posts: 83
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #4 on: January 30, 2015, 05:27:49 pm »
"It's further from the corner than it is from the side." is exactly my point. 32, 20 is more the corner than the side and is further from the floater.

Anyway, the only thing that makes this asymmetrical, if I understand your earlier explanation right, is the smoke inside the soldier-cylinder:


Code: [Select]
  Floater                                                Soldier
[   P---]------------------------------#################[###P###]#####
    1   2                                               3   4
P is their point of view cameras.

So the Floater has to trace a line from 1 to 3 to see the soldier, while the soldier has to go from 4 to 2.
1 to 3 contains 3 (inner, clear) + 30 clear voxels and 17 with smoke, so 33 clear + 17 smoke.
4 to 2 contains 3 (inner, smoke) voxels + 17 smoke and 30 clear, so 30 clear + 20 smoke.
Do I have this right?

If you made it so that the 3 inner voxels were always ignored in the calculations, it'd be 2 to 3 for both of them, with a result of 30+17 and guaranteed mutual surprise. What do you think?
« Last Edit: January 30, 2015, 05:40:33 pm by Markus Ramikin »

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #5 on: February 01, 2015, 01:57:47 pm »
You are right, Markus. LoS is not equal for two selected units. Therefore in some rare cases possibly situations like this.

Another issue is a bug in calculations of density of smoke.
https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/TileEngine.cpp#L439
I believe the LoS issue related with the smoke issue in OpenXcom.
Smoke can be from 0 to 15 in each tile.
For instance in OpenXcom no difference between density of smoke 4 and 5, but smoke 6 denser than 5 exactly by 2 times.

How to should be: https://github.com/Yankes/OpenXcom/blob/master/src/Battlescape/TileEngine.cpp#L445

Try to use OpenXcom Extended. In this build at least the bug of smoke was fixed long time ago.
https://www.openxcom.com/mod/openxcom-extended

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #6 on: February 01, 2015, 03:34:08 pm »
You are right, Markus. LoS is not equal for two selected units. Therefore in some rare cases possibly situations like this.
You forgot to add, that it's totally vanilla. Altering vanilla is not the purpose of OpenXcom.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #7 on: February 01, 2015, 04:08:29 pm »
I not forgot. I didn't knew, vanilla it or not.
I know, different LoS between two units it's by design.

I know, this situation will be in rare cases, but this three point must be:
1. must be a smoke.
2. the smoke must be different in different tiles.
3. two units should stay near diagonal line of tiles.
It happened to me in regular OpenXcom.

Then the bug in the smoke calculation leads to completely different evaluation of distance for different LoS.
For instance, one LoS can contain a bit more voxels with smoke 5 than second LoS. But second los can contain a bit more voxels with smoke 6 than first Los.
In regular OpenXcom the result will be very different, but in OpenXcom Extended this difference is extremely insignificant.

Offline Markus Ramikin

  • Captain
  • ***
  • Posts: 83
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #8 on: February 11, 2017, 11:11:50 am »
You forgot to add, that it's totally vanilla. Altering vanilla is not the purpose of OpenXcom.
By that logic, you wouldn't have aliens facing away from the Skyranger in vanilla, but not in openxcom. Or salary payments for soldiers in transit. Or melee reaction-fire. Or, y'know, any other of the many common sense improvements that openxcom introduced.

Equal LOS would make a wonderful example of such a common sense improvement. Consistent mutual surprise makes sense and feels fair.
« Last Edit: February 11, 2017, 11:15:12 am by Markus Ramikin »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8595
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #9 on: February 11, 2017, 11:48:28 am »
By that logic, you wouldn't have aliens facing away from the Skyranger in vanilla, but not in openxcom. Or salary payments for soldiers in transit. Or melee reaction-fire. Or, y'know, any other of the many common sense improvements that openxcom introduced.

Equal LOS would make a wonderful example of such a common sense improvement. Consistent mutual surprise makes sense and feels fair.

I'm not disagreeing completely, just want to add that:
1. aliens do face away from skyranger in openxcom too... 20% - 100% of them, depending on difficulty... if you play on beginner for example (as you would in original xcom, because of difficulty bug), you wouldn't notice any difference
2. as far as I know, melee attacks don't trigger reaction-fire in openxcom

Offline Countdown

  • Colonel
  • ****
  • Posts: 246
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #10 on: February 11, 2017, 12:52:20 pm »
2. as far as I know, melee attacks don't trigger reaction-fire in openxcom
I think he means melee attacks that behave as reaction fire. For example, walking up to a Chryssalid to say hi and having it slash you in the face. This wasn't in the original game, but added in OXC. A very nice improvement IMO.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #11 on: February 11, 2017, 11:37:59 pm »
melee attacks CAN provoke a reaction, but there are a few caveats attached to it. for example, if attacking from behind, the SECOND attack will run the risk of provoking a reaction attack.

DIFFERENCE TO THE ORIGINAL:
vanilla would only keep track of the last unit to hit someone when determining if it should then spin around to react. openxcom stores a list of all units that have hit the subject in that turn for this determination.

WHAT THIS MEANS:
you can no longer place two soldiers behind an enemy unit and take turns hitting him in the back to avoid reaction fire.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8595
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #12 on: February 12, 2017, 12:31:19 am »
I really really want to believe you Warboy -- you're the one who wrote it, duh! -- but I've been testing it for the last 30 minutes and I can't make melee attacks provoke reaction fire... what am I ding wrong??

Quote
[23:00] <Meridian> hi all, ping Warboy
[23:02] <Meridian> so I am trying this melee-attack-induced reaction shot for the last 15 minutes, but I can't make it work... what am I doing wrong?
[23:02] <Meridian> I have vanilla, with combat knife mod (accuracy increased to 500%) and plasma weapons damage decreased to 15, so they don't kill me
[23:03] <Meridian> I am next to a muton
[23:03] <Meridian> if I fly in front of him, he reacts and shoots me
[23:03] <Meridian> if I fly from side or back and start killing him with knife
[23:04] <Meridian> he won't react even after 4th hit
[23:04] <Meridian> and eventually dies to 4th-5th hit
[23:11] <nadir> I think melee attacks don't draw reaction fire.
[23:13] <Meridian> well warboy says they do: https://openxcom.org/forum/index.php/topic,3315.msg78977.html#msg78977
[23:13] <Meridian> and I know I should not oppose warboy, but I've tried everything I can think of, and they don't react
[23:13] <Meridian> nor have I ever seen it, ever
[23:14] <nadir> Hm.
« Last Edit: February 15, 2017, 01:54:17 pm by Meridian »

Offline Yankes

  • Commander
  • *****
  • Posts: 3192
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #13 on: February 12, 2017, 01:23:31 am »
Isn't melee reaction disabled? I have option in OXCE to enable it.
https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/MeleeAttackBState.cpp#L170

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Unequal LOS - what's going on here?
« Reply #14 on: February 12, 2017, 02:07:06 am »
my mistake, i misremembered. the melee attack itself adds the attacker to the defender's shit-list, so any action that might trigger a reaction the attacker takes AFTER the fact will cause the alien to spin around, but the melee attack itself won't provoke a reaction.

for more information: https://www.ufopaedia.org/index.php/Reaction_fire_triggers
the section under "using a melee weapon" only instead of shifting focus, the defender remembers everyone that attacked him.

also, "i should not oppose warboy" is the wrong attitude. i'm fallible, and challenging me on points like this will only make me go and double check my sources to find the ultimate truth of the matter. this is a GOOD thing.
« Last Edit: February 12, 2017, 06:16:07 am by Warboy1982 »