• Runtimes
  • [AS3] Non-Starling FlashDevelop Jerky Animation

Related Discussions
...

I am having an issue with very jerky animations once it is published. I am using Flash Develop for a non-Starling target.

When I publish, the resulting .swf plays all the slow animations with jerky movement, as if it is missing frames or it's trying to catch-up.

However, when publish my Starling files, it works fine. I must have a setting I am missing on the Spine EXPORT or something.

Any help is much appreciated! ChzBoi

Could you tell me what the non-Starling target is? Just regular old Flash?

Starling does a lot of optimizations under the hood, I'd assume that'd be the reason why you don't see jerkiness there.

Hi badlogic - correct, just plain old AS3. My understanding is that there are only 2 AS3 Runtimes : normal and Starling. I've been using the Starling without issues, but this current project needs to be done in normal AS3.

I've double checked all I can think of, yet, the slow (15 sec idle animation) stutters, jerks, lags when I call for the animation to play:

var tmpTE:TrackEntry = SK_VTop_Fauna.state.setAnimationByName(0, "IDLE1", true);

I've also set the quick animations (2 seconds or less) with

tmpTE.timeScale

value set to some small value - they also will do the stutter/jerky movement.

Very perplexing. :wonder:

I'm not a plain old AS3/Flash expert myself, but what you describe seems to be a framerate and/or garbage collection issue. Meaning it's unlikely to be an export issue.

To further diagnose this, could you create a simple Spine skeleton in the editor (single region attachment) with a simple animation (e.g. moving from left to right and back) and try that out on your end? If this also stutters, then the root cause should be more easily identifiable.

Also, I've found that running AS3 code in debug mode can lead to extremely bad framerates. Maybe you could also try running it in release mode and see if that changes anything.

The Flash and Starling runtimes both use the same core code for the Spine skeleton calculations. Since Starling works fine, I'm ruling out any performance issues in that part of the code.

Thanks badlogic for the info - I did make a few simple tests. Any slow animation has this issue, debug or release. My entire code is 45 lines long, which I have copied below.

I am thinking this has gotta be a FlashDevelop publish setting I am missing.

UPDATE : Tried this same code in the Animate IDE - still stutters.


package
{
   import spine.animation.TrackEntry;
   import flash.display.Sprite;
   import spine.flash.SkeletonAnimation;

   import spine.*;
   import spine.animation.AnimationStateData;
   import spine.atlas.Atlas;
   import spine.attachments.AtlasAttachmentLoader;
   import spine.flash.FlashTextureLoader;

   [SWF(width = "1000", height = "500", frameRate = "60", backgroundColor = "#dddddd")]
   public class Main extends Sprite {
      
[Embed(source = "/AS3_Speed_Stutter_TEST.atlas", mimeType = "application/octet-stream")] static public const AS3_Speed_Stutter_TESTAtlas : Class; [Embed(source = "/AS3_Speed_Stutter_TEST.png")] static public const AS3_Speed_Stutter_TESTAtlasTexture : Class; [Embed(source = "/AS3_Speed_Stutter_TEST.json", mimeType = "application/octet-stream")] static public const AS3_Speed_Stutter_TESTJson : Class; private var SK_AS3_Speed_Stutter_TEST:SkeletonAnimation public function Main() { var Atlas_AS3_Speed_Stutter_TEST : Atlas = new Atlas(new AS3_Speed_Stutter_TESTAtlas(), new FlashTextureLoader(new AS3_Speed_Stutter_TESTAtlasTexture())); var JSON_AS3_Speed_Stutter_TEST : SkeletonJson = new SkeletonJson(new AtlasAttachmentLoader(Atlas_AS3_Speed_Stutter_TEST)); JSON_AS3_Speed_Stutter_TEST.scale = 1; var SkeletonData_:SkeletonData = JSON_AS3_Speed_Stutter_TEST.readSkeletonData(new AS3_Speed_Stutter_TESTJson()); var StateData_AS3_Speed_Stutter_TEST : AnimationStateData = new AnimationStateData(SkeletonData_); SK_AS3_Speed_Stutter_TEST = new SkeletonAnimation(SkeletonData_, StateData_AS3_Speed_Stutter_TEST); SK_AS3_Speed_Stutter_TEST.x = 500; SK_AS3_Speed_Stutter_TEST.y = 225; var tmpTE:TrackEntry; tmpTE = SK_AS3_Speed_Stutter_TEST.state.setAnimationByName(0, "IDLE1", true); addChild(SK_AS3_Speed_Stutter_TEST); } } }

Your code looks unsuspicious. I've tried to reproduce this on my end and couldn't see an issue. Could you maybe send me your test project? FWIW, I'm using FDT instead of FlashDevelop. Maybe that passes different compilation/runtime flags.

Thank you for the project, I was able to reproduce the issue. However, I'm not sure what is causing it :/

The frame rate is set to 60fps. The SkeletonAnimation class gets a delta time of 0.016 seconds (16ms == 60fps) each frame, so that's correct too. But for whatever reason, the two graphics in your skeleton do not move smoothly. I'm a bit at a loss why that is. I suspected integer drawing positions to be the culprit, but those are correct (fractional) as well.

At the moment I'm not quite sure what else I could look into. I'll try to come up with something.

Morning badlogic - good to know I am not losing my mind! Thanks for looking into this.

If you need me to test anything, please feel free to ask. I've tested in FlashDevelop changing the

tmpTE.timeScale

value to extreme high and low values - it seems to interpolate abruptly regardless of that setting.

Yes, I have to played around with various timing related pieces of code as well, but I simply can not figure out where the stutter is coming from. The frame rate is constant, the drawing coordinates are correct. The Flash player must do something funny, but I can't for the life of me figure out what it is.