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.

As I am in the process of creating a 3D c++ game and I was wondering what would be more beneficial when dealing with game assets with regards to storage. I have seen some games have a single asset file compressed with everything in it and other with lots of little compressed files.

If I had lots of individual files I would not need to load a large file at once and use up memory but the code would have to go about file seeking when the level loads to find all the correct files needed.

There is no file seeking needed when dealing with one large file, but again, what about all the assets not currently needed that would get loaded with the one file?

I could also have an asset file for each level, but then how do I deal with shared assets

This has been bothering me for a while so tell me what other advantages and disadvantages are there to either way of doing things.

share|improve this question
7  
Even with one big file, you dont load everything into memory, you just load it from file when you need it. –  Kikaimaru Nov 26 '12 at 23:30

3 Answers 3

up vote 8 down vote accepted

From both performance and storage points single resource file is more beneficial solution (however in practice it's not always really noticeable). The drawback is that it's harder to update and manage.

IMO it's not that important usually, just use that is more convenient for you, it's really just a technical detail that should not be considered until you really notice some problems with it.

share|improve this answer
6  
+1, Do what's easiest from a developer standpoint until it proves to cause an issue –  John McDonald Nov 27 '12 at 5:25

Unpacked files make it easier for the user to edit and replace files, making the game much more modding-friendly. This can be seen as an advantage or disadvantage, depending on your attitude towards modding.

From a performance-perspective: Loading a lot of small files from the hard drive can be a lot slower than a single, large one, because the defragmentation of a filesystem will usually try to avoid splitting large files, but a lot of small files in the same directory can be scattered all over the disk. So when you load thousands of small files, the drive might have to do a lot of seeking. But on the other hand, using archives might make it more costly to get individual files from inside the archives (depending on how your archives are structured internally), so you should try to group files which are usually needed together.

From a maintainance perspective: Unless you have a tool to do incremental updates to your packet files, your patches will get a lot larger when you have to replace whole packages to patch an individual file.

share|improve this answer
    
+1 for remembering modding advantage. –  Omokoii May 21 '13 at 15:43

Typically a package would be faster, however it is not always as convenient, as Petr said. One way to combat that however is to make your engine able to load loose files and pack files. Then, in debug mode, load loose files, and in release mode, load from a pack

share|improve this answer

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.