Game Development Reference
In-Depth Information
There is one drawback to this approach, that is, you must load every
single GROUP file that your game makes reference to in order to
generate all the binary versions of them. This can particularly be a
problem if your game has a large number of levels and you have a
GROUP file for each level. A good way of solving this issue is to create
a special mode for your game that can be given a list of all the required
GROUP files (and potentially any dependencies between them) and will
then load each file in turn to generate the binary version.
Compressing resources using the Derbh
archiver
Game resources can soon grow very large in size, so it would be great if we could
somehow compress these files so that they take up less space in our installation
package, particularly if there are any restrictions on the maximum size an install
package can have.
Marmalade provides just such a feature in the form of Derbh archives, which is very
similar to compression systems such as ZIP that you will no doubt be familiar with.
Derbh supports multiple compression algorithms, including the standard LZMA
and also its own proprietary algorithm, which can achieve improved compression by
operating over multiple files simultaneously.
The Marmalade SDK provides an API which allows us to load compressed files as
easily as if they were provided as individual uncompressed files. A command-line
utility called DZip is also provided to generate the archives in the first place.
Creating a Derbh archive
To create a Derbh archive, the first thing we have to do is create a DZip
Configuration File ( DCL) . This file is passed to the DZip utility to specify the source
files and how they should be compressed. Here is a simple example of a DCL file
taken from the Skiing example project for this chapter:
archive data-ram\data-gles1\skiing.dz
basedir data
basedir data-ram\data-gles1
file text\EN.str 0 dz
file models.group.bin 0 dz
file flag\flag.group.bin 0 dz
 
Search WWH ::




Custom Search