0

I am looking to finish my C++ game and package its resources such as images, sounds etc into a custom file format, so users can't decode it. I was hoping if anyone could shed some light on this. I have researched and found that creating custom binary file format is the way to go, but no one has described how to do it.

I would like to package images and and other files into the File format, and during runtime use the resources from within it. Is this possible?

halfer
  • 18,701
  • 13
  • 79
  • 158
  • Take a look at the design of something like `tar` and make up a variant on it. – user3553031 May 10 '14 at 11:39
  • thanks am looking, it would be great if theres a link on a tutorial on how to do it? – user3128725 May 10 '14 at 11:48
  • Please read c++ FAQ section about serialization. it discusses lot of things you should consider. http://www.parashift.com/c++-faq/serialization.html – Öö Tiib May 10 '14 at 13:35
  • 1
    What you are looking for is serialization. Take a look at this answer: http://stackoverflow.com/a/5420568/193789 . This is also a good start: http://www.ocoudert.com/blog/2011/07/09/a-practical-guide-to-c-serialization/ – kebs May 10 '14 at 13:36
  • Thank you guys, It helps a lot, ill get started on serialization ASAP. @kebs the links are very useful thankyou – user3128725 May 10 '14 at 13:43
  • For large amount of assets I would suggest to use some pre-existing format, either a password-protected archive or a virtual filesystem (such as CodeBase file system or our SolFS). – Eugene Mayevski 'Callback May 10 '14 at 15:11

1 Answers1

0

Necroing because this question is what pops up if you search for such info.

I would suggest reading up on the Interchange File Format (IFF), which is where we get RIFF, TIFF, and many other binary file formats from: http://en.wikipedia.org/wiki/Interchange_File_Format The original Electronic Arts spec for the format is very interesting reading, and I recommend it to anyone thinking of designing their own binary file format: http://www.martinreddy.net/gfx/2d/IFF.txt IFF files have the benefit of being very robust: chunks can be stored in any order, new chunk types can be added that your app doesn't know how to handle, and yet it is simple to write a reader that will parse the file without error.

Darren
  • 237
  • 1
  • 9