OpenXcom Forum
OpenXcom Forks => OXCE Bugs => OpenXcom Extended (OXCE) => OXCE Bugs FIXED => Topic started by: Xilmi on February 11, 2023, 12:39:58 am
-
Hi!
This wednesday I was testing Brutal-AI together with a streamer who is an avid TFTD-player.
He immediately pointed out something wrong with being able to look through the walls of the Triton.
I think you can see terrain through it but not enemies.
I wasn't sure because it was something that was my fault (I did mess around a bit with TileEngine). But now I tested it. And the same bug is present in OXCE 7.8.5 too.
OXC, however doesn't have this bug.
See the reference screenshots.
To reproduce just turn around one of the soldiers at the NE and the NW-walls to face the wall. Happens 100% of the time in OXCE and my OXCE-fork.
I wanted to look at the difference in calculateLineTile between OXC and OXCE to see a potential reason. But OXC doesn't even have a calculateLineTile function and thus must do this stuff in a completely different way. :o
Attached are screenshots with (OXCE) and without (OXC) the bug.
-
When I comment this code, it works.
Can you explain what this is for? It almost looks like it was deliberately put there to provoke precisely the kind of bug I've reported here. I read it as: "If you are less than 2 steps away from a wall ignore the wall for the purpose of whether your line of tile-vision is blocked by it."
-
Most of this code is black magic, multiple of corner cases to handle, and its look like fix in one place break some thing elsewhere.
I will look on this but I dount if I could give answer, beside check if original game (not OXC!) had same behavior, if it was then this glitch will probably stay.
(btw DO NOT post code as screenshots this is completely unproductive, post link to github or even copy-paste this sniped)
[ps]
https://github.com/OpenXcom/OpenXcom/blob/master/src/Battlescape/TileEngine.cpp#L1820
Same logic should be in OXC, if I did not make error in refactor both should give same answer.
-
beside check if original game (not OXC!) had same behavior, if it was then this glitch will probably stay.
I just did that. In the OG TFTD you can't look through the Triton-wall either.
And there's something else you can't do: Climb on the Triton with your soldiers. This is possible in both OXC and OXCE but not the original game. There you can only step on the lower part of the wing. But not on the higher one or the roof.
https://github.com/OpenXcom/OpenXcom/blob/master/src/Battlescape/TileEngine.cpp#L1820
Same logic should be in OXC, if I did not make error in refactor both should give same answer.
I can't see the same logic there. This code looks completely different from calculateLineTile and I cannot recognize what in that code is supposed to be the equivalent for "if (steps<2)".
-
It should be same code, but logic is split by function argument:
https://github.com/OpenXcom/OpenXcom/blob/master/src/Battlescape/TileEngine.cpp#L2314
I think I could incorrectly flip condition but probably need dig bit more to see what is wrong with it.
-
Just a small heads up: I've been playing all day with the change I proposed and didn't see any negative side-effect.
-
Just a small heads up: I've been playing all day with the change I proposed and didn't see any negative side-effect.
just an aside: beware diagonal bigwalls (eg. some UFO hull-tiles) because that step<2 *might* be there to prevent blast propagation through them.
eg. with your change, try hitting one with an incendiary ... see if the fire spreads inside the UFO
-
just an aside: beware diagonal bigwalls (eg. some UFO hull-tiles) because that step<2 *might* be there to prevent blast propagation through them.
eg. with your change, try hitting one with an incendiary ... see if the fire spreads inside the UFO
Probably some thing like this, condition we consider here only was used in tile "visibility" but bigwalls had lot of special code in every aspect of engine.
-
The issue started appearing in one of the blue highlighted commits.
Probably the one in red rectangle.
Not appearing: https://lxnt.wtf/oxem/builds//Extended/Extended-6.2-7c85456c1-2019-12-28-win64.7z
Appearing: https://lxnt.wtf/oxem/builds//Extended/Extended-6.2-4b74ab3bf-2019-12-29-win64.7z
-
After digging in code I can confirm that was error on my part, it look like this condition should be removed.
Overall fix will look like:
bool result = getBlockDir(cache, dir, difference.z);
if (result && difference.z == 0 && getBigWallDir(cache, dir))
{
if (point == target)
{
result = false;
}
}
This is probably more accurate what algorithm do and same logic is used in light propagation.
-
Fixed in OXCE 7.8.12
https://github.com/MeridianOXC/OpenXcom/commit/2985a6d1cfc2dfbbd3e7e6bf5a4b64422a10742e