Complex 2d sprite animation tools?

Discussion in 'Game Development (Technical)' started by Jamie W, Jul 14, 2009.

  1. Jamie W

    Original Member Indie Author

    Joined:
    Apr 16, 2006
    Messages:
    1,211
    Likes Received:
    0
    For complex 2d sprite animations, where objects are made up from multiple sub-sprites, just like in PopCap's Zombie Plants game.

    Are there any existing tools to put together these kinds of complex sprite animations or do people generally develop their own tools to create these?

    Thanks!
     
  2. Backov

    Original Member

    Joined:
    Oct 23, 2005
    Messages:
    812
    Likes Received:
    0
    I'm sure there must be at least one tool, but I rolled my own - it's not hard. Half a day in C# and you're sorted.
     
  3. Jamie W

    Original Member Indie Author

    Joined:
    Apr 16, 2006
    Messages:
    1,211
    Likes Received:
    0
    Yeah, I've done my own before too on GBA.

    I'll probably end up doing another one. Just wanted to research what's available before I do..

    Did you use your tool in any released games Backov?
     
  4. James C. Smith

    Moderator Original Member

    Joined:
    Aug 21, 2004
    Messages:
    1,768
    Likes Received:
    0
    I don't know if they used it for PvZ, but PopCap said that for Bookworm Adventures theydeveloped their own tools for import animations made in Flash. Flash does seem like the perfect tool for authoring content like this. But I don't know how easy it is to import it into your own engine.
     
  5. Backov

    Original Member

    Joined:
    Oct 23, 2005
    Messages:
    812
    Likes Received:
    0
    Nah, I've never released a commercial 2d game. :)
     
  6. JGOware

    Indie Author

    Joined:
    Aug 22, 2007
    Messages:
    1,578
    Likes Received:
    0
    Would be a killer tool if there was something universal for this. But problably better and more flexable in the long run to smok...I mean roll your own. ;)
     
  7. MFS

    MFS New Member

    Joined:
    Feb 28, 2007
    Messages:
    314
    Likes Received:
    0
    We rolled our own also - in C#. Added features like interpolation and stuff too. If you are interested, you can have the source for the tool and for the game side (uses PTK).
     
  8. Draice

    Draice New Member

    Joined:
    Nov 18, 2008
    Messages:
    31
    Likes Received:
    0
  9. Junkyard Sam

    Junkyard Sam New Member

    Joined:
    May 11, 2009
    Messages:
    292
    Likes Received:
    0
    Similar to what James C. Smith said --- I read an interview with the guy that designed PvZ and he was asked a similar question...

    Same thing. Sounds like they used Flash for the animation and found a way to extract the data for their own tools.

    It was a surprisingly effective technique! Even the designer said he had doubts about whether it would work at first, until he saw it in action.

    Another game that uses segmented animation like that is Track & Field on the iPhone, if you're looking for such reference...
     
  10. jpoag

    jpoag New Member

    Joined:
    Mar 15, 2008
    Messages:
    806
    Likes Received:
    0
    Well, here's the format for SWF (up to version 10):
    http://www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v10.pdf

    It's possible to skip tags that you don't want (or know how to) parse. Really, you need to parse the 'PlaceObject' (that contain matrices) tags for the images and save them to your own file format. That and match the dictionary CharacterIds with the images.

    Sounds like a weekend project to import animations.
     
  11. Backov

    Original Member

    Joined:
    Oct 23, 2005
    Messages:
    812
    Likes Received:
    0
    Sounds like a good idea. Flash is great for programmer art, but the export part is terrible.
     
  12. justkevin

    justkevin New Member

    Joined:
    May 22, 2009
    Messages:
    28
    Likes Received:
    0
    I don't think that's what you want. If you're trying to use Flash to generate sprites, what I think you want is to render the appropriate display object to a bitmapData object using BitmapData.draw(). You can then convert that to a bytearray, which will be a much more easily parsed format.

    To get the data out, you'll need to either send the data to a server, unless you've created your Flash app as an Adobe Air project, which will let you save directly:

    http://blog.everythingflex.com/2008/02/25/create-images-with-air-and-jpegencoder/
     
  13. jpoag

    jpoag New Member

    Joined:
    Mar 15, 2008
    Messages:
    806
    Likes Received:
    0
    Nope, you don't understand.

    • Your artist creates the sprites, your animator creates the SWFs.
    • You harvest the transformation data from the SWF for each image.
    • The header tells you the total number of frames and the frame rate.
    • The file consists of tag/length and data packets. When you read a tag/length combo that you don't want, you skip the next data packet the size of length.

    Really, what you are interested in is the 'Dictionary' tag where your assets are assigned an ID and PlaceObject/2/3 and RemoveObject/2/3. (and I guess ShowContent which marks the end of a frame).

    Bookworm Adventures 1 & 2 and PvZ all use the PopCap Anim tool (which strips the animation data from SWF). In bookworm adventures, they are called '.pam' filed and in PvZ they are '.reanim' (get it? reanimation?).
     
  14. justkevin

    justkevin New Member

    Joined:
    May 22, 2009
    Messages:
    28
    Likes Received:
    0
    Okay, I may have misunderstood the OP's goal. I was thinking that he wanted something like a sprite sheet with a pre-rendered alpha bitmap on each frame representing the final composite image for that character, object, etc.

    From your description, it sounds like what PvZ does is to assemble the sprite themselves using a lightweight swf parser. Which would have the advantage of being more compact and flexible, if more work.
     
  15. Jamie W

    Original Member Indie Author

    Joined:
    Apr 16, 2006
    Messages:
    1,211
    Likes Received:
    0
    Thanks everyone! :)

    Yes, jpoag (and others) have a clear idea of what I'm after.

    The question is, to work with data exported from something like Flash, or to roll my own tool. I'm still researching..
     
  16. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    Depending on the functionality you want, you might had the tool already done by now :p

    I thought about making such a tool at some points, but never got around to do it. I'll give a shot on making something similar to Mapas but for hierarchical 2D animations :).
     
  17. gmcbay

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    280
    Likes Received:
    0
    If you want to work with Flash data you might want to consider the hybrid approach of writing your sprite tool in Flex/ActionScript 3. That way you can work with Flash .swf files without having to deal with actually parsing the swf files yourself and it is trivial to take this flash data and flatten it out into bitmaps (with associated metadata for things like attachment points or whatever) for making traditional sprite sheets for export from inside of the Flex app.

    Flex also has a pretty robust UI control library, so knocking up a UI for your tool in it should be very easy. The con is you'll have to learn ActionScript 3 if you don't already know it, but it is a very simple language to pick up if you come from a C-language background (C, C++, Java, C#, especially JavaScript, etc).
     
  18. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    haXe has a "format" library which supports reading and writing to several kind of file formats, including SWF. Since its written by Nicolas Cannasse who also made haXe i suppose it is very complete as a library and if you want to go the SWF parsing route (i wouldn't btw), you may want to check hxFormat out.
     
  19. electronicStar

    Original Member

    Joined:
    Feb 28, 2005
    Messages:
    2,068
    Likes Received:
    0
    What a bout a good old 3d modeller?
    Blender could do the trick.
     
  20. Jamie W

    Original Member Indie Author

    Joined:
    Apr 16, 2006
    Messages:
    1,211
    Likes Received:
    0
    Argh! Blender!

    Afraid I'm a fully signed-up member of the "we hate Blender's user interface" club. :p

    I'm pretty much set now, on going the roll-your-own route.

    Though capturing the output from something like this for play-back in a game would have been super awesome. I'm sure quite possible to too, just, probably over-kill for my own requirements.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer