Author Topic: [Resolved] NPC in Running animation loop  (Read 6407 times)

ushas

  • Hero Member
  • *****
  • Posts: 661
[Resolved] NPC in Running animation loop
« on: September 27, 2017, 09:50:49 PM »
(v20, linux, Suburbs2, conf:2)

Had the mission against Mafia with the police officer as joinable NPC. At one point he is next to one of the enemies and the second enemy is fleeing. He decides to switch to HtH and go after the one fleeing by left-clicking at him (this enemy is out of reach but move+attackCC feature has peculiarity that it let's you to move till AP deplenished even when clicking outside of the reach):
-- At the beginning of Bill's movement he triggers AOO attack of the first enemy
-- Then moves as ordered, stops right at the point when spending all AP
-- His turn is auto-ended with him in running animation loop

Compare to previous animation loop bugs this doesn't spam the log and won't influence the rest of the battle. Bill will simply stop the loop on the next turn as soon as he moves again.   

In the log:
Code: [Select]
KScript.SetCurrentIKPosition. Method called. Position is: 2
WeaponListObjectScript.ActivateWeaponGameObject. Current spawn point is: (23.6, 0.9, -41.8)
CameraControlScript.FocusCamera. Method complete
BattleControlScript.EnablePlayerInput. Time is: 17857.4 time until user input enabled: 17857.37
BattleControlScript.EnablePlayerInput. Time is: 17857.4 time until user input enabled: 17857.37 ENABLING
MouseTrackerScript.RefreshInput. Method called. Grid position is: (18.0, 28.0)
OverWatchManager.StartNextAttackOfOpportunity. No AOO left for this move.
OverwatchManager.SetAOOResolvedState. Current state: False new state: False
NullReferenceException: Object reference not set to an instance of an object
  at CharacterMovementScript.StartMovement () [0x00000] in <filename unknown>:0
  at OverwatchManager+<StartNextAttackOfOpportunity>c__Iterator62.MoveNext () [0x00000] in <filename unknown>:0

I think there was as if the second AOO happening (only one attack in game), but unsure. Will try digging later.
Haven't recreated with the allies so far.
« Last Edit: October 19, 2017, 02:20:01 PM by Daithi »

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: NPC in Running animation loop
« Reply #1 on: September 28, 2017, 10:05:06 AM »
Ugh, I hoped the running bug was gone. Added code to stop the animation when a turn is ended, as a safeguard, but it seems that it's not doing anything in this instance. At least there are clues how how to recreate.

ushas

  • Hero Member
  • *****
  • Posts: 661
Re: NPC in Running animation loop
« Reply #2 on: September 28, 2017, 01:46:02 PM »
Wasn't much happy to report this either. But compare to the past ones this was more like a small glitch. Will try to undertake the mission again.

Btw. hadn't held back any overwatch bugs!

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: NPC in Running animation loop
« Reply #3 on: October 18, 2017, 03:03:01 PM »
Remember (after several weeks) if it was a hit or a miss?

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: NPC in Running animation loop
« Reply #4 on: October 18, 2017, 03:33:00 PM »
Have been unable to recreate. What might be happening here is that some process relating to the AOO is resolving after the character has auto ended turn, but not too convinced about that. Have increased the gap after auto end turn as a possible fix.

There's code to stop footsteps and running animation in the end turn method, so another possibility is that the turn has ended twice, and code is being called on the next character.

ushas

  • Hero Member
  • *****
  • Posts: 661
Re: NPC in Running animation loop
« Reply #5 on: October 18, 2017, 06:43:45 PM »
Remember (after several weeks) if it was a hit or a miss?
no

Citing log usually means I have it saved somewhere. If that's the case will get back to you with better answer later.
Recalling it seemed as if AOO was twice there or so. Wasn't lucky in recreation so far.

Edit: Indeed there is a saved log, the following lines are the Bill's turn:
Code: [Select]
BattleControlScript.GetTilePhysicalPosition. Method called. Requested tile: (13.0, 30.0)
CameraControlScript.FocusCamera. Method complete
CharMainScript.GetUseModeType. Use mode type is: 1 AP cost: 3
BattleControlScript.GetMeleeChanceToHit. defender wound level: 2, increasing CTH by: 10
BattleControlScript.HandlePlayerPathFindingRequest. Character faction is: 0 is crouching: False
CharacterMovement.GetPathCost: Path cost is 6 number of steps in path is: 7
BattleControlScript.GetMeleeChanceToHit. defender wound level: 2, increasing CTH by: 10
BattleControlScript.HandlePlayerPathFindingRequest. Character faction is: 0 is crouching: False
CharacterMovement.ClearCurrentLocalPath. PATH BEING SET TO NULL for Bill Manning
CharacterMovement.GetPathCost: Path cost is 6 number of steps in path is: 7
BattleControlScript.GetMeleeChanceToHit. defender wound level: 2, increasing CTH by: 10
MouseTrackerScript.Update. Right Click. Tile is: (26.0, 30.0)
BattleControlScript.DetermineRightClickAction. Second click on same tile
BattleControlScript.DisablePlayerInput. Method called
CharMoveScript.SetupMovement. Method called
CharacterMainScript.HideReachableTiles. Method called.
OverwatchManager.SetAOOResolvedState. Current state: False new state: True
OverWatchManager.StartNextAttackOfOpportunity. Method called.
CTHDisplayObjectScript.SetParticleSelectorBusy. METHOD CALLED
OverWatchManager.StartNextAttackOfOpportunity. There are 1 attackers of opportunity remaining, and 1 chance to triggers
OverWatchManager.StartNextAttackOfOpportunity. Iteration 0
OverwatchManager.StartNextAttackOfOpportunity. Equipment change required for AOO
OverwatchManager.StartNextAttackOfOpportunity. Changing equipment for AOO
OverwatchManager.StartNextAttackOfOpportunity. Pos of weapon: 0
CharacterMainScript.AISwitchToItemAtPos. Method called. Item pos is: 0 item name: Unarmed
CharacterMovementScript.AnimateEquipmentChange. Method called. Last equipment type: 4 current equip type: 0 weapon list pos: -1
CharMoveScript.AnimatePistolHolster. Method called
BattleControlScript.DisablePlayerInputForSeconds. Method called
BattleControlScript.EnablePlayerInput. Time is: 17853.66 time until user input enabled: 17853.63
BattleControlScript.EnablePlayerInput. Time is: 17853.66 time until user input enabled: 17853.63 ENABLING
CharacterMovementScript. This character is unarmed. Draw animation not required. Is battle control accepting input: True
MouseTrackerScript.RefreshInput. Method called. Grid position is: (26.0, 30.0)
BattleControlScript.HandlePlayerPathFindingRequest. Character faction is: 0 is crouching: False
CharacterMovement.ClearCurrentLocalPath. PATH BEING SET TO NULL for Bill Manning
CharacterMovement.GetPathCost: Path cost is 6 number of steps in path is: 7
BattleControlScript.GetMeleeChanceToHit. defender wound level: 2, increasing CTH by: 10
CharacterMainScript.SetupMeleeAttack. attacker is: Gallo Rizzo
CharacterMainScript.SetupMeleeAttack. Character Bill Manning is not already on list. Adding
BattleControlScript.GetMeleeChanceToHit. attacker wound level: 1, decreasing CTH by: 5
BCS.GetObstructedTileArray. Checking tile (19.0, 35.0)
BCS.GetObstructedTile. Tile: 18 / 36 is obstructed
BCS.GetObstructedTile. Tile: 18 / 35 is obstructed
BCS.GetObstructedTileArray. Checking tile (19.0, 34.0)
BCS.GetObstructedTile. Tile: 18 / 35 is obstructed
CharacterMainScript.SetupMeleeAttack. Defender animation type is: 0 attacker animation type is: 0
BCS.GetMeleeAnimation. Attack name is: Unarmed.Mid Round-Kick[Gut]R
BCS.GetMeleeAnimation. Evasion name is: Evasions.SideStep Right
CharacterMainScript.StartMeleeAttack. Is overwatch: False / is AOO: True attacker: Gallo Rizzo
BattleControlScript.HandlePlayerPathFindingRequest. Character faction is: 0 is crouching: False
CharacterMovement.ClearCurrentLocalPath. PATH BEING SET TO NULL for Bill Manning
CharacterMovement.GetPathCost: Path cost is 6 number of steps in path is: 7
BattleControlScript.GetMeleeChanceToHit. defender wound level: 2, increasing CTH by: 10
CharacterMainScript.StartMeleeAttack. Method called. Is overwatch attack: False / is AOO: True attacker: Gallo Rizzo
CharMoveScript.AnimateMeleeAttack. Animation name is: Unarmed.Mid Round-Kick[Gut]R attack succeeds: False impact time: 0.55
CharacterMovementScript.AnimateMeleeAttack. Method called. SFX volume is 0.7
BattleControlAudio.GetFightSFX. Kick Evade
BattleControlAudio.ReturnRandomSoundEffectFromList. Position is: 0
CharMoveScript.AnimateMeleeAttack. Animation name is: Evasions.SideStep Right
CharacterMainScript.StartMeleeAttack. Completed logic. Prior to yield.
MouseTrackerScript.Update. Right Click. Tile is: (26.0, 30.0)
BattleControlScript.DetermineRightClickAction. Second click on same tile
BattleControlScript.DisablePlayerInput. Method called
CharMoveScript.SetupMovement. Method called
CharacterMainScript.HideReachableTiles. Method called.
OverwatchManager.SetAOOResolvedState. Current state: True new state: True
OverWatchManager.StartNextAttackOfOpportunity. Method called.
CTHDisplayObjectScript.SetParticleSelectorBusy. METHOD CALLED
OverWatchManager.StartNextAttackOfOpportunity. There are 1 attackers of opportunity remaining, and 1 chance to triggers
OverWatchManager.StartNextAttackOfOpportunity. Iteration 0
OverwatchManager.StartNextAttackOfOpportunity. No attacks of opportunity left
OverwatchManager.SetAOOResolvedState. Current state: True new state: False
CharacterMovementScript.InvokeSetAimingAnimationParameterFalse. Method called
CharacterMovementScript.PlayFootSteps. Method called. SFX volume is: 0.7
CharacterMovementScript.HandleEndOfMovement. Method called for: Bill Manning Is character combat capable: True is moving: False
CharacterMovementScript.HandleEndOfMovement. Path NOT null
CharacterMovementScript.UpdateCurrentTile. Method called. Path position is: 0
CharacterMainScript.UpdateReachableTiles. Method called for: Bill Manning AP left: 0 Use mode AP: 3
CharacterMainScript.CheckDistanceToAdjacentEnemyLists. Mutually removing Bill Manning and Gallo Rizzo
BCS.AlertSurroundingEnemies: Criminal at (26.0, 30.0) alerted
BattleControlScript.AlertSurroundingEnemies. Ida Saviatore is not on Bill Manning's adjacent enemy list. Number of enemies on list: 1
CharacterMovement.ClearCurrentLocalPath. PATH BEING SET TO NULL for Bill Manning
CharMainScript.GetCoverLevel. This character is in the open, but not crouched
CharacterMainScript.StartMeleeAttack. Completed logic. Post yield for: Gallo Rizzo
CharacterMainScript.ConcludeMeleeAttack. Method called. Character: Gallo Rizzo Is overwatch: False /is AOO: True /attack succeeds: False
CharacterMainScript.ConcludeMeleeAttack. This is an attack of opportunity
CharacterMainScript.SwitchToWeaponAtPos: 1
CharMainScript.CacheSelectedUsableItem. Method called. Selected item at pos 1 is: Abramovich 9
CharMainScript.GetUseModeType. Use mode type is: 0 AP cost: 4
CharMainScript.CacheSelectedUsableItem. selected item anim type: 1 last item anim type: 0 / last equipped item model pos: -1 / current equipped item model pos: 12
CharMainScript.CacheSelectedUsableItem. last anim type: 0 / current anim type: 4 / last equipped item model pos: -1 / current equipped item model pos: 12
CharacterMovementScript.AnimateEquipmentChange. Method called. Last equipment type: 0 current equip type: 4 weapon list pos: 12
CharacterMovementScript.AnimateEquipmentChange. Method called. current equipment type is: 4
CharMoveScript.AnimatePistolDraw. Method called
BattleControlScript.DisablePlayerInputForSeconds. Method called
CharacterMovementScript.AnimateEquipmentChange. Player input disabled for 1H Ranged Draw. Time is: 17856.51
OverWatchManager.StartNextAttackOfOpportunity. Method called.
BattlControlScript.EndCharacterTurn. METHOD CALLED for Bill Manning
As you've decided not print CTH info anymore, it doesn't say if it was hit, but base on 'evasion' animation words and absence of damage reduction in this section, my bet is on miss.

The log section containing the exception, cited in the OP, happens a bit later. It seems during Ray's turn. Btw. there wasn't AOO hapenning - is it possible that those lines containing AOO were also still related to the Bill's turn?

Btw. do you want more bugs tomorrow? Not having much time overall, but can at least try post small yet unreported ones.
« Last Edit: October 19, 2017, 01:26:37 AM by ushas »

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: NPC in Running animation loop
« Reply #6 on: October 19, 2017, 12:52:04 PM »
As you've decided not print CTH info anymore, it doesn't say if it was hit, but base on 'evasion' animation words and absence of damage reduction in this section, my bet is on miss.

The log section containing the exception, cited in the OP, happens a bit later. It seems during Ray's turn. Btw. there wasn't AOO hapenning - is it possible that those lines containing AOO were also still related to the Bill's turn?

Btw. do you want more bugs tomorrow? Not having much time overall, but can at least try post small yet unreported ones.

Yeah, cut out a lot of frequent debug information because it's slowing down the game. You might have noticed a comment or two about improved performance in this build.

It does look that way. Can you recall if Ray had adjacent enemy? The 2nd last line in the Bill log is Start New AOO and it looks like the 1st AOO character isn't removed from the list - might be able to figure it out from what's posted, but any chance you can send this one on too?

Please do! You know how bug reports help my sense of inner calm :)
« Last Edit: October 19, 2017, 01:11:25 PM by Daithi »

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: NPC in Running animation loop
« Reply #7 on: October 19, 2017, 01:46:36 PM »
Adding on: if there was just one enemy adjacent to Bill, it seems that there was a problem removing the character from the AOO list, as after the attack, there was still 1 potential AOO character. Looking at the code, I'm not sure how this could happen, yet. Currently trying to recreate, by moving away from enemies armed with a gun, and ending the movement on the last tile to auto end turn. No luck so far.

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: NPC in Running animation loop
« Reply #8 on: October 19, 2017, 01:52:47 PM »
New contender: player input seems to be enabled when the enemy is swapping away from their weapon to do the AOO, and there is a pathfinding request (stop clicking stuff :) after the initial one, which could have caused another AOO attack to trigger, while the first one was active. Would explain why the Attacker was not remove from list (yet) and why the character's movement would start again after reaching destination.

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: NPC in Running animation loop
« Reply #9 on: October 19, 2017, 02:18:53 PM »
Yep, didn't cause the same outcome as for you, but it did trigger multiple AOO - a thing you've reported before. It's difficult to be 100% certain, but it's very likely the same problem, that would have had a different outcome, depending on where the click had been to, or the timing of it. It's possible that this was causing other errors too, since it was a semi frequent gap in the input barrier. That's 2 somewhat tricky bugs taken care of today!

ushas

  • Hero Member
  • *****
  • Posts: 661
Re: NPC in Running animation loop
« Reply #10 on: October 19, 2017, 03:15:02 PM »
Great! Yeah, there were other issues related to enemies changing on hand items. I was definitely able to do all sort of things to them in that window of opportunity, like causing delaying up to 0 AP, etc. Not sure if all of them were reported properly. It was often in combination with other things. Apologies if not. For a moment it was a bit chaotic with EA prioritizing and so.

If understand properly, that input enabled there was the cause, then you possibly solved more tricky ones than 2 today!
Should I stress this window once more or is it better to leave it for V21 given the fix?

Can you recall if Ray had adjacent enemy?
Can't. Sorry. But it was a fairly open spaced map, so possible he hadn't.

stop clicking stuff
Stay tuned to super clicking!

Yeah, cut out a lot of frequent debug information because it's slowing down the game. You might have noticed a comment or two about improved performance in this build.
Might if wouldn't have been busy missing CTH lines of comfort... But yeah performance seems better!

Please do! You know how bug reports help my sense of inner calm :)
Not enough bad dreams lately?

Daithi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1250
Re: [Resolved] NPC in Running animation loop
« Reply #11 on: October 19, 2017, 03:44:01 PM »
There's nothing to gain from trying to break it at the minute. When you think that the player could put in game effecting input whenever the enemies were changing weapons, there are loads of possibilites for errors *shudder* - should be good now though.

Will be possible to make it run better, but there's a balance between removing debugs and hamstringing yourself in debugging. Mostly got rid of lines that occur with stuff like mousing over a new tile, and from the methods that are called very frequently (often dozens of times per second) by the AI in decision making. Actually, need to be honest: the real reason I took them out is because in V20, added a number of maths operations to randomly modify the CTH, sometimes get the square root of the actual CTH and use that, sometimes reduce it to the nearest prime number : )

ushas

  • Hero Member
  • *****
  • Posts: 661
Re: [Resolved] NPC in Running animation loop
« Reply #12 on: October 19, 2017, 04:22:29 PM »
Ha, I knew it! 
You may also print some lines in a bulk if beneficial. Keeping it in the memory for a while might not be a big deal. But I guess it comes with more management of the log structure. Dunno if worth.