Graphics files

Started by
7 comments, last by Century 17 years, 9 months ago
Not entirely sure this should be here... But I'm wondering, how are graphics files usually stored when games are shipped? For example, I'm writing a 2D tile-based engine. I don't particularly want the actual bitmaps with the tiles in left as they are - it looks messy, and they can be edited. Which I don't want. However, I'd still need to be able to modify them - as updates, and what not, such that I can provide improved textures (or whatever) just by replacing one file. Hope that all makes sense. And if it's any help, I'm programming in C/C++ (mostly SDL, and some DirectX)
Advertisement
Usually they're just packaged into an archive; often a zip file with the file extension changed. Typical practice is to create an override directory where replacement files can be placed that will take precedence over the files in the archive.
I don't know if this is worthing the ffort, but you could store the data in a custom format. For bitmaps (.bmp), you could simply remove those fields of the header that you don't use (color depth if all your graphic share the same depth, and others) and change the order of the lasting ones. I think that this wouldn't prevent your graphics to be victim of some advanced user (i.e. a programmer) but many common users wouldn't be able to open/modify it.
You can use a VFS like PhysFS to streamline access to both the regular filesystem
and to ZIP/PAK/...lots of archives.
Cheers guys, that's some help.

Quote:Original post by SiCrane
Usually they're just packaged into an archive; often a zip file with the file extension changed. Typical practice is to create an override directory where replacement files can be placed that will take precedence over the files in the archive.


I've seen this used quite extensively in a lot of RPGs actually... Baldur's Gate and HoMM V spring to mind. However, I sincerely doubt my programming is competent enough to store/retrieve data from compressed archives. Are there simple routines/libraries available that help with this? I know in Baldur's Gate that specific software was required to extract information from these archives..

Ideally that's probably what I'd like to go for in a best case scenario. Any more info on that would be great. But thanks for everything else 8)
See the link in the post above yours.
You could also just use zip files and use a library such as this

http://www.sharma-home.net/people/arun/projects/ziplib/

or this:

http://codeproject.com/file/zip_utils.asp

To access them (that last one includes an example which shows how to embedded your zip file in your exe as a resource (which is handy for small assets).

It's not uncommon to store textures in custom binary formats that contain any additional information needed by the game and have the data already in graphics card friendly format (e.g. DXT compressed with mipmaps pre-generated). DDS files are another option for storing files with DXT compression and mipmap chains. For consoles this is taken a step further and the texture data is typically stored in the exact format needed by the graphics processor on the console so no conversion is needed on loading, the data is just transferred straight into video memory.

Most commercial games will have some kind of asset pipeline that takes the source artwork in whatever format the artists use (often a photoshop .psd file) and processes it to produce the game ready asset in whatever custom format is loaded by the game at runtime. If you want to edit the textures you edit the source artwork and re-export it through the pipeline, you never edit the custom format directly. There may be viewers for the custom formats for convenience but it's a bad idea to edit the processed assets (it's like editing the binary executable directly to fix a bug rather than editing your source code and recompiling).

Game Programming Blog: www.mattnewport.com/blog

That's awesome guys, thanks a lot.

This topic is closed to new replies.

Advertisement