View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003800 | The Dark Mod | Animation | public | 27.07.2014 14:27 | 20.01.2015 00:12 |
Reporter | SteveL | Assigned To | SteveL | ||
Priority | normal | Severity | normal | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | TDM 2.02 | ||||
Target Version | TDM 2.03 | Fixed in Version | TDM 2.03 | ||
Summary | 0003800: anim tasks (path anim, path cycle anim, play anim) snap in without blending | ||||
Description | path_anim snaps to the first frame of the animation without any blending of current animations. The blend_in spawnarg isn't used until after the animation has started, so it has no effect. | ||||
Additional Information | PathAnimTask makes use of the script event playAnim but it works a bit differently from general script-fired animations. Scripted animation tasks do it this way: • call the animState script event to start the animation • animState sets a variable to store the desired blend frames for the next animation, and it puts the AI scripts in a "wait" state so that the scripts don't play idle anims over the requested anim • it then passes control back to the AI scripts • which then call playAnim • which checks the variable set by animState to find out how many frames to blend over, and plays the animation • Afterwards, it zeroes out the variable that says how many blend frames to use, ready for the next animState PathAnimTask does things in a different order: • It calls playAnim *first* before setting the blend frames variable, which will still be sitting at 0 • It then calls animState as usual so that idle anims do not override the requested anim • animState sets the right number of blend frames, but too late to affect the path animation We can't just muscle in and have PathAnimTask set the variable itself. That variable is private to the animState. And we can't simply switch the order of the first two events above: the wait state won't last unless the anim is already playing. Need to look for other options. One would be for animState to provide a method for setting the "blend frames" variable directly, but there might be more elegant ways to fix it. | ||||
Tags | No tags attached. | ||||
[untested] PlayAnimationTask and PathCycleAnimTask have the same set-up and probably share the problem |
|
Best fix is to move the job of starting the animation from the c++ code to the ai AnimState scripts, ai_darkmod_base::Torso_CustomAnim and Legs_CustomAnim. The other AnimState scripts all start their own animations, which is why they can do the things above in the right order. Nothing else uses those script functions. These tasks can use the same setup. | |
These scripts (ai_darkmod_base::Torso_CustomAnim and Legs_CustomAnim) are used only by those 3 tasks in the Game c++ code. No scripts in the core mod or published maps use them. To implement this fix, the scripts need to know what anim to play, but those tasks use different spawnargs and have their own record of what to play. So to minimise disruption to the existing setup I propose to get the tasks to set 2 keys on the Actor, specifying the required anim and whether to cycle, and the script events will read those keys. The other animState scripts interpret spawnargs to find out what to play too. PlayAnimationTask is used by conversations, and the state subsystem. I'll use a conversation in the test map. |
|
Hmm blend_in not being used isn't the whole of the story. Something is actively kicking the animation out of kilter for the path anim tasks but not the play anim task. | |
The second bug is that the legs channel is being sync'd to the torso by the two path tasks without any blending. That means that if the legs are playing a different anim from the torso when the task starts, the legs anim is being lost in a single frame. | |
A side-effect of this fix should be that scripts will finally be able to play anims without those anims getting interrupted by idle or patrolling anims, by setting the keys and calling AnimState(ANIMCHANNEL_TORSO, "Torso_CustomAnim", 12); etc. Wants testing then wrapping in a more user-friendly script function. |
|
A problem with the fix: frame commands are now being called on both anim channels. Sync'ing the anims channels is supposed to take care of that. |
|
The sync is happening before the animations are starting, because the AI scripts post PlayAnim as an event, and the c++ code is running the sync before the events get processed. Putting the call to SyncAnimChannels on the event queue with zero ms delay doesn't work -- it still gets processed before the PlayAnim events. Giving it 16ms (1 frame) delay works 80% of the time, but it can still fail. And it risks a double-call of a frame command for any anims that have a command in the first frame. |
|
Moving the Sync call to the scripts doesn't help. Still getting duplicate frame commands, saying to destroy attachments spawned by an anim. Either script events can fire out of sequence, or something else is intervening to re-enable the frame commands on the legs channel. None of the script events seem to do a deferred hand-off. UPDATE: the commands probably aren't out of sync. The second option was true: something else was fiddling with the setting: |
|
It was the new AI LOD transition causing the duplicate frame commands. Testing this issue has revealed a subtle bug in the animated LOD setup: the LOD code does a model swap and restores same-named anims at the right frame, if the md5 skeletons are compatible. But it needs to restore more than that: whether or not an animation is allowed to fire off frame commands, for example. That parameter is private to idAnimBlend right now, so I've added an accessor FrameCommandsAllowed() so that the LOD code can see it and restore it. I'll add a child issue to the AI LOD tracker to add a LOD copy method to idAnimBlend, so we can transfer the rest of the flags with LOD too. I suspect most are not used, but even if so they might be in future. |
|
Committed at rv6094 (code) rv13974 (script, binaries) | |
Date Modified | Username | Field | Change |
---|---|---|---|
27.07.2014 14:27 | SteveL | New Issue | |
27.07.2014 14:27 | SteveL | Status | new => assigned |
27.07.2014 14:27 | SteveL | Assigned To | => SteveL |
27.07.2014 14:28 | SteveL | Description Updated | |
16.08.2014 06:18 | SteveL | Note Added: 0006852 | |
16.08.2014 06:26 | SteveL | Note Added: 0006853 | |
16.08.2014 06:27 | SteveL | Note Edited: 0006852 | |
29.08.2014 18:10 | SteveL | Note Added: 0006903 | |
29.08.2014 18:32 | SteveL | Note Edited: 0006903 | |
29.08.2014 23:32 | SteveL | Note Added: 0006906 | |
30.08.2014 12:10 | SteveL | Note Added: 0006908 | |
30.08.2014 12:13 | SteveL | Note Added: 0006909 | |
30.08.2014 12:15 | SteveL | Note Edited: 0006909 | |
30.08.2014 13:19 | SteveL | Note Added: 0006910 | |
30.08.2014 15:27 | SteveL | Note Added: 0006911 | |
30.08.2014 18:05 | SteveL | Note Added: 0006912 | |
30.08.2014 18:06 | SteveL | Note Edited: 0006912 | |
31.08.2014 03:03 | SteveL | Note Added: 0006915 | |
31.08.2014 03:06 | SteveL | Note Edited: 0006912 | |
31.08.2014 03:14 | SteveL | Relationship added | related to 0003770 |
31.08.2014 04:11 | SteveL | Summary | path_anim does not use blending => anim tasks (path anim, path cycle anim, play anim) snap in without blending |
31.08.2014 04:15 | SteveL | Note Added: 0006916 | |
31.08.2014 04:16 | SteveL | Status | assigned => resolved |
31.08.2014 04:16 | SteveL | Fixed in Version | => TDM 2.03 |
31.08.2014 04:16 | SteveL | Resolution | open => fixed |
10.09.2014 19:19 | SteveL | Relationship added | related to 0003597 |
20.01.2015 00:12 | SteveL | Relationship added | related to 0004012 |