Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to make a simple 2D animation file format. It'll be very rudimentary: only an XML file containing some parameters (such as frame duration) and metadata, and some images, each representing a frame.

I'd like to have the whole animation (frames and XML document) packed in a single file. How do you suggest I do that? What libraries are there that would allow easy access to the files inside the animation file itself?

The language I'm using is C++ and the platform is Windows, but I'd rather not use a platform dependent library, if possible.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I'd suggest packing them into a simple .zip archive; there are several libraries out there (a good one using the minizip function of ZLib is discussed here). That way, you'll have an XML file uncluttered with other embedded information, and then all the graphics resources out in their own files inside the archive. This might also allow for better compression of the binary data (very unsure about this).

share|improve this answer
    
Note that ZLib is cross-platform, and that it is well tested. I really think that this is probably the easiest solution in your case. In the XML file, use relative paths, i.e. "/walking/frame1.tga", and then have the loading code handle those in the archive. Shouldn't be more than 10-20 lines at the most for that. You might also want to consider using big sprite sheets for families of animation. –  ChrisE Mar 19 '11 at 20:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.