How to pack game resources?

Started by
6 comments, last by GameC++Expert93 11 years, 6 months ago
I've only recently gotten into game programming, but one thing is bothering me a lot. The way I'm packaging my games is desgusting to say the least, everything is in 1 folder, it's like a file soup.

I want to get this question out there, with hope that a very experienced game developer will supply me with a sollution. What I want to do is, pack all the game assets in 1 file which I can very easily read from and add to. I was thinking of using a ZIP archive for this, or ideally use a .PAK archive where I simply add all my assets and map files there.

How can I do this? If you will suggest a framework/API please also tell me how to use it, I'm a total beginner with library linking and library building, I've never done it.
Advertisement
For this kind of thing I use PhysFS. Basically everything goes in a zip file that I rename with a different extension.

For this kind of thing I use PhysFS. Basically everything goes in a zip file that I rename with a different extension.

I wanted to use PhysFS too initially, but I've been struggling forever to install it. could you check out this question? It would help a lot if an actual PhysFS user would pop a good answer for me. Thanks in advance smile.png
Why is it necessary to pack everything into a single file? You could simply organize your resources into their appropriate directories. Sounds should be in sounds, images in images, fonts in fonts, etc.

+---------------------------------------------------------------------+

| Game Dev video tutorials -> http://www.youtube.com/goranmilovano | +---------------------------------------------------------------------+

Why is it necessary to pack everything into a single file? You could simply organize your resources into their appropriate directories. Sounds should be in sounds, images in images, fonts in fonts, etc.


Well first of all I'd have to put the executable where the images are, second of all in an archive they are compressed & organized (fonts in fonts, images in images, etc) second of all because I haven't seen any games except LDW games that leave their resources to the open eye in 10 years of gaming and I simply consider it unprofessional to do so, but then again it's simply my oppinion, a zip file is like a folder structure, it's very organised but instead is cleaner, and the game can be modded just as easy. :)
You would not if you have the references right.

LoadFromFile("Images\\myImage.jpg")
LoadFromFile("Sounds\\mySound.wav")
etc.

Edit Lots of games potentially reveal their resources, just in formats you aren't used to seeing.
As mentioned just organize them into files then set your references correctly in your code to point to the different folders like sounds,images etc..
As mentioned just organize them into files then set your references correctly in your code to point to the different folders like sounds,images etc..

This topic is closed to new replies.

Advertisement