View Issue Details

IDProjectCategoryView StatusLast Update
0004012The Dark ModAnimationpublic01.02.2015 22:45
Reportergrayman Assigned ToSteveL  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.03 
Target VersionTDM 2.03Fixed in VersionTDM 2.03 
Summary0004012: Sitting guard in Old Habits 2 can't get up
DescriptionSpringheel says:

Found another problem with a sitter.
 
Walked into an area in Old Habits II and saw a guard sitting on a bench. His torso seems to be playing the animation for getting up, repeatedly, but his legs aren't moving.

Savegame attached.
Steps To Reproduce1.Find a sitting AI and wait for them to start playing an idle animation that contains an embedded frame command to sync the legs with the torso. -- idle_sit_shift1 will do
2.Save the game just after they start to play the anim.
3.Reload your save game and they'll be stuck.
TagsNo tags attached.

Relationships

related to 0003800 resolvedSteveL anim tasks (path anim, path cycle anim, play anim) snap in without blending 
related to 0004050 resolvedSteveL More riverdancing 
related to 0004076 resolvedSteveL Final riverdancing 

Activities

grayman

grayman

04.01.2015 16:20

viewer  

quicksave.save (1,823,381 bytes)
SteveL

SteveL

04.01.2015 16:26

reporter   ~0007300

Last edited: 04.01.2015 16:57

Taking a look...

I can't load the save game. I've asked Springheel to describe which AI it was if he can remember. If I can identify him I can try to get some information about his status from the save game.

grayman

grayman

10.01.2015 21:32

viewer   ~0007328

There's a savegame in issue 4023 from Oldjim about a freeze in Deceptive Shadows: http://bugs.thedarkmod.com/view.php?id=4023.

If you wait for the fix to 4023 to get into the next beta package, the freeze will be fixed, and the savegame should still be usable for investigation.
SteveL

SteveL

10.01.2015 21:45

reporter   ~0007330

Is that relevant to the sitters?

Oldjim already gave me a save game for sitters who can't get up and I traced it to the legs anim script having exited and stopped running completely. I didn't get any further with the investigation yet because the floating-point problem reared its head the same evening that I got those results.
grayman

grayman

10.01.2015 22:14

viewer   ~0007332

Sorry, I forgot the details of why I pointed you to the savegame. (Duh!)

It's relevant because Brother Warren (a Priest), in the hallway off where you start the savegame, is stuck on his bench, trying to get up.
SteveL

SteveL

19.01.2015 13:44

reporter   ~0007353

Stuff that's conspiring to mess it up

1.Turns out there are two ways to make anims play on both legs and torso, and they can conflict:
- IdleAnimationTask uses a distinct Anim State for legs when it wants an anim to play on both legs and torso, Legs_CustomIdleAnim, which syncs the legs to what the torso is doing, then waits for the anim to complete. This code was there in 2.02 and before, but it got activated for sitting AI in 2.03 with 0003914: "Let sitting idle anims play on all channels"
- The animation Frame Command "overrideLegs" achieves the same effect by temporarily disabling anim scripts on the legs, then syncing the legs to the torso's animation. The next time either torso or legs changes anim state both channels are re-enabled.

2.The Legs_CustomIdleAnim and Torso_CustomIdleAnim scripts don't pass control to any other anim state if they get called without being given an animation to play. They just quit, leaving that part of the body paralysed.

3.Save games don't restore the name of the currently playing idle anim. (idActor::m_NextIdleAnim). It's not needed in normal situations, because it's only supposed to be used in the same frame where it gets set, and because the animator itself remembers what anim was playing and restores it after a reload. However, save games *do* restore whether or not an anim channel has been temporarily disabled by a frame command.
 
What happens
 •The IdleAnimationTask code sets the AI's "NextIdleAnim" to a sitting idle anim, and switches the AI to the CustomIdleAnim state on both legs and torso.
 •The CustomIdleAnim script checks "NextIdleAnim" to find out what anim to play, starts it, then makes the legs sync to what the torso is doing.
 •The frame command "overrideLegs" from the animation kicks in and again syncs the legs to what the torso is doing. It also disables the legs anim script.
 •The player immediately saves and reloads the game. The anim name in "NextIdleAnim" is lost, but the setting that says that the legs scripts are disabled is remembered.
 •The torso script finishes and changes the torso's anim state to Torso_Idle. That state change re-awakens the legs anim script.
 •The legs anim script restarts the Legs_CustomIdleAnim state, which tries to read the "NextIdleAnim" again, but it's empty following the save game restore.
 •The legs anim script quits, leaving the legs paralysed.
 •The guard will get stuck in a loop trying to get up. If you alert him, he'll get stuck alternating between searching and suspicious states. Something caps his alert level. I've not checked out what exactly, because the root of the problem is already clear.
SteveL

SteveL

19.01.2015 13:46

reporter   ~0007354

Last edited: 19.01.2015 13:46

I'm testing a fix: switch IdleAnimationTask to using the same method of syncing legs to torso that's used by the frame commands: Event_OverrideAnim

That'll avoid conflicts between the game code and the animation frame commands.

I probably need to do this for the relevant path entities too.

SteveL

SteveL

19.01.2015 21:13

reporter   ~0007359

Testing commenting out these scripts: Legs_CustomIdleAnim, and Legs_CustomAnim. Both are initiated by an anim on the torso, and (I hope/expect) both should use Event_OverrideAnim instead.
SteveL

SteveL

20.01.2015 00:14

reporter   ~0007360

The fix above works ok, but has a slight conflict with 0003800 which used the scripts to add blending to sync the legs with the torso and stop anims "snapping" in instead of blending. The overrideAnim script event comes with it's own blend setting: idAnimState::lastAnimBlendFrames. I need to add that to the fix and re-check my test maps tomorrow.
SteveL

SteveL

20.01.2015 20:44

reporter   ~0007361

Last edited: 20.01.2015 20:44

Splitting this into 2 commits, independently revertible. They both work in both my anim test maps, the new one and the one I did for 0003800, but I can't test everything.

First commit: changes for AI stuck in seats only. 2 lines, one each in Actor.h and IdleAnimationTask.cpp.

@rev 6453

Second commit: same fix for PathAnimTask, PathCycleAnimTask, and PlayAnimTask (for conversations). Also commented out the "Legs" versions of the two custom anim AI scripts, which are no longer needed if we're using overrideAnim instead of asking the scripts to try to stay in sync. Also removed a couple of lines in MovementSubsystem.cpp which no longer needs to monitor both legs and torso. It can do just Torso.

@rev6454 (code) and rev14203 (scripts)

SteveL

SteveL

28.01.2015 08:51

reporter   ~0007395

This wants an extra commit: before the legs channel is synced to the torso by the game code, it should be put into anim state 'Legs_Idle' so that when it wakes up again it starts the idle script to pick its next course of action, instead of restarting its last known state. This will imitate the intended behaviour of PlayAnimationOnceWithSync, which took the succeeding state as a parameter.
SteveL

SteveL

28.01.2015 09:17

reporter   ~0007397

Rev 6467:

Further commit for 0004012. Reset legs anim state to Legs_Idle before syncing to torso, so that a sensible state shows up in debugging tools, and so the scripts pick up in a good spot if no succeeding anim state takes over before the legs are re-enabled. Also remove an unnecessary 1-frame delay before the sync.

Issue History

Date Modified Username Field Change
04.01.2015 16:20 grayman New Issue
04.01.2015 16:20 grayman Status new => assigned
04.01.2015 16:20 grayman Assigned To => SteveL
04.01.2015 16:20 grayman File Added: quicksave.save
04.01.2015 16:26 SteveL Note Added: 0007300
04.01.2015 16:57 SteveL Note Edited: 0007300
10.01.2015 21:32 grayman Note Added: 0007328
10.01.2015 21:45 SteveL Note Added: 0007330
10.01.2015 22:14 grayman Note Added: 0007332
19.01.2015 13:42 SteveL Steps to Reproduce Updated
19.01.2015 13:44 SteveL Note Added: 0007353
19.01.2015 13:46 SteveL Note Added: 0007354
19.01.2015 13:46 SteveL Note Edited: 0007354
19.01.2015 21:13 SteveL Note Added: 0007359
20.01.2015 00:12 SteveL Relationship added related to 0003800
20.01.2015 00:14 SteveL Note Added: 0007360
20.01.2015 20:44 SteveL Note Added: 0007361
20.01.2015 20:44 SteveL Note Edited: 0007361
20.01.2015 20:45 SteveL Status assigned => resolved
20.01.2015 20:45 SteveL Fixed in Version => TDM 2.03
20.01.2015 20:45 SteveL Resolution open => fixed
20.01.2015 20:51 SteveL Relationship added related to 0004050
28.01.2015 08:51 SteveL Note Added: 0007395
28.01.2015 09:17 SteveL Note Added: 0007397
01.02.2015 22:45 SteveL Relationship added related to 0004076