long-war-2 / lwotc

Port of Long War 2 to XCOM 2's War of the Chosen expansion
345 stars 92 forks source link

Suggestion: Alien-to-Lost targetting improvement #1079

Closed NilchEi closed 11 months ago

NilchEi commented 4 years ago

I made two changes on XComAI.ini that seem to improve AI-to-Lost targeting: I replaced pre-existing TargetIsHighPriority, and added modified AdjustScoreForLostPriority & LostPriorityScore.

; Adds check to disqualify Lost as TargetIsHighPriority
+Behaviors=(BehaviorName=TargetIsHighPriority, NodeType=Sequence, Child[0]=TargetIsNotCivilian, Child[1]=TargetIsNotLost, Child[2]=TargetKillableOrFlanked, Child[3]=AddToTargetScore_1000, Child[4]=UpdateBestTarget)

; Remove vanilla AI-to-Lost score from -500/+500 to -2000/+50
+BehaviorRemovals="AdjustScoreForLostPriority"
+NewBehaviors=(BehaviorName=AdjustScoreForLostPriority, NodeType=Selector, Child[0]=LostPriorityScore, Child[1]=AddToTargetScore_-2000)

+BehaviorRemovals="LostPriorityScore"
+NewBehaviors=(BehaviorName=LostPriorityScore, NodeType=Sequence, Child[0]=ShouldPrioritizeTheLostTarget, Child[1]=AddToTargetScore_50)

Following behaviour was observed when tested on dev 17 Legend difficulty: 1) AI never shoot Lost that are standing next to XCom units. 2) AI prefer to shoot at Lost attacking them over XCom target under full or half cover. 3) AI always targets flanked XCom units over Lost.

NilchEi commented 4 years ago

Increased LostPriorityScore to +50 as otherwise MEC would prefer to suppress Lost instead of shooting. This value probably needs most attention because it concerns AI's evaluation of Lost that pose threat to Alien.

Honestly introducing only TargetIsHighPriority & AdjustScoreForLostPriority change should be sufficient, as these two seem to be all that's necessary to discourage AI from shooting non-threatening Lost.

NilchEi commented 4 years ago

Did some further testing and LostPriorityScore of +50 seems to be fine. AI aggressively shoots at Lost threatening them instead of overwatching in most cases, though I haven't checked up to late-game units.

So what my code seems to do is to ensure AI process their shooting target in following order: Flanked XCom unit (priority shot?) -> Lost threatening them -> XCom under half/full cover (Lost not threatening them are completely ignored, with exception of AoE and special abilities)

I drew this conclusion by using TakeNoDamage console command and camping all my units in half-cover. When Lost horde appears, Alien kill specific Lost units first then starts targeting only my unit, not attacking remaining Lost units at all. This behaviour was maintained even when I put my unit in full cover, with all ADVENT choosing to take ~3% shot at me rather than targeting exposed low-health Lost units (that weren't attacking them). In contrast, when there was exposed XCom unit, Alien always fired at that soldier first even when it had hostile Lost attacking them right next to it.

Grobobobo commented 4 years ago

I'll try including it next version

bobjjones commented 4 years ago

Is this in v3.1? I noticed some improvement in AI targeting of lost in that version.

copyrite commented 11 months ago

Seems to be implemented in 9f83bc15cf648dc7eed61ab7ed4a21e71e028e61