Author Topic: AI hang: Cautious mafia specialist with a shotgun  (Read 15080 times)

ushas

  • Hero Member
  • *****
  • Posts: 661
AI hang: Cautious mafia specialist with a shotgun
« on: January 25, 2018, 02:47:09 AM »
(v23, linux, HB)

Mafia, fight with lieutenant Rico Lucchesi, Aug 6+, SlumConstruction1, district G7

Problem: The battle freezes when it's a turn of one of the brown coat specialists (CautiousAI). He's holding a shotgun (Eurocorp Orthrus). No errors in the log.


Notes:
In one of the previous combat rounds, he decided to do a double shot with the shotgun.
 
Guessing from the archived log, the last turn he starts with 8AP and 0 ammo. And it seems he decided to reload the shotgun + do a single shot (3+5=8 ap). But there is also something looking like movement lines. Unfortunately, I don't remember whether he reloaded and/or moved before it hangs (looks some orders were executed). For sure only know that he hadn't fired at all.

The last line: "Item.CheckIfEnoughAmmoForAttack. Use mode: 0"
-> thus I'm guessing he wanted to fire the single shot. It ends here, but on normal occasions it's followed by lines with "Item.ApplyDeteriorationFromUse", then "CharacterMainScript.SetupRangedAttack", checking criticals etc...

I suppose some lines in the log are just that AI contemplates options, and that there is also a lot under the hood what isn't printed. So the above musing upon his actions and where it all ended is probably very misleading.

Battle screen at the moment of freeze:



Specialist's last turn in the log:
Code: [Select]
BattleControlScript.FindNextActiveCharacter. Method called
BattleControlScript.FindNextActiveCharacter. AI character at pos 4 is combat capable?: True is involved in combat:? True
CharMainScript.CheckIfBleedingReturnKilledAndApplyDamage. Method called. Checking for: DeStasio Masi
BattleControlScript.FindNextActiveCharacter. DeStasio Masi has not died from fire or bleeding
BCS.CacheCurrentCharacter. Method called for character at pos 4 on char script list. Is player controlled: False name is: DeStasio Masi
CameraControlScript.GetRequiredCameraPosition: Method called
CameraControlScript.FocusCamera. Method called. Return to default elevation: False target pos: (19.8, 24.0, -25.1) time scale: 1
CharacterContainer.DecreasActivePerkCooldowns. Method called.
BCS.CheckIfPlayerOrAITurn. Method called. Is character delaying turn: False
BattleControlScript.CheckIfPlayerOrAiTurn. DeStasio Masi is not delaying turn. Restoring AP
BattleControlScript.DisablePlayerInput. Method called
CharacterAIScript.InvokeGetPossibleOrdersForTurn. Method called. Character is: DeStasio Masi delay
CombatQueueManager.GenerateCombatantIcons. Method called. PRE GEN. Current list display objects: 6 combatant icon scripts: 6
CombatQueueManager.GenerateCombatantIcons. Method called. POST GEN. Current list display objects: 6 combatant icon scripts: 6
CameraControlScript.FocusCamera. Method complete
CharacterAIScript.DetermineCharacterActionForTurn. Method called
CharacterAIScript.DetermineCharacterActionForTurn. Character Has AP
CharAIScript.GetOrdersBasedOnBehaviourType. Method called
CharAIScript.GetOrdersBasedOnBehaviourType. has healing item: True character health %: 1 min health before heal: 0.6 heals this turn: 0 max heals per turn
CharAIScript.GetOrdersBasedOnBehaviourType. Checking for orders. Behaviour type is: 1
CharacterAIScript.GetMeleeMetaOrder. Found path, adjacent exit allowed, no pathing through fire
CharacterAIScript.GetMeleeMetaOrder. Method called. Is move required: True / avg distance to enemies: 9.25
CharAIScript.GetMeleeMetaOrder. Path found, route through fire
CharacterAIScript.GetMeleeMetaOrder. Method called. Is move required: True / avg distance to enemies: 9.25
CharacterAIScript.GetMeleeMetaOrder. Found path, adjacent exit allowed, no pathing through fire
CharacterAIScript.GetMeleeMetaOrder. Method called. Is move required: True / avg distance to enemies: 9.25
CharAIScript.GetMeleeMetaOrder. Path found, route through fire
CharacterAIScript.GetMeleeMetaOrder. Method called. Is move required: True / avg distance to enemies: 9.25
CharacterAIScript.GetMeleeMetaOrder. Found path, adjacent exit allowed, no pathing through fire
CharacterAIScript.GetMeleeMetaOrder. Method called. Is move required: True / avg distance to enemies: 9.25
CharAIScript.GetMeleeMetaOrder. Path found, route through fire
CharacterAIScript.GetMeleeMetaOrder. Method called. Is move required: True / avg distance to enemies: 9.25
CharacterAIScript.GetMeleeMetaOrder. Found path, adjacent exit allowed, no pathing through fire
CharacterAIScript.GetMeleeMetaOrder. Method called. Is move required: True / avg distance to enemies: 9.25
CharAIScript.GetMeleeMetaOrder. Path found, route through fire
CharacterAIScript.GetMeleeMetaOrder. Method called. Is move required: True / avg distance to enemies: 9.25
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Method called. There are: 6 IEOS. Current meta orders: 8
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. There are IEOs in play
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Method called. There are: 0 more players than enemies around ieo 0
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Method called. There are: 0 more players than enemies around ieo 1
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Method called. There are: 0 more players than enemies around ieo 2
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Method called. There are: 1 more players than enemies around ieo 3
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Distance more than 1 - a move is required.
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObject. Move Req. Not Enough AP. Current AP: 8 total: 18path cost 14 move & attack: 4
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Method called. There are: 0 more players than enemies around ieo 4
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Method called. There are: 0 more players than enemies around ieo 5
CharacterAIScript.GetMeleeOrdersAgainstEnvironmentObjects. Completed. Current meta orders: 8
CharAIScript.GetRangedOrderForCautiousAI. Method Called.
CharAIScript.GetAPDistributionOptions. Ranged weapon is: Eurocorp Orthrus number of fire modes: 2 character ap: 8
CharacterAIScript.GetAPDistributionOptions. current clip is: 0
CharAIScript.GetAPDistributionOptions. Adding reload order at pos: 0 AP cost: 3 leftover AP: 8current clip: 0
CharAIScript.GetAPDistributionOptions. Not enough AP for another attack. Trying to add attack with lower AP cost.
CharAIScript.GetAPDistributionOptions. Adding ranged attack. AP cost: 5 leftover AP: 0
CharAIScript.GetAPDistributionOptions. Distribution complete. No AP for another attack
CharacterAIScript.GetAPDistributionOptions. current clip is: 0
CharAIScript.GetAPDistributionOptions. Adding reload order at pos: 0 AP cost: 3 leftover AP: 8current clip: 0
CharAIScript.GetAPDistributionOptions. Adding ranged attack. AP cost: 5 leftover AP: 0
CharAIScript.GetAPDistributionOptions. Distribution complete. No AP for another attack
CharacterAIScript.GetAPDistributionOptions. Number of distribution options found (Pre Attack -1) : 2
CharacterAIScript.GetRangedOrderForCautiousAI. Distro 1 no of attacks: 1 Distro 1 pos: 0 Distro 2 no of attacks: 1 Distro 2 pos: 1
CharacterAIScript.GetRangedOrderForCautiousAI. All but selected distributions have been removed. Number remaining: 2
CharacterAIScript.GetHoldPositionMetaOrder. method called
CharAIScript.GetRangedMetaOrder. No defender script has been passed. Searching for enemy to whom most damage can be done
CharAIScript.GetRangedMetaOrder. No defender script has been passed. Searching for enemy to whom most damage can be done
CharacterAIScript.GetRangedOrderForCautiousAI. Number of meta orders after baseline: 9
CharacterAIScript.GetRangedOrderForCautiousAI. (PRE LOWEST LEFTOVER DISTRIBUTION REMOVES) Number of high leftover ap tiles: 0
CharacterAIScript.GetRangedOrderForCautiousAI. (PRE LOWEST LEFTOVER DISTRIBUTION REMOVES) Number of high leftover ap tiles: 0
CharacterAIScript.GetRangedOrderForCautiousAI. Number of meta orders after baseline movement variant : 9
CharacterAIScript.GetRangedOrderForCautiousAI. No Ranged Orders. Searching for flanking movement orders. Number of existine meta orders: 9
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. Current grid pos: (16.0, 14.0) character AP: 8
CharacterAIScript.SampleClearLOSToEnemy. Sample step: (2)  is less than/equal to char AP: (8)
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. APSampleStep: 2 iteration pos: 0
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. APSampleStep: 2 iteration pos: 1
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. APSampleStep: 2 iteration pos: 2
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. APSampleStep: 2 iteration pos: 3
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. APSampleStep: 2 iteration pos: 4
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. APSampleStep: 2 iteration pos: 5
CharacterAIScript.SampleClearLOSToTargetForFlanking. Found path to sampled flanking position. Path AP: 4
CharacterAIScript.SampleClearLOSToTargetForFlanking. Direction: 5 number of adjacent tiles7
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Flanking order not valid
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Meta Order Added
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Meta Order Added
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Flanking order not valid
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Meta Order Added
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Meta Order Added
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Flanking order not valid
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. Current grid: (16.0, 14.0) Sample grid pos: (14.0, 16.0) LOS to Elena Furey
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. APSampleStep: 2 iteration pos: 6
CharacterAIScript.SampleClearLOSToTargetForFlanking. Found path to sampled flanking position. Path AP: 2
CharacterAIScript.SampleClearLOSToTargetForFlanking. Direction: 6 number of adjacent tiles8
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Flanking order not valid
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Meta Order Added
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Meta Order Added
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Flanking order not valid
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Meta Order Added
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Flanking order not valid
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Flanking order not valid
CharacterAIScript.GetFlankingMetaOrder. Method called.
CharAIScript.GetFlankingMetaOrder. Meta Order Added
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. Current grid: (16.0, 14.0) Sample grid pos: (14.0, 14.0) LOS to Elena Furey
CharacterAIScript.SampleClearLOSToTargetForFlanking. Method called. APSampleStep: 2 iteration pos: 7
CharAIScript.GetThrownWeaponOrders. Distance between character 0 : Sam Contino and character 1 : Elena Furey is: 7
CharAIScript.GetThrownWeaponOrders. Distance between character 0 : Sam Contino and character 2 : Emilia DeSoto is: 2
CharAIScript.GetThrownWeaponOrders. Distance between character 0 : Sam Contino and character 3 : Ray Case is: 7
CharAIScript.GetThrownWeaponOrders. Distance between character 1 : Elena Furey and character 2 : Emilia DeSoto is: 5
CharAIScript.GetThrownWeaponOrders. Distance between character 1 : Elena Furey and character 3 : Ray Case is: 1
CharAIScript.GetThrownWeaponOrders. Distance between character 2 : Emilia DeSoto and character 3 : Ray Case is: 5
CharAIScript.GetThrownWeaponOrders. Number of AOE connections is: 2
CharAIScript.GetThrownWeaponOrders. Number of characters: 2
CharAIScript.GetThrownWeaponOrders. Target with most surrounding targets is: 0
CharAIScript.GetThrownWeaponOrders. Chose tile: (4.0, 29.0)
CharacterAIScript.SampleClearLOSToTargetForFlanking. Coroutine complete
CharAIScript.ScoreAndChooseMetaOrder. Method called. Number of Meta Orders to choose from: 17 behaviour type is: 1
CharAIScript.CalculateCautionOrderScore. Scoring orders for cautious character. Average distance to enemy: 15.5
CharAIScript.CalculateCautionOrderScore. This order is a hold. Turns since hold order: 0
CharAIScript.CalculateCautionOrderScore. This order is a hold. Turns since: 0 zeroing this order.
CharAIScript.GetFireScoreMultiplier. Not standing on fire tile. No penalty.
CharAIScript.CalculateCautionOrderScore. Zeroing this order
CharAIScript.ScoreAndChooseMetaOrder. Chosen order position is: 9
CharAIScript.ExecuteNextAIOrder. Chosen meta order position is: 9 current order position is: 0 number of orders is: 2 order type: 0
CharacterAIScript.ExecuteNextAIOrder. Current order is move. Current order position: 0 of: 2 Number of steps: 4 ref path count: 4
CharacterAIScript.ExecuteNextAIOrder. There are additional orders in this meta order. Next order type is: 2
CharacterMovementScript.InvokeSetAimingAnimationParameterFalse. Method called
CharacterMovementScript.HandleReturnOfControl. Method called
CharAIScript.ReturnControlToAI. Method called
CharAIScript.ReturnControlToAI. Still orders left in meta order. Advancing to order 1 of 2
CharAIScript.ExecuteNextAIOrder. Chosen meta order position is: 9 current order position is: 1 number of orders is: 2 order type: 2
CharacterMainScript.SetupRangedAttack. Method called. Selected weapon name is: Eurocorp Orthrus use mode pos: 0 body part damage modifier1 status effect: -1 is overwatch: False
Item.CheckIfEnoughAmmoForAttack. Use mode: 0
« Last Edit: May 13, 2018, 06:03:42 PM by ushas »

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: AI hang: Cautious mafia specialist with a shotgun
« Reply #1 on: January 25, 2018, 11:01:38 AM »
Thanks, looks like there are quite a few AI hiccups : /

ushas

  • Hero Member
  • *****
  • Posts: 661
Re: AI hang: Cautious mafia specialist with a shotgun
« Reply #2 on: January 26, 2018, 03:02:11 AM »
Hiccups always go away...

There were two specialists in the battle, don't know which one is which. Their init lines:
Code: [Select]
GangDataScript.GenerateGangMember. Method called. Gang No is: 0 char level: 17 specialisation in: 1 danger level: 4 gender: -1 leadership level: 1 nerf character: False
GangDataScript.GiveGangMemberAssignedAndRandomTraits. Gang no: 0 /specialisation: 1 has : 0 traits
GangDataScript.GenerateGangMember. Requested gender is: -1 chosen gender is: 0
GangDataScript.GenerateGangMember. Character gender is: 0
GangDataScript.GenerateGangMember. Danger level is: 4
GangDataScript.AddGangCharacterEquipment. Method called. gang equipment level: 5 local bonus: 1 final equipment level: 6
GangDataScript.GetGangCharacterItems. Method called. Equipment Level: 6Loadout is: Melee1 ccr: 2 gen ranged: -3 long ranged: -3 explosives level -2 explosives count 1 healing level : 1
GangDataScript.GetGangCharacterItems. Explosives equip level: 4

and
Code: [Select]
GangDataScript.GenerateGangMember. Method called. Gang No is: 0 char level: 17 specialisation in: 1 danger level: 4 gender: -1 leadership level: 1 nerf character: False
GangDataScript.GiveGangMemberAssignedAndRandomTraits. Gang no: 0 /specialisation: 1 has : 0 traits
GangDataScript.GenerateGangMember. Requested gender is: -1 chosen gender is: 0
GangDataScript.GenerateGangMember. Character gender is: 0
GangDataScript.GenerateGangMember. Danger level is: 4
GangDataScript.AddGangCharacterEquipment. Method called. gang equipment level: 5 local bonus: 1 final equipment level: 6
GangDataScript.GetGangCharacterItems. Method called. Equipment Level: 6Loadout is: Melee-2 ccr: -3 gen ranged: -3 long ranged: 2 explosives level -3 explosives count -3 healing level : 0

Btw. there is no day info in the log. So unless I always pair it with a save to check in game, will be able to deduct only month and hours and minutes of time before the battle. Mentioning in case you'd ever need such info from a log in the future.

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: AI hang: Cautious mafia specialist with a shotgun
« Reply #3 on: February 02, 2018, 12:07:25 PM »
Did he complete the move component of the order?

Set up a test scenario with all hitmen and double barrel shotguns, allowing them to fire away over multiple maps. No luck on recreating. Based on where the debugging ended, have been able to narrow down what could have gone wrong. Most likely scenario seems like the character didn't have enough ammo to complete the order. I've added extra debugging, so we'll have a better idea of what's going wrong when/if it happens again.

Checking out the code for the ranged orders at the moment to see if can spot a logic error.

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: AI hang: Cautious mafia specialist with a shotgun
« Reply #4 on: February 02, 2018, 12:39:10 PM »
Can't see anything wrong in the checks preventing AI characters trying to fire more ammo than they have without reloading.

ushas

  • Hero Member
  • *****
  • Posts: 661
Re: AI hang: Cautious mafia specialist with a shotgun
« Reply #5 on: February 02, 2018, 03:55:33 PM »
Honestly, I don't remember about movement.
Think it was his second turn or something. That would mean no ammo in the pockets...
When did a few tries on recreation last week, the guy shoots ten+ times with a shotgun, reloading all right.

I can check the date and load a near save, to do the battle a few more times. Can imagine you would rather get rid of this. During v22 was getting some ghost enemies on this map too. Hopefully at least one of the issues shows. Unless ghosts were reported or fixed already?

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: AI hang: Cautious mafia specialist with a shotgun
« Reply #6 on: February 02, 2018, 05:24:24 PM »
No fixes on ghost as far as can remember. Ideally if I could get this issue to happen, I'd be able to check things like ammo left etc. It will happen eventually.

ushas

  • Hero Member
  • *****
  • Posts: 661
Re: AI hang: Cautious mafia specialist with a shotgun
« Reply #7 on: February 05, 2018, 03:25:36 AM »
Of course, that would be ideal. Just that when you said that haven't recreated, guessed that ammo clue might originate from the info from over here. I believe you, np, but wouldn't want to cause any misleading in accident. Recalling, in v22 had AI hangings which were most probably issues of low AP (eg. distracted + 4ap + rifle), but the log was telling various things, not saying anything about AP. Sometimes also throwing an error around the line with "CheckIfEnoughAmmoForAttack". So thought to try some different things around in the meantime, just in case. But, yeah, probably won't help anything.

Haven't managed to get much time to play over the weekend, no new info on this, but was lucky on the ghost recreation. Will open then.

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: AI hang: Cautious mafia specialist with a shotgun
« Reply #8 on: August 18, 2018, 03:50:16 PM »
If this is linked to enemies with shotguns, it has been fixed.