aliens

Author Topic: [DONE][Suggestion] Sniper spotting is now different than vanilla spotting  (Read 5503 times)

Offline Jaedar

  • Sergeant
  • **
  • Posts: 17
    • View Profile
Currently when spotters are hit, they spot the unit that fired on them. This behavior is not fun to me and it also feels a bit like telepathy when something goes down from a single shot in the back of the head from a hidden unit on the other side of the map, and suddenly every enemy snipers knows exactly where the shot came from.

I would like an option somewhere to disable this part of spotter behavior, so that spotters would only spot units they actually see.

I'm not a c++ coder so I might be way off base, but it looks like it could be a fairly small change in the ProjectileFlyBState::projectileHitUnit method, plus whatever scaffolding is needed to add a new option.

Offline Tamren

  • Captain
  • ***
  • Posts: 92
    • View Profile
Re: [Suggestion] Option to disable spotters spotting when hit
« Reply #1 on: October 25, 2024, 05:46:24 pm »
Yeah that also bothered me due to how unrealistic it is. I think there could be multiple optional rules:

1. Spotters can only spot things they can see, so spotters are much more dangerous in daylight hours and can be countered by camo, smoke, indirect attacks and darkness.
2. Units with broken morale on the enemy turn or morale reduced to zero on the player's turn lose all of their spotting abilities (if they don't already).
3. Spotters that are killed or knocked unconscious by a single powerful hit cannot spot for allies regardless of any other factor.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9534
    • View Profile
Re: [Suggestion] Option to disable spotters spotting when hit
« Reply #2 on: October 25, 2024, 06:14:13 pm »
...when something goes down from a single shot in the back of the head from a hidden unit on the other side of the map, and suddenly every enemy snipers knows exactly where the shot came from.

3. Spotters that are killed or knocked unconscious by a single powerful hit cannot spot for allies regardless of any other factor.

This case I am willing to implement (as a mod option, not user option).

The rest not.

Offline psavola

  • Commander
  • *****
  • Posts: 961
    • View Profile
Re: [Suggestion] Option to disable spotters spotting when hit
« Reply #3 on: October 25, 2024, 07:35:10 pm »
For what it's worth, I kind of like the idea of dividing the spotter/sniper AI logic into three different categories of realism (instead of just two that Meridian was willing to consider):

1) the spotter has to be able to see the shooter in order to be able to spot it and direct snipers at the unit. Somewhat equivalent to yelling, "hey I was shot by that guy over that rock, direct your fire over there!".
2) the spotter cannot spot if it's instantly killed or knocked unconscious (the suggestion above). If you only score a non-fatal hit, somewhat equivalent to yelling "hey I was shot to my side from the direction of that big rock, direct your fire over there!"
3) the current spotter/sniper logic, which has no limitations whatsoever.

Of course, seeking equivalences and realism does not actually work if the mod uses "spotter" integer greater than 1, because in that case the hits will be remembered and the location is magically known a number of turns since the hit occurred (and the unit has likely already moved away). Also even with spotter=1 the unit might have moved (usually only a little bit) after shooting. So perhaps trying to achieve or improve realism might be a moot point.

Offline Jaedar

  • Sergeant
  • **
  • Posts: 17
    • View Profile
Re: [Suggestion] Option to disable spotters spotting when hit
« Reply #4 on: October 25, 2024, 07:43:56 pm »
1) the spotter has to be able to see the shooter in order to be able to spot it and direct snipers at the unit. Somewhat equivalent to yelling, "hey I was shot by that guy over that rock, direct your fire over there!".
3) the current spotter/sniper logic, which has no limitations whatsoever.
Aren't these two the same, since spotters in current logic will spot anything they see, so also spotting something they see and got shot by adds nothing?

This case I am willing to implement (as a mod option, not user option).

The rest not.
I will accept what I can get with gratitude (I think I can customize mods once I've downloaded them), even if I would prefer the ability to disable "spot when shot" entirely and not just when instant-killed.  Thanks.

Offline psavola

  • Commander
  • *****
  • Posts: 961
    • View Profile
Re: [Suggestion] Option to disable spotters spotting when hit
« Reply #5 on: October 25, 2024, 08:48:01 pm »
Aren't these two the same, since spotters in current logic will spot anything they see, so also spotting something they see and got shot by adds nothing?

No, they are not the same. Currently the spotter does not need to see the shooter hitting it to flag the shooter for the snipers. That is, shooting out of the dark or from the cover of smoke or outside the vision range of the target unit also gets you spotted. With this kind of option (which Meridian seemed not willing to implement) the sniper/spotter logic would be closer to vanilla AI - but not quite, if the spotter has visibility.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11930
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Suggestion] Option to disable spotters spotting when hit
« Reply #6 on: October 26, 2024, 04:01:13 pm »
EDIT: Several posts above and below were deleted.

You know what, I changed my mind.

I will not implement even the one-shot exception in standard AI unit spotting... unless I am asked by actual modders (https://openxcom.org/forum/index.php?topic=11631.0).

If you don't like how the OXCE sniping feature (as implemented by ohartenstein23) works, turn it off.

I would like to provide my feedback, but frankly there are too many concepts here. I would appreciate a list of questions to address.
I understand this is shifting work from me to the OXCE dev team, but I can't think of a better solution, sorry.

Anyway, what I can tell right now is that I also dislike insta-killed spotters warning their comrades. I feel it goes against the narrative of this feature.
« Last Edit: April 17, 2025, 08:42:56 am by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9534
    • View Profile
Re: [Suggestion] Option to disable spotters spotting when hit
« Reply #7 on: November 03, 2024, 11:38:53 pm »
I have deleted several posts above (including mine) explaining the vanilla spotting mechanics and the (lack of) differences compared to the sniper-spotting mechanics.
I am not going to change the vanilla spotting mechanics, not even when asked by modders.
Chapter closed.
(Let's not go offtopic again and focus on sniper-spotting only.)

That leaves us with only one option... make the sniper-spotting mechanics different from the vanilla spotting mechanics.
I didn't want to do that either, but with modding interest, I shall reconsider.
I'll talk to Solarius about the details via some instant messenger and summarize here afterwards.

How about exposing getTurnsLeftSpottedForSnipers and setTurnsLeftSpottedForSnipers in Y-scripts the same way getTurnsSinceSpotted and setTurnsSinceSpotted are instead? I already have an idea of a sample script that could handle this "issue", but it's currently not possible without these operations.

We can do that regardless of this discussion.
I'll extract this into a separate task later.

Edit: Done.

https://github.com/MeridianOXC/OpenXcom/commit/56879e79a4ca1d41e9bd67a8027556e402a6798c
« Last Edit: January 18, 2025, 11:29:33 am by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9534
    • View Profile
That leaves us with only one option... make the sniper-spotting mechanics different from the vanilla spotting mechanics.
I didn't want to do that either, but with modding interest, I shall reconsider.

Done.

https://github.com/MeridianOXC/OpenXcom/commit/30edd6100cc079069c89f6d72ca7f35b8bcf033a

Code: [Select]
constants:
  extendedSpotOnHitForSniping: 1

Possible options:
0 = no spotting on hit (this is the new default)
1 = spotting only if the hit unit doesn't die or fall unconscious
2 = always spotting on hit (this was the original default)

Offline psavola

  • Commander
  • *****
  • Posts: 961
    • View Profile
Given that XCF github snapshot has already adopted behavior 1, two questions for clarification on option 1:

1) If you auto-shoot a target which dies of multiple hits. For example: you shoot with a gun with three autoshots. Autoshot projectile 1 hits the target, which is not knocked out or killed, autoshot projectile 2 misses but 3 hits and the target is killed. Will the unit auto-shotting be marked for snipers?

I guess there would be some logic in either answer but I suppose I'd expect the autoshotter being marked for snipers. Someone might disagree especially for some autoshot weapons such as machine guns. But the key point I think would be that it would be clear how this would behave.

2) You shotgun someone. Technically at least from CTRL-H perspective this is implemented as multiple hits. Some shotgun pellets hit, but the first hitting one does not kill the target, yet their combination does. Is the shotgunner marked for snipers?

I think the specifics of shotgun would require that this is treated as instakill and the shotgunner would not be marked for snipers.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9534
    • View Profile
Re: [DONE][Suggestion] Sniper spotting is now different than vanilla spotting
« Reply #10 on: January 21, 2025, 08:42:51 pm »
In OXCE 8.0.5

1) yes 2) yes

Starting from OXCE 8.0.6

1) no 2) no

EDIT: Starting from OXCE 8.2.1 - https://openxcom.org/forum/index.php?topic=6586.msg171202#msg171202

1) yes 2) yes
« Last Edit: April 17, 2025, 08:45:03 am by Meridian »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11930
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Sniper spotting is now different than vanilla spotting
« Reply #11 on: January 22, 2025, 10:08:07 pm »
Regarding shotguns: from the player's perspective, it shouldn't matter which bullet was first, since they're supposed to be simultaneous. The only reason we're talking about the "first" pellet is purely technical: because that's how the engine works. But it should not be in any way accessible or visible to the player, if it can be avoided. Therefore, I am convinced that a spotter should not announce who their killer was, regardless of which pellet was first and which pellet killed them.
Regarding autoshots: this is not as clear cut, since I can picture a scenario where the hit spotter gives a short yell in the middle of an autoshot before being downed (dark as it is). But for simplicity and cohesion I think the game should also prevent a spotter from warning the others, same as with shotgun pellets.
I realize that this approach has its pros and cons (like making the AI a bit less effective), but after weighing them I've decided that this is what looks the most logical to me.

Offline CrazedHarpooner

  • Colonel
  • ****
  • Posts: 191
    • View Profile
Re: [DONE][Suggestion] Sniper spotting is now different than vanilla spotting
« Reply #12 on: January 23, 2025, 12:32:33 am »
Multiple projectile shots will have unique issues. Not just the 1st projectile (pellet) not downing a target but a later one in the same shot, you also have the cases where multiple scouting targets get hit with some dying and others not, now you have to put in place the logic to track each unit hit in that shot and then see if any remain standing to mark the shooter. Another case that has not been considered is stray shots hitting another target that's not even in sight, imagine having a sniper of your own on one side of the map try to take out a potential scout, missing yet hitting another taget on the opposite side of the map that is also a scout, should your sniper be revealed due to this? With option 1 it'll be yes if they don't go down and with 2 it'll happen regardless of outcome.

My original script idea is now deprecated with this implementation, however, I think I might be able to repurpose some of it to work in tandem with option 1, allowing to conceptually have multishot actions that take out a target prevent the sniper mark. Still, as I've said earlier, handling multiple hit targets to determine if the mark stays or not won't be easy via scripts. On the other hand, this implementation now opens up the possibility of "suppressed" weapons that would work as if option 0 was active while either of the other 2 options are in use for other weapons. Not only that, but also the option of using weapons with tracer rounds for the enemies / aliens that will mark the target hit as scouted for snipers without having to use actual scouting units.

Offline hellrazor

  • Commander
  • *****
  • Posts: 2066
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: [DONE][Suggestion] Sniper spotting is now different than vanilla spotting
« Reply #13 on: January 24, 2025, 04:57:13 pm »
Regarding shotguns: from the player's perspective, it shouldn't matter which bullet was first, since they're supposed to be simultaneous. The only reason we're talking about the "first" pellet is purely technical: because that's how the engine works. But it should not be in any way accessible or visible to the player, if it can be avoided. Therefore, I am convinced that a spotter should not announce who their killer was, regardless of which pellet was first and which pellet killed them.
Regarding autoshots: this is not as clear cut, since I can picture a scenario where the hit spotter gives a short yell in the middle of an autoshot before being downed (dark as it is). But for simplicity and cohesion I think the game should also prevent a spotter from warning the others, same as with shotgun pellets.
I realize that this approach has its pros and cons (like making the AI a bit less effective), but after weighing them I've decided that this is what looks the most logical to me.

That sounds totally logical. I would also like to this approach somehow implemented thanks :)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9534
    • View Profile
« Last Edit: April 21, 2025, 10:46:48 am by Meridian »