This section in a map file contains the picture that is to be used as the map preview. The dimensions of this image are given in the Preview section. The image itself is stored as a single huge base64-encoded string spanning across every key in the PreviewPack section.2 When decoded, the string will contain blocks of compressed pixel data:
- 2 unsigned bytes of the compressed block size (excluding this header) - 2 unsigned bytes of the uncompressed block size (excluding this header) - LZO compressed pixels in BGR888 format.
The scanline of each row of pixels is precisely 3 times the width, i.e. no additional padding is used.
There is little need to edit this manually, as XCC Mixer can create this section from any desired picture, which can then be pasted into a map file. This is used in the newest version of the Assault Mappacks to display an informational picture to users which are playing an Assault-compatible mod without downloading the mappacks themselves. (See the Assault Mappacks page for more info.) The map editor Final Alert is also capable of generating previews based on the tiles of the map. Higher quality previews can be obtained using a resized picture of the full map. The CNCMaps rendering tool contains an option to create these, and directly inject a high-quality preview into the map.
Width/height proportions of original maps
The dimensions of the preview image on official maps appear to have a relation to either the LocalSize or Size of the map, depending on the game. Deviating from these dimensions can but not always will cause unwanted black pixels to appear in the image, as can be seen in the image on the right. This was confirmed at least for Yuri's Revenge. The table below shows the formulas that appear to be used, values presented are rounded and not precise. They were taken from the research presented at1, where more precise values can be found.
|Game||Preview width||Preview height|
|Tiberian Sun||1.975 * full width||0.995 * full height|
|FireStorm||1.975 * full width||0.995 * full height|
|Red Alert 2||1.975 * full width||0.995 * full height|
|Yuri's Revenge||1.975 * local width||1.0 * local height|
1 ↑ [C&C TS/RA2 - PreviewPack / LocalSize / Map Size proportions] - Spreadsheet containing the proportions between preview size LocalSize and full map size for the official TS, FS, RA2 and YR maps.
2 ↑ [MapPreviewExtractor.cs] - Decoder example code from the CNCNet Client.