Author Topic: Should the AI consider enemy range and partial cover?  (Read 10148 times)

Offline Countdown

  • Colonel
  • ****
  • Posts: 246
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #15 on: January 31, 2020, 09:57:05 pm »
That's not vanilla AI.
I have made the same argument for melee dodge (oxce-only feature)... the AI should not know how good a soldier is at dodging, it's cheating.
Just asking out of curiosity, then why not remove it? Is this a difference of opinion with Yankes or too difficult for another reason?

Offline Yankes

  • Commander
  • *****
  • Posts: 3207
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #16 on: January 31, 2020, 10:14:46 pm »
"We" didn't do it... I would definitely not add such a feature, it was added (probably) by Yankes when OXCE and OXCE+ were still separate forks (or maybe even before OXCE+ even existed).
This my code, this was added prevent alines from doing stupid things. Player can know after couple of tries that attacking some unit from front is not effective, but aliens do not remember this (and even if remember they can't carry this knowledge between missions).
I agree we should keep behaviors like this to minimum, but in some corner cases we could help a bit AI do not have big disadvantage.
Another place where AI use behavior like this is psi attacks.

As always, question is how much "a bit" is.
One way this both cases could be fixed is count numbers of attack on unit, each time AI have better "knowledge" and can use more units stats to plan next move.
But current TU would not be accessible because you can't determine it without seeing unit movements on previous turn (and this could be only way to know it).

Offline Bobit

  • Colonel
  • ****
  • Posts: 186
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #17 on: January 31, 2020, 10:36:13 pm »
1/ AI doesn't know how much TUs your units have and how far can they go... knowing it (without mind probe) would be cheating

Fair enough, they could make a reasonable assumption by taking (minTU+maxTU)/2 using the stats for the class. But overall I don't think it would be a huge impact.

2a/ aliens can't "hulldown"

Everyone can hulldown on hills by walking to the spot where they can just barely peek over the hill to shoot at an enemy. Even tanks, which cannot crouch. That is why it is called hulldown. This is VERY effective cover, in a good position maybe 40% of shots hit the hill. I would like to be able to teleport enemies in debug mode to test exactly how effective this is though, any way to do that?

Probably the most reasonable counterargument to adding this is that even with the current code the AI is still more likely to enter a "hulldown" position with the rational that some of the enemies are totally obstructed, which is better than no enemies being obstructed.

2b/ "light cover" is (for practical purposes) no cover in xcom

Correct, except as outlined by 2a above. But I could implement it by making spread non-binary. Doing that would be an easy way to allow modders to add balance light cover, which I see as a huge improvement. However it's pointless if the AI doesn't understand it, hence one of the motivations for this thread.

Instead of adding spread, it could also take a less "realistic" approach like XCOM2 where shooting through a space with cover (even if not hitting the cover) gives a flat accuracy reduction. But that's somewhat besides the point.
« Last Edit: January 31, 2020, 10:38:27 pm by Bobit »

Offline Rubber Cannonball

  • Colonel
  • ****
  • Posts: 195
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #18 on: January 31, 2020, 10:46:31 pm »
I would like to be able to teleport enemies in debug mode to test exactly how effective this is though, any way to do that?

try ctrl w to "warp" the selected unit to the cursor position in debug mode.

Offline Bobit

  • Colonel
  • ****
  • Posts: 186
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #19 on: January 31, 2020, 10:52:39 pm »
try ctrl w to "warp" the selected unit to the cursor position in debug mode.

How do I select an enemy?

Offline Rubber Cannonball

  • Colonel
  • ****
  • Posts: 195
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #20 on: January 31, 2020, 10:58:52 pm »
You should be able to do it after the enemy moves on the enemy turn while debug mode is active (ctrl -d to activate) and before pressing the end turn button.  Going into the units inventory will also refill its TUs so you should also be able to move and position it how you want.

Edit:
Actually going into one enemy units inventory will refill all the enemy units' TUs.  And to clarify, just wait until the enemy units stop moving before trying to move one.
« Last Edit: January 31, 2020, 11:31:47 pm by Rubber Cannonball »

Offline Bobit

  • Colonel
  • ****
  • Posts: 186
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #21 on: January 31, 2020, 11:10:44 pm »
That's very difficult with the constantly recentering camera. Still I'll keep trying and let you know if I succeed.

Offline Bobit

  • Colonel
  • ****
  • Posts: 186
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #22 on: January 31, 2020, 11:25:50 pm »
Alright alright, I've done more testing and it's pretty darn negligible  ::)

I'm will try to fork and add modding capabilities for:

  • "Unrealistic" XCOM2 style multiplicative accuracy reduction penalties when firing against an enemy who's right next to cover facing firer's direction and AI accounting for it.
  • AI knowing that the unit panicked and so is not a threat.

Is forking OXCE to add modding capabilities common practice? People do it for event hooks.

I do think it's reasonable that the AI should know the player panicked, because it's pretty easy to tell even without the screen. But sure it should be a mod feature.
« Last Edit: January 31, 2020, 11:32:12 pm by Bobit »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8616
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #23 on: January 31, 2020, 11:37:52 pm »
Just asking out of curiosity, then why not remove it? Is this a difference of opinion with Yankes or too difficult for another reason?

Because:
1/ one oxce dev reverting the work of another oxce dev would just be childish and stupid
2/ Yankes has given convincing arguments to justify it
3/ unless you read the code, you'll never be able to find out that it even exists
4/ my playtests didn't show any increase in AI ability to kill me, so I consider it a "harmless cheat"

Besides, if I removed all features I don't like, I would remove 30% of oxc code, 30% of oxce code not made by me and probably even 30% of oxce code made by me... but I do respect other people's work, opinions and tastes... and life is full of compromises (alternative is a pretty miserable life).

Offline Rubber Cannonball

  • Colonel
  • ****
  • Posts: 195
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #24 on: February 01, 2020, 12:28:34 am »
As for cheating AI,  I find the whole spotter sniper mechanic in OXCE more "cheaty" than the ai knowing xcom units' stats or their equipment stats.  For instance, even one shot killing a spotter from behind will make the shooting unit visible to at least the AI sniper units for several turns (depends on ruleset)  It doesn't matter if the shooter hides in a cave under a hill for a turn or two.  Even if he pops out the other side of the hill, the ai snipers can still target him if line of fire available or if they can throw a grenade at his tile.  Camo armor or even invis armor doesn't help.  Worse, he can be targeted even behind a thin wall so long as the wall is in the same tile as he is.

If the alien squad carries a mind probe,  I think it would be ok for ai to know the xcom stats without having the complication of coding in explicit mind probe usage.  This simplification is a bit cheaty, but most of the time the ai won't benefit much from this information anyways.  Alien intelligence should be a factor here.

My understanding of TU is that is a game abstraction of speed or quickness and to a lesser extent efficiency or even proficiency.  Just seeing an xcom unit run a few squares should be enough for an intelligent alien to be able to guesstimate how quick that unit is and how much distance that unit can cover in a turn.  A turn is another game abstraction of a time interval.  The aliens may know quite a bit of information about human capabilities from all those abduction missions they run anyways.

Offline Bobit

  • Colonel
  • ****
  • Posts: 186
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #25 on: February 01, 2020, 12:55:08 am »
100% sniper-spotter AI is exactly what the player gets. Yes it's absurd, and that's why megamods heavily nerf firing on enemies you can't see, which allows sniper AIs to actually help their ally without being OP. The most cheaty thing the AI does is "intelligence" where it automatically knows where you are a few turns after spotting you.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1931
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #26 on: February 01, 2020, 01:16:09 am »
As for cheating AI,  I find the whole spotter sniper mechanic in OXCE more "cheaty" than the ai knowing xcom units' stats or their equipment stats.  For instance, even one shot killing a spotter from behind will make the shooting unit visible to at least the AI sniper units for several turns (depends on ruleset)  It doesn't matter if the shooter hides in a cave under a hill for a turn or two.

This is a "vanilla" AI cheat that is exacerbated by he sniper code when it's overtuned in a mod. If you shoot an alien in the original game the soldier that did the shooting is now "known" to the AI, and any aliens are free to psi spam and blaster bomb them until more turns than the aliens' intelligence have passed without re-spotting.

The intended use is that it's supposed to emulate the same kind of smoke- and squadsight-sniping the player does. I'd argue the only "correct" value the spotter parameter is 1, and the mod should have some penalty to shooting with no LoS. This means the AI will try to snipe at units that they scout during their turn and may try to guess/take out the cover of units they spotted during your turn right before theirs. A more complicated system could be developed for what counts as spotted, but I don't think it will make much of a difference when using a spotter value of 1. I left the option to define other values for spotter in case there are modders who particularly hate their players.

Personally I think a non-cheating AI is harder to make good than giving a few choice smaller cheats that approximate tactics a human player can employ. In order to have a challenging AI that has perfectly symmetrical information to the player, you're going to have to model human decision-making at a level that would take a very long time to code that wouldn't be worth the little extra benefit you get from knowing the AI "isn't cheating".

Offline kevL

  • Colonel
  • ****
  • Posts: 471
  • pitchforks and torches
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #27 on: February 01, 2020, 02:03:21 am »
Personally I think a non-cheating AI is harder to make good than giving a few choice smaller cheats that approximate tactics a human player can employ. In order to have a challenging AI that has perfectly symmetrical information to the player, you're going to have to model human decision-making at a level that would take a very long time to code that wouldn't be worth the little extra benefit you get from knowing the AI "isn't cheating".

having done (unpaid) game development, including AI, for the last 10 yrs. I agree 110%

else hand over $100,000 ... for a non-cheating AI worth any salt.

Offline Rubber Cannonball

  • Colonel
  • ****
  • Posts: 195
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #28 on: February 01, 2020, 03:00:56 am »
100% sniper-spotter AI is exactly what the player gets.

I'm pretty sure this is not what the player gets.  If an alien moves out of visual range on the alien turn, the player doesn't automatically see him on the players turn.  Squad sight is what the player gets.  I don't think squad sight is implemented for the alien ai.  I think it wouldn't be cheaty at all if the aliens had access to squad sight limited to their current turn.  It should be selectable in the ruleset by mission type, faction type and/or other suitable means to give modders flexibility.

Edit:  In fact the player doesn't even get to spot the alien that shot him if it isn't in any of his units' line of sight (LoS).
« Last Edit: February 01, 2020, 03:11:18 am by Rubber Cannonball »

Offline Bobit

  • Colonel
  • ****
  • Posts: 186
    • View Profile
Re: Should the AI consider enemy range and partial cover?
« Reply #29 on: February 01, 2020, 06:21:59 am »
Hm, I forgot that high spotter has an effect similar to intelligence. I would still hold that spotter = 1 is what the player gets though.

Letting AI shoot the enemy who shot them is bad, but because spotting is binary, the only alternative is to not let the AI know they were hit at all.