OpenXcom Forum

OpenXcom => Troubleshooting => Topic started by: Markus Ramikin on January 30, 2015, 11:14:15 am

Title: Unequal LOS - what's going on here?
Post by: Markus Ramikin 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Warboy1982 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Markus Ramikin 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Warboy1982 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Markus Ramikin 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?
Title: Re: Unequal LOS - what's going on here?
Post by: redv 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
Title: Re: Unequal LOS - what's going on here?
Post by: volutar 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.
Title: Re: Unequal LOS - what's going on here?
Post by: redv 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Markus Ramikin 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Meridian 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
Title: Re: Unequal LOS - what's going on here?
Post by: Countdown 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Warboy1982 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Meridian 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Yankes 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
Title: Re: Unequal LOS - what's going on here?
Post by: Warboy1982 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.
Title: Re: Unequal LOS - what's going on here?
Post by: Hobbes on February 14, 2017, 06:55:03 pm
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.

Amen to that :)
Title: Re: Unequal LOS - what's going on here?
Post by: Markus Ramikin on February 15, 2017, 01:52:16 pm
Ah, sorry for being unclear, I mean reaction fire by melee units. Like, I'm running past a silacoid and it hits me. I don't remember it ever happening in the original.

Come to think of it, it's listed as a difference (https://www.ufopaedia.org/index.php/Differences_to_X-COM_(OpenXcom)).
Title: Re: Unequal LOS - what's going on here?
Post by: The Reaver of Darkness on July 28, 2017, 04:27:18 am
I tested with the attached save file. The soldier cannot see the floater from 31,20 but can see it from other coordinates:

29,20: can see
30,20: can see
31,20: cannot see
32,20: can see
33,20: can see
Title: Re: Unequal LOS - what's going on here?
Post by: Markus Ramikin on February 28, 2021, 11:43:42 pm
Came back to the game after a few years and I see this problem still exists.

Warboy, last time this conversation got distracted by discussing melee reaction attacks, but have you given any thought to actually fixing asymmetrical LOS/mutual surprise failure in openxcom?

As to whoever said altering vanilla is not the purpose of openxcom, what can I say but:
Quote
Code: [Select]
  - type: STR_DYE_GRENADE
   [...]
   # Applying Zombie's patch here, because I happen to agree with him.
    power: 60
Some things are just good sense. (EDIT: although, to be honest, I did wonder why this one wasn't one of the Advanced options/built in mods, like "Improved Gauss" and such.)