GMS 2 Optimizing SWF Animation (Animate export/GAF)

Discussion in 'Advanced Programming Discussion' started by Trasoside, Oct 10, 2018.

  1. Trasoside

    Trasoside Member

    Joined:
    Jun 25, 2016
    Posts:
    24
    *In short, this topic is simply for those who want to stick with Adobe Flash/Animate (instead of spine)*

    Alright so, me and my team were working on a huge project with tons of swf content made in flash (for mobile devices).
    At the beginning, we just exported everything from flash to png, loaded it as sprites in GM, and it worked just fine.
    the CONs in doing so are:
    -final apk size becomes huge. (over 100mb)
    -all sprites are automatically loaded into ram when game is opened (over 200mb)
    -loading big animations/backgrounds takes tons of time. (solved by sprite_prefetch, but still causes game to lag)
    -managing all these sprites is hell, sometimes, we'd rather put 1 sprite in 1 texture group, so all it's images will end up on the same texture page.

    of course, all these cons could be solved by simply using spine (well spine has it's cons too..). but our animators knows only flash and all animations were already done in flash.
    we tried using the SWF option GMS offers, but final result is just bad, (for example, black outlines surrounds swf vectors? + it doesn't looks like it is very efficient in terms of cpu/gpu usage)
    swf bug example:
    upload_2018-10-10_5-36-18.png instead of : upload_2018-10-10_5-36-39.png

    anyways, what I'm trying to say is, that the current SWF option GMS offers, is not ideal, and there are few alternatives out there that I've found, instead of drawing vectors real time, they convert vector objects to pngs, order them in a texture page, and exports additional data to read them from that texture page and draw them correctly. I think this method might be even faster than spine, because it's just data of frames and doesn't seems like it uses bones/ease logic.

    this image can sum up the idea:
    [​IMG]

    here are 2 tools I've tested that can make such thing:
    a) first one is "Generate Texture Atlas" in Animate CC which exports a texture page, together with spritemap.json (to map the texture page) and animation.json (to map the animation frames) both are kinda readable.

    b) second one is "GAF" , i tried testing this tool and it looks like it does simply the same thing as the "generate texture atlas" (maybe offers some better optimizations?-not sure about that yet). it exports a texture page, combined with a .gaf file (binary file that contains both sprites data and animation data)

    both tools already supports engines such as Unity, Starling, Cocos etc.

    So, for the moment. I have a few questions:
    1) Did anyone find an efficient way to play swf animations properly in GM?
    2) How possible do you guys think it is to implement one the alternatives I've found above? maybe we as a community can come up with a solution?
    3) I've tried searching google for ways to export from flash and import to spine, but it doesn't seems like they want to support it, if anyone ever succeed to to do something like it and can share his experience, it might be super appreciated and helpful. even Dragon Bones or Spriter flash import can be useful.

    sorry for the long text. hopefully this discussion will lead to something epic and help many others on the way.
    any piece of info is appreciated. thanks. Rom
     
  2. sylvain_l

    sylvain_l Member

    Joined:
    Sep 18, 2016
    Posts:
    661
    OK, wrong assumption : GM doesn't support native swf.

    all it does is translate the information into a - I assume - kind of vertex buffer. With one basic GM timeline (or something else).

    that means all curves are translated into polylines which means you require a lot of point to have something that resemble to a circle. Or any curve.

    does only support 1 timeline (if you use multiple to handle your swf animation you'll run into problem)
    and of course doesn't support any actionscript

    also GM doesn't handle well gradient
    same goes for most advanced feature (variable outline boldeness, etc... I'm pretty sure too advanced animation feature certainly are not all supported.)

    so if you dreamed of making wonderfull flash anim and import them "as is"; not going to happen, you'll have to adapt your workflow and art style to what GM support. sorry.
    Or move to unity.^^

    p.s.
    me too would have loved to see spine support vector graphic but's not on their calendar :(

    p.s.2 I think you already read it:
    https://docs2.yoyogames.com/source/...information/importing_non_bitmap_sprites.html
     
  3. Trasoside

    Trasoside Member

    Joined:
    Jun 25, 2016
    Posts:
    24
    Hi thanks for the info, thing is I don't mind if the animation won't be drawn as vectors, as long as it draws properly. Thats why I suggested gaf and animate export atlas option. So we could play our flash animations properly in gm. The results these tools gave me were perfect. Just need to figure out a way to play them in gm.
     
  4. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,888
    People have done an extension for Spriter (other skeletal animation tool) in past so likely possible - a matter of someone with enough experience being able to devote enough time to the matter.

    You can also take a look at DragonBones - it can import animations from Flash and IIRC can export to Spine format, which would allow you to play them in GM.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice