Jump to content

Photo

R&D AI Improvements


  • Please log in to reply
144 replies to this topic

#1
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

I'm starting thread as a follow-on to the "R&D Tactical bugs" thread here : http://forums.nexusm...-skipping-turn/

 

This thread will focus on non-bug related AI improvements that people would like to see.

 

I'll start off with a few things I've seen that could be implemented.

 

1) Aliens use their weapon damage to determine what counts as enemy "low HP"

 

Aliens prioritize their targets based on to-hit chance, vulnerability, and low HP (chance to one-shot) of target. Currently the game uses "HP below 5" as the criteria, which for late game leads to less effective AI decisions. A Muton Elite with a Heavy plasma cannot prioritize a soldier with 5 HP over a soldier with 25 HP, even though the 5 HP is a guaranteed one-shot kill if it hits.

 

 

2) Aliens can evaluate movement options even if overwatched

 

Currently the AI evaulates an OverwatchDangerLevel. If the danger level is 2 or higher (3 or higher on easy) then alien units are completely forbidden from movement. On classic/impossible, any overwatching unit within 90% of sight radius counts as OverwatchDangerLevel 3. This results in players being able to force aliens to not move with a single overwatching unit. Shortening the "close range" would allow aliens to consider movement as an option (weighing its priority against shooting) when there is only a single soldier on overwatch.

 

UPDATE: Trial hex code below

 

UPDATE2: Going to rework this so that the alien factors it's own in-built defenses into the OverwatchDangerLevel, allowing units with high defense or damage reduction to ignore a certain amount of overwatching.

 

3) Enable fleeing aliens to dash

 

Currently aliens are only allowed to dash when making a 'flanking' move. It is possible to allow them dashing move options when performing a 'flee' move.

 

4) Disallow AI from using the WarpTo option under all circumstances (excepting invalid positions)

 

The AI is currently allows to move its units using the WarpTo function instead of the regular pathing/moving option. The code attempts to make this not impact the player by only allowing it when they can't be seen, path isn't visible, etc. However, there are clearly times when it DOES still happen. This change would turn off all instances of WarpTo (except correcting invalid positions) and instead force the AI to use the pathing/moving. This may cause alien turns to take longer.

 

UPDATE: Trial hex code changes below

 

5) Add capability to use additional "active" perks

 

Each ability an alien has has to be filtered and prioritized in order to be selected as the ability the AI chooses for an alien. It is possible to grant aliens additional perks. This research will focus on the methods necessary to select and use abilities (derived from perks) that were not in the original release.

 

6) Improving performance with "passive" perks

 

Some perks granted to aliens will work with no AI modification. Others could be more effectively used if the AI is made "aware" of their effects. An example is Lightning Reflexes. More optimal behavior for a unit with the Lightning Reflexes perk is to deliberately move if overwatched by ONE enemy, in order to draw the fire so that its allies can move more freely. Movement when overwatched by 2 units may also be valid tactic. A unit with Sentinel should prioritize Overwatch ability a little higher.

 

7) Improve performance of aliens when under Suppression

 

Aliens under Suppression and flanked / exposed often take no action at all. Goal is to improve AI responses to allow for some sort of action when in this position. Two hex changes have been created and tested with positive results. Aliens can now shoot at flanking units even when suppressed. Such Suppressed units already take their actions last in the AI's turn. If a suppressed unit is flanked suppressed and alone it can "panic" and flee even though suppressed. Such moves are dash moves.

 

------------------------------------------------------------

 

This is what I have so far. Very willing to take suggestions and ideas. Some of them might be difficult/impossible to implement -- I'll add things to the list above if I think that they can be implemented via modding.


Edited by Amineri, 18 July 2013 - 04:54 PM.


#2
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

Here's my first offering. Two changes that should remove most of the cases of aliens being able to teleport:

 

1) XComAlienPod.InitMoveManeuver -- altered call to XComAlienPod.WalkPodToLocation to disallow Warping movement even if the pod has not been revealed

 

original:

1B 54 71 00 00 00 00 00 00 01 DE F8 FF FF 81 2D 00 59 39 00 00 16 16
 
new:
1B 54 71 00 00 00 00 00 00 01 DE F8 FF FF 28 16 2D 00 59 39 00 00 0B 

 

Code changes from:

WalkPodToLocation(Location, !bReveal);

 

to:

 

WalkPodToLocation(Location, false);
bReveal;
 
-------------------------------
 
2) XGAIBehavior.MoveToPoint -- disable individual unit movement from using WarpTo to shortcut along the part of its path that is not visible
 

original:

07 F7 04 81 2D 00 18 8D 00 00 16 07 64 04 B1 1C 8B FC FF FF 00 13 8D 00 00 16 38 3F 25 16 
 
new:
07 F7 04 28 2D 00 18 8D 00 00 0B 07 64 04 B0 1C 8B FC FF FF 00 13 8D 00 00 16 38 3F 25 16 

 

Code changes from:

 

        if(!bHiddenMovement)
        {
            // End:0x464
            if(VSizeSq2D(vWarpTo) > float(0))
            {
                WarpTo(vWarpTo);
                ComputePathTo(vDestination, true, false, m_bMoveToActionPoint, true);
            }
 
to:
        if(true) // always evaluate this branch
        {
bHiddenMovement // preserve virtual size
            // End:0x464
            if(VSizeSq2D(vWarpTo) < float(0))  //disable this conditional
            {
                WarpTo(vWarpTo);
                ComputePathTo(vDestination, true, false, m_bMoveToActionPoint, true);
            }
 
--------------------------------------------
 
I've verified that these won't crash the game, but I can't say for certain how many instances of teleportation they remove.
 
There are some valid uses of WarpTo that I haven't touched:
1) Failsafe code if a unit is in an invalid position or has a pathing failure
2) The Launch Ability uses WarpTo
3) Placement of pods on the map during initialization
4) Alien units dropping in during FC Special Missions


#3
anUser

anUser

    Fan

  • Members
  • PipPipPip
  • 261 posts

Excellent job. I've already implemented it, I'll try it out next time I play.

 

ps: any chance to interfere with team strategy... like forcing a dash move if alien options are poor and there's many xcom overwatching and in range and still many aliens are pending on getting a task assigned and they're also in range of the same xcom (no longer) overwatching units...

 

maybe a simple one, decreasing grenade priority per each alien taking action, or increasing it for near alien units that haven't taken an action yet (making the AI somehow considers how much use of that grenade they'd make considering it blows up cover, so it allowed for more deadly combos)

 

I'd love to see those, even if that would make them more predictable, it would also make them more deadlier so it wouldn't matter much, if you're caught at grenade range against many enemies is to be expected a casualty or more unless you've played it well... about the altruist kamikaze I'm not entirely sure how it'd play, I guess it'd be cool... rapid reaction and sentinel would be god then


Edited by anUser, 11 May 2013 - 01:00 AM.


#4
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

Here's the second change:

 

This modlet will shorten the "short range" delimiter for how dangerous aliens consider overwatch to be. The vanilla game considers any unit within 90% of visual range to be such an intense threat that it 100% disallows any such units from moving.

 

This mod will change this range to ~35% (if the overwatching unit is 10 tiles or less away the unit will still be prohibited from moving).

 

The following restrictions will still be in effect.

1) If more than one unit is overwatching, the unit will not move

2) If the unit has low HP (lower than average damage of overwatching unit's weapon), the unit will not move

3) If the unit has a good shot, then the unit is more likely to shoot than move, but the result is randomized

 

Change is in XComGame.upk >> XGAIPlayer.GetAcceptableOverwatchMovementSightRadiusPercent

 

before:

0A 9C 00 25 0F 00 2C 96 00 00 1E C3 F5 28 3F 06 C7 00 0A B2 00 26 0F 00 2C 96 00 00 1E 00 00 40 3F 06 C7 00 0A FF FF 0F 00 2C 96 00 00 1E 66 66 66 3F
 
after:
0A 9C 00 25 0F 00 2C 96 00 00 1E 00 00 B0 3E 06 C7 00 0A B2 00 26 0F 00 2C 96 00 00 1E 00 00 B0 3E 06 C7 00 0A FF FF 0F 00 2C 96 00 00 1E 00 00 B0 3E

 

I'm not sure if this won't make the aliens do some stupid things sometimes, but they should be slightly less predictable when trying to lock them down with a single overwatching unit.



#5
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

So, I can verify that disallowing the AI from using Warping when moving out-of-sight units is definitely having an effect.

 

Even on a crashed Large Scout mission (vanilla settings), the alien turns are taking about 15 to 20 seconds to complete, since each unit has to be moved at normal pace. It should fix most issues associated with teleporting, such as aliens getting inside building without opening doors or breaking windows, but at the cost of longer alien turns.

 

I imagine that the large missions like Battleships and Base Assaults will take substantially longer.



#6
dubiousintent

dubiousintent

    Resident poster

  • Premium Member
  • 8,878 posts

I would imagine that with aliens forced to move rather than teleport, we should see more sound indicators to their location as well?  Hmm.  That would compensate for longer turns IMO.

 

-Dubious-



#7
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

In the one mission I was on I didn't notice any significant difference in the audible tracking cues with the teleporting turned off.

 

With teleporting on the unit still computes a destination and a path to the destination. It then checks each tile along the path to see if it is visible to any enemy unit. If the path isn't visible then it uses WarpTo to move directly to the destination.

 

With WarpTo disabled, the unit has to actually go through the animation sequence timing, even though the animation is not being displayed.

 

It is difficult to be sure from the one mission I played, as teleporting behavior has been much improved since Patch 4. The one time a patrol came upon me in the test-mission I played, the Thin men did move normally in from the fog of war. But that can happen normally.

 

People are reporting that they are still experiencing "soft" teleports where the aliens briefly appear but then teleport somewhere far away from the soldiers, but are activated. My goal with this change was to see if this would be improved.

 

Definitely more playthroughs are required, though ...



#8
Yzaxtol

Yzaxtol

    Old hand

  • Premium Member
  • 644 posts

Strange, my sectoids have been teleporting all the time now, even when found and just walking across my vision they actually teleport instead. :(



#9
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

Strange, my sectoids have been teleporting all the time now, even when found and just walking across my vision they actually teleport instead. :(

 

Very odd, very odd. I finally experienced a teleporting Sectoid. I was overwatching a Sectoid that was exposed and it teleported into cover and shot. Clearly something is going wrong here ....

 

The mission I was testing didn't have any Sectoids, just Thin Men and an Outsider. When I overwatched a Thin Man that was exposed he just shot at my SHIV instead of moving or teleporting. It's weird because the aliens still should be prevented from moving at all when overwatched.

 

The only times Warping should be allowed are an Invalid Position error or a pathing error. I wonder if there are some pathing errors cropping up that weren't causing problems before...



#10
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

I've seen a bit more teleporting from aliens. It seems to be occuring only when they are flanked+overwatched -- I've seen a few times where they now teleport into cover. I wish XCOM soldiers had that ability! :D

 

I think that there is still some sort of error in the AI relating to flanked+overwatched. There is code tearing the AI into two incompatible directions. It absolutely wants to move because it is flanked, but it absolutely doesn't want to move because it is overwatched.

 

I have the feeling that this is causing the regular movement code to fail in some manner that is making it default to using WarpTo as if it were "stuck".

 

I didn't remove the WarpTo calls relating to error conditions. If the last alien is in some invalid location and can't be killed, the mission could become unwinnable if it can't use WarpTo to get itself free.






IPB skins by Skinbox
Page loaded in: 1.017 seconds