Pre-processing with GFxExport

Until now we’ve been loading Flash SWF files directly. This streamlines development because artists can swap in new SWF content as they develop, and see the results in game without requiring a revised game executable. However, including SWF content in a release is not recommended because loading a SWF file requires processing overhead and impacts load time.

GFxExport is a utility that processes SWF files into a format that is optimized for streamlined loading. During preprocessing, images are extracted into separate files for management by the game’s resource engine. Images can be converted to DDS files with DXT texture compression for optimized loading and run-time memory savings. Embedded fonts are recompressed, or font textures can optionally be pre-computed for cases in which bitmap fonts are to be used. GFxExport output can optionally be compressed.

Deploying with GFX files is simple. The GFxExport utility supports a wide variety of options that are documented in the help screen. To convert the d3d9guide.swf and fxplayer.swf files to GFx format:

gfxexport -i DDS -c d3d9guideAS3.swf
gfxexport -i DDS -c fxplayer.swf

gfxexport.exe is located in the C:\Program Files\Autodesk\Scaleform $(GFXSDK) directory. These commands are also in the convert.bat file in Tutorial\Section7.

The -i option specifies the image format, in this case DDS. DDS makes the most sense for DirectX platforms because it enables DXT texture compression, which will typically result in 4x run-time texture memory savings.

The –c option enables compression. Only the vector and ActionScript content in the GFx file is compressed. Image compression depends on the image output format chosen and DXT compression options.

The –share_images option reduces memory usage by identifying identical images in different SWF files and loading only a single shared copy.

The version of ShadowVolume in Tutorial\Section8 has been modified to load the GFx files simply by changing the filename argument to GFx::Loader::CreateMovie.