Jump to content
  • Advertisement
Sign in to follow this  
Cactuar

Packing game resources?

This topic is 4328 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 have a game engine and I want the game logic scripts, art, sound, etc... for it to be stored in a zip file or other single file. I would like to avoid extracting the filesystem to the disk before I can use the files. Unfortunately, this means I will need to rewrite lua loading functions, and do some trickery with DirectX and FMOD to load resources from memory streams rather than files. My question is if anybody knows a better way to deal with this, or if I should just bite the bullet and extract the game zip to a temporary directory somewhere. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I can't recall exactly how it worked, but I used to be able to read compressed game assets from .gzip archive directly as if it were a stream. There's probably some library that you're looking for.

Share this post


Link to post
Share on other sites
Temporary files are nothing to be ashamed of. Take a look at just about any professional game and you'll find that if they don't extract the files to a temporary directory, they are lying completely uncompressed in the first place.

I'd recommend leaving your resources completely exposed. Not only does it improve loading times but it saves build time and allows for easy modding. A few years ago, developers were terrified of modders, but it's become apparent that they are a huge asset to the industry, rather than a pain. Nobody will think less of you if they realise they can open your image files in Photoshop, unless you are truly using an inappropriate format (bmp, uncompressed PCM and the likes).

Regards
Admiral

Share this post


Link to post
Share on other sites
Hey,

I think that there is nothing less professional than having your game come up with tons of extra files around. If these files are not even encrypted, I do not think that you can speak of something else than a proof of concept... but definitely not a game.

To me, the best example was Doom (yeah, it is a little old now). One file for the engine, one file for the resources.
I think that it is up to you to create your own container for your game resources, and get what you need from there. If you want it to be mod-enabled, then you design it this way --and offer plugins.

As for the extra amount of work to do so, well, you only need to do it once and for all. It took me two days to do my own format... Now, my resources are zipped inside the executable itself. Only one file, the executable. However, I would not recommend it for a whole game, but it is good for a demo. I like to be able to launch a demo by directly clicking on the internet link without having to uncompress 200 files somewhere...
Cheers
StratBoy61

Share this post


Link to post
Share on other sites
Hi,

Interesting comments above. Many games I have looked at use a technique similar to how the original poster is describing - having assets in archive files (typically zip format, although with a different extension).

You can look at low-level libraries like ZLib (and its contrib library MiniZip) - see http://www.zlib.net/

However there is free middleware available called PhysicsFS which acts as a really useful wrapper around archive files. It also supports local extracted files overridding those in the archive file etc which can be really handy during debugging. Its available from http://icculus.org/physfs/.

Quote:

I'd recommend leaving your resources completely exposed. Not only does it improve loading times but it saves build time and allows for easy modding. A few years ago, developers were terrified of modders, but it's become apparent that they are a huge asset to the industry, rather than a pain. Nobody will think less of you if they realise they can open your image files in Photoshop, unless you are truly using an inappropriate format (bmp, uncompressed PCM and the likes).


It may be quicker to load but commercial games have to think of other things - such as being able get their assets to fit on a CD or DVD. It also offers simple protection against people stealing assets (although its easily circumvented).

Hope that helps,
dhm

Share this post


Link to post
Share on other sites
Quote:
Original post by TheAdmiral
Temporary files are nothing to be ashamed of. Take a look at just about any professional game and you'll find that if they don't extract the files to a temporary directory, they are lying completely uncompressed in the first place.

I'd recommend leaving your resources completely exposed. Not only does it improve loading times but it saves build time and allows for easy modding. A few years ago, developers were terrified of modders, but it's become apparent that they are a huge asset to the industry, rather than a pain. Nobody will think less of you if they realise they can open your image files in Photoshop, unless you are truly using an inappropriate format (bmp, uncompressed PCM and the likes).


Whaaa? Tons of little files are very bad for load times, and given that CPU speeds have outpaced I/O speed improvements, loading compressed data and then decompressing it in memory can significantly improve load times over using uncompressed data, especially when you're talking about CD or DVD loads.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!