Monday, November 7, 2016

c# - What is the state of the art at shipping game graphics such as lots of small BMP files?



We have lots of small BMP files which I think would be easier to copy if we had them combined in a big TAR/ZIP/whatever.


What is the state of the art at shipping game graphics?


We are using C# and are aware of zlib. Just brainstorming to see if there are any other solutions better than zlib.



Answer



You could also look into SharpZipLib or DotNetZip - DotNetZip gives you access to a Stream directly, which is helpful as most C# libraries out there can load from streams (as opposed to files). Furthermore DotNetZip uses the Ms-PL (BSD-Like), instead of the GPL with a legally questionable exception.



Another option is to use texture atlases - instead of having many small images have a few big ones. These actually load slightly faster and are slightly faster at runtime if you get smart with how you draw them.


Finally you could run each asset type through the relevant lossless compressor (PNG, FLAC, etc.) and store them in a flat file (basically a zip file with compression disabled). Remember to avoid compressing compressed data, as that will increase the size in most cases.


Some prior art:



  • MPQ: Probably as good as it gets for game assets, the lookups are designed to be fast (disk-based hash-table etc.). Each file type (that is supported) has a unique compressor.

  • Quake PAK: This is basically a flat file structure.

  • Doom WAD: Somewhat specific to Doom, but worth looking into.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...