Yandros on 14/11/2016 at 19:57
There are numerous things to know, to check, and to do before you share your mission ZIP with the world (or even with a few testers) which can reduce the file size. Even today when most of us have high speed internet access and large hard drives, it's still good practice and good manners to take measures to avoid bloat in anything you ask others to download, and this tutorial will attempt to outline some of them. If you know or think of others, please post them and I'll update this initial post.
First of all, in whatever program you're using to create the ZIP file,
make sure compression is set to Max, Highest or Best. If you're unsure how to do this, search the Help for Compression Settings or Quality.
Secondly, look for and remove unnecessary files. This is most easily done with the ZIP file open in your ZIP program, and choosing Flat View (sometimes called Flat Folders View), which shows all files and folders in the ZIP at once. Then,
sort by Type and delete any of the following file types:
*
Other ZIP files - things like an object or texture pack you downloaded and unzipped, but kept the ZIP around.
*
Text files - Could be the readme from an object pack, your lootlist, or some notes - but you don't need them in the ZIP file.
*
Thumbs.db files - Windows image thumbnails, there will often be one of these in folders with textures.
*
Unsupported image files - JPG and BMP are most common, but you might also have PSP and PSD (from image editing programs) mixed in as well.
*
Duplicate image files - In texture folders where you've added a high res version (such as PNG or DDS) of an older texture (such as GIF or PCX), delete the older one.
*
Unused resource files - This is more work, but if you've not managed your resource folders carefully, you may have files which aren't used in your mission. This could be .bin, .cal and/or texture files. Hunting them down can be tough, but tools like binbins/binskins will help.
*
Schemas - While you may choose to include the custom schemas you wrote for your mission (to help authors who might want to use your sounds in the future), there is no need to include any unmodified LGS schema files.
*
LGS .osm files - All players have these (e.g. miss7.osm, convict.osm), so there is no need to include them in your ZIP.
Third, reduce the size of large resource files in your mission. Mostly these are sound and image files. Here are some tips and guidelines:
*
Convert PNG to DDS - Converting your large PNG files to DDS not only makes them smaller, but also helps performance since DDS textures are loaded differently from other image types. As an example, between v1.0 and v1.1 of Waterfront Racket, I converted many larger object textures to DDS and shaved 60MB off the ZIP file size, and yet had higher framerate in some problem areas. There are numerous free utilities for batch converting image files, so look around. Also, be aware that images with alpha channels usually need to be converted with different settings, although that is outside the scope of this tutorial.
*
Convert uncompressed (PCM) WAV files - You can convert these either to the
IMA ADPCM compressed WAV format that LGS used, or
OGG. Both provide significantly smaller files (75% smaller in the case of IMA ADPCM) and are fully compatible with NewDark and all the mission loaders. Again, look for free utilities to do conversions, but be aware that IMA ADPCM is an older format and some newer tools may not support it, or may save the files in a way not compatible with Dark, so you should convert one and test itbefore doing more. A tool that converts PCM to IMA ADPCM, but doesn't have batch conversion functionality, is the version of Windows Sound Recorder from older versions of Windows, which you can get here: (
http://www.wearytaffer.com/storage/SoundRecorder.exe)
*
Use reasonable resolution and quality settings when encoding movies - Movies in your ZIP file need not be huge or set to insanely high quality in the codec config. You can render the movies at full glorious ultra HD and upload to Youtube for viewing once the mission is released, but they will quickly bloat your ZIP file.
*
Only use stereo sounds when necessary - the only sound files that should be in stereo are those you use for menu and environmental ambients. Other sounds - voice lines, victrola music, sound effects coming from a particular location - should be mono, which is half the size of stereo.
*
Be judicious with large textures - With the appearance of NewDark in 2012, we gained the ability to use much larger textures, but that doesn't mean we always should use them. Most object textures need not be larger than 512x512 unless the object is large, and many will still be fine at 256x256, and barely distinguishable from 512x512 versions of the same texture. Likewise, terrain textures need not be more than 1024x1024 in the vast majority of cases. Take some time to sort your obj/txt16 and fam folders by size, and look at the larger ones; any that are used on smaller objects or surfaces are candidates for being scaled down.
john9818a on 19/11/2016 at 09:48
This is very useful advice. I wish I had been more responsible when I released my first mission. I think I dumped my entire obj folder into the zip file and I didn't use most of those objects in my mission.
Besides the other benefits, it greatly reduces the mis file size when optimizing as opposed to portalizing. I hope that every dromeder chooses to use optimize every time anyway.
ZylonBane on 19/11/2016 at 16:44
Note that converting PNG to DDS isn't necessarily a no-brainer. It's usually fine for photographic textures, but anything with fine, high-frequency detail can get mangled by the DXT compression used in DDS files. This is less noticeable the higher-res the texture.
(
https://blogs.msdn.microsoft.com/shawnhar/2008/10/28/texture-compression/)
Yandros on 19/11/2016 at 18:52
Thanks for that info, ZB. I wasn't aware that DXT compression can mangle detailed textures, but it makes sense, compression is lossy.
Nameless Voice on 20/11/2016 at 23:03
For textures, you usually notice some loss of colour fidelity. Maybe your entire texture tints slightly in one direction, for example.
It's usually noticeable if you compare the two, but mostly the change doesn't matter too much (in normal cases.)
ZylonBane on 21/11/2016 at 01:49
DXT compression is curious because it's fixed-ratio-- the algorithm doesn't care how compressible an image is, it simply cranks through every 16x16 pixel block and smashes it down to a fixed storage size. Specifically, it determines the two dominant colors in each block, stores them as 16-bit RGB565, then stores every pixel as a 2-bit reference to either one of those two colors, or one of two intermediate colors interpolated between them. So four colors max per block.
Yandros on 21/11/2016 at 03:23
That might explain why I didn't notice any issues when converting lots of textures from PNG to DDS for Waterfront Racket - they were all monochrome.
nicked on 21/11/2016 at 15:38
I just batched all my terrain and object textures to DDS, and as far as I'm concerned, the performance savings are totally worth any slight loss of image fidelity. Certainly none of the textures I processed have been badly mangled or anything.
Yandros on 21/11/2016 at 16:07
What kind of improvement to framerate did you see? As I recall in Waterfront Racket, Tannar (who experienced low FPS in places on his machine with PNG textures) saw his fps go from 15-20 up to 25-30 just by converting textures to DDS.
pukey brunster on 21/11/2016 at 16:55
Thank you for posting this! I will definitely be putting some of this advice to use for the next one :thumb: