• Advertisement
Sign in to follow this  

How to pack your assests into one binary file (custom file format etc)

This topic is 1264 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I really know next to nothing about this topic, for example I have a commerical game here, it has one exe, one music.img and one data.img file and a couple of ini files etc, now these are not img files in the sense of mountable packed image files like iso, img, dmg rather I am assuming the developer just picked the extension img as a general file extension.

 

So these two files have all the assests stored in them, music, maps, textures, strings, etc, obioulsy in binary format. So how is this done, how to you package a bunch of file assests into one binary file like this, and why don't all devs do this, for example take a pk3 file which can obvioulsy be opened with winrar, so all the assests are available to see.

 

Any example, links or knowledge here?

Share this post


Link to post
Share on other sites
Advertisement


... So how is this done, how to you package a bunch of file assests into one binary file like this ...

As Rob has mentioned, the solutions are numerous. The custom package file format I use has some header, followed by a table of content, followed by so-called load units, followed by streamable data.

 

The table of content has an entry for each single resource stored within the package. Each entry also stores the relative address and length of the load unit which contains the resource. A load unit may contain a single resource or a couple of resources. The latter is called a "bundle" and itself has a kind of table of content with back references to the package table of content. Bundles are fine for resources that should be loaded together (e.g. all the meshes and textures of a model). The resource is at least the description of what it is, but may also contain the resource data. If not, or if only partly, then the resource data or additional resource data is placed as streamable data towards the end of the package file. For example, textures may be stored with the low levels of detail embedded and the high levels of detail as streaming data elsewhere.

Share this post


Link to post
Share on other sites

How about you put all of those into a zip using the zlib ? it has one of the best licenses over in the wild; and maybe it just solves exactly your packing problem, and provides compression as a cherry on top of the cake.

Share this post


Link to post
Share on other sites

A windows-only solution is to use resources (.rc files) and access
then with FindResource(); LoadResource(); LockResource(); calls.

 

I don't think anyone would want to run a 4GB executable file, as resources can be huge.

Today's PC games are 64-bit and can have resources over 30 GB.  But, my Internet connection hasn't changed, so I spent a week
just downloading it!
 

Share this post


Link to post
Share on other sites

A windows-only solution is to use resources (.rc files) and access
then with FindResource(); LoadResource(); LockResource(); calls.

 
I don't think anyone would want to run a 4GB executable file, as resources can be huge.
Today's PC games are 64-bit and can have resources over 30 GB.  But, my Internet connection hasn't changed, so I spent a week
just downloading it!

Ah I didn't know you were working on such a massive game. Resources can be spread over lots of dll's too. Some dll's are used for this very purpose and don't even have code.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement