Author Topic: For AI-"improvements", should I add a new option or use the existing "sneakyAI"?  (Read 13329 times)

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
More intelligent aliens could be a really interesting challenge.

-Picking up weapons if they have none (after dropping it due to a berserk for example)
The code for it already existed. But when I tried it, it didn't work. But that's not the code's fault. I tried to debug it and followed it back to right where the variable is checked. It somehow was false despite me having anabled it. I think the reason could be that it only works after starting a new mission, which wasn't helpful for comparative testing. With my AI it is now made sure to always use that code.

-Making mind controlled xcom suicide with grenades or other explosive weapons
Yes, they'll do that. In some of my tests they controlled 4 X-Com-soldies in the sky-ranger and they all threw nades at each other. I would think they already did this before. My grenade-throwing code doesn't count the throwing unit as 4 times more valuable as the other targets anymore. It probably shouldn't consider itself as more valuable anymore at all, when it's not it's original faction. Actually... Let me change that right away. So it'll become the realization of first user-feedback!

Code: [Select]
if (_unit->getFaction() == _unit->getOriginalFaction())
enemiesAffected -= 2;
else
enemiesAffected++;

-Making mind controlled xcom throw away their weapons sometimes
Not sure that's too useful. But could be an idea if there's absolutely noone else around to shoot at. I'll keep it in mind.

-Also stoked about ideas already mentioned about using medkit, and scouts/snipers, etc. Maybe "medic" aliens can finally actually be medics :D
Do they have any items or abilities for that to work? I'd need a mod where they have that ability for testing.

-Using medkits to wake up stunned aliens
Same as above. They normally don't have them, do they?

Offline Vakrug

  • Colonel
  • ****
  • Posts: 320
    • View Profile
Oh, oh! How could I forgot? I know one very "sneaky" improvement for AI! How about calculating player's actions during his turn and, if it looks like a player just sit there and do nothing (that as waiting for AI to kill himself as usual), then AI responds during his turn by also doing nothing! I think this will punish players for using "just press end turn button to win" tactics.

Offline Cooper

  • Colonel
  • ****
  • Posts: 150
  • Chryssalids are awesome
    • View Profile
-Picking up weapons if they have none (after dropping it due to a berserk for example)
With my AI it is now made sure to always use that code.
Looking forward to hopefully try this!

Yes, they'll do that. In some of my tests they controlled 4 X-Com-soldies in the sky-ranger and they all threw nades at each other. I would think they already did this before. My grenade-throwing code doesn't count the throwing unit as 4 times more valuable as the other targets anymore. It probably shouldn't consider itself as more valuable anymore at all, when it's not it's original faction. Actually... Let me change that right away. So it'll become the realization of first user-feedback!
I like the change!
Also what I was thinking is if they mind control one xcom soldier who is alone, that this soldier could prime a grenade and drop it, to suicide.

-Making mind controlled xcom throw away their weapons sometimes
Not sure that's too useful. But could be an idea if there's absolutely noone else around to shoot at. I'll keep it in mind.
Yeah should not be the highest priority. But sometimes if the soldier is alone for example it could give some nice variation.

-Also stoked about ideas already mentioned about using medkit, and scouts/snipers, etc. Maybe "medic" aliens can finally actually be medics :D
Do they have any items or abilities for that to work? I'd need a mod where they have that ability for testing.
No alien medkits exist, at least not in the vanilla game. So I guess you would need a normal mod for that.

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Oh, oh! How could I forgot? I know one very "sneaky" improvement for AI! How about calculating player's actions during his turn and, if it looks like a player just sit there and do nothing (that as waiting for AI to kill himself as usual), then AI responds during his turn by also doing nothing! I think this will punish players for using "just press end turn button to win" tactics.
That would be very easy to implement but I'm really not convinced that inactivity is the best play.
There's still the important question how much "cheating", as in knowing things the player can't know is okay?

I removed some big cheats and while without them the AI plays worse, I think those were too drastical.

I'm also having a bit of a problem. After 20 turns the aliens get "maphack". This maphack is happening at a place where the aliens also have their regular "memory". It's just that the regular memory gets overwritten. I don't like this inconsistency of suddenly starting to cheat at a specific turn.

Offline Vakrug

  • Colonel
  • ****
  • Posts: 320
    • View Profile
There's still the important question how much "cheating", as in knowing things the player can't know is okay?
This can be addressed with a message during "now it is alien turn" screen like with "reinforcements are coming". The message can be something like "aliens are suspicious with X-COM inactivity, so the decide to wait".

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
I wrote a "quickLineOfFire"-Method, which compared to "canTargetUnit" has a small chance for false negatives. (failing to realize that a unit could be hit from somewhere)
However, by rough estimates it's about 1000 times faster.
In combination with the also way faster path-finding this allows to analyze every tile on the map for both walking-distance and ability to shoot something from there.

So now the foundation for good AI is actually laid. :)

Screenshot shows how many X-Com-soldiers could be targeted from each tile.

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
I'm thinking of having 3 or maybe even 4 different difficulty-settings for this AI.

1. No cheating at all
2. Limited cheating like the basic-AI does it (knows where units it has seen before are for a few turns depending on alien-intelligence, knows all unit-positions after turn 20)
3. Extended cheating (knows all unit-positions from the start but needs vision to shoot them, this is what the current public test-version does)
4. Full cheating including being able to shoot at targets without vision

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Note to self, so I don't forget:

Anti-smoke-grenade behavior: If you think you should have a line of sight based on distance but you don't, then it's probably because of smoke or visibility-modding. In this scenario you can fall back to the behavior of just getting closer to the target. In this case you can even skip all the tile-evaluation to make it faster.

Be more consistent with the "siege"-behavior. When in "siege-mode" but you could get into shooting-distance, make it dependent on whether you'd get reaction-fire. (or at least try that and if it makes the AI too passive discard it again)