Game Development Community

What can I delete ?

by Chris Labombard · in Torque Game Engine · 09/14/2005 (10:27 am) · 13 replies

Hey guys.

I'm trying to remove everything I can from my build in order to reduce the download size of my demo.

What can I safely delete?

So far I have deleted every folder in c:\Torque\sdk except for the example folder and it seems to run fine still.

Can I delete the common and editor folders ?

How about runtorque.sh and synapsegaming.sh ?

I'm pretty sure I still need libopenal.so and OpenAL32.dll (Don't I?)

I have deleted the majority of hte cs files (Where there was a matching .dso file) ... Same for gui's.

How else can I reduce the size of this beast ? I noticed the Torque installer and Lighting pack installer are tiny in comparison to what I am showing.

Any help is much appreciated. :)

About the author

I have been a professional game programmer for over 5 years now. I've worked on virtually every platform, dozens of games and released a few of my own games, including 2 iPhone titles and a title waiting release on Big Fish Games.


#1
09/14/2005 (10:41 am)
Ok... apparently I can delete the editor folder, but not the common folder.

and the .sh files didn't appear to hinder anything.

EDIT: The exe is 4.5 mb... I can't remember the program that strips it down.

EDIT2: New zip 28mb so far :D
#2
09/14/2005 (10:51 am)
I don't think .dsos compress as well. They contain binary data. The TGE and TLK don't ship the .dsos, and plaintext compression on the .cs files is pretty good...

.sh are for linux builds, those won't hurt you... but won't give you too much of a compression gain.

I'm pretty sure you can lose libopenal.so, but you'll need the dll for sound.
#3
09/14/2005 (11:09 am)
Well, I can't include the cs files, the dso's will have to do.

I am going to go through all my art and make sure there aren't any extra images kicking around in the data directory.

I will kick the .so file out and see what happens.
#4
09/14/2005 (11:11 am)
@Chris,

libopenal.so, runtorque.sh, synapsegaming.sh?
Delete everything in c:\torque\sdk?

Why would you want to ship a game with anything outside the example folder? I'm suprised that you're asking this.
When shipping your game, don't go outside of the exampel folder. Because there is no need to do that.

You can delete the editor folder if you don't want the editors, correct. The common folder is, of course, essential.. that's one of the basic cornerstones in your TGE example build. You cannot just delete it.. that's like removing half of the functionallity from the game and thinking it might just work :)

Try using UPX or any other binary compressor, or manually compress the binary when you compile/link it, it should get the binary down to around 800 kb release build.

Edit: .so's won't do anything to your example game. Anything outside the example folder is not essential to your release build.
#5
09/14/2005 (11:20 am)
Stefan - Thank you. I didn't know what the files did. So I didn't know if I could remove them.

UPX was the one I was looking for. Couldnt remember the name.

Is thre anything else, tricks or what not, I should be doing to kill the download size ?
#6
09/14/2005 (11:25 am)
Chris,
You can keep all of the other folders in c:\Torque\SDK\ Just don't include them when you distro Basic Bob.
I would reccomend moving BB to it's own directory (as sort of a backup and to keep things seperate).

The majority of your total file size will be from media.
Some tips to keep file sizes down:

Compress any mp3's down as tight as possible. (EDIT: lower bitrate and re-encode.)
Compress jpg's and other media as lossless as possible.
Try using .png's instead of jpg's see what your results are
If you have many .wav files, there is a way to convert them to .mp3 for distro and have them unpacked back to .wav's during installation (don't ask me how, I haven't played with it)
Compile your .exe as a Final Build.
Check out this thread
Open up Explorer, View>make sure status bar is checked. View>show details. Look through your files and see what are the largest ones. See what you can do to compress those.
If Zipping, use max compression.
Eliminate any unnecessary alpha channels in your final textures.

That's it for now.
#7
09/14/2005 (11:28 am)
What dev enviorment are you running? Incase of VC, there's a load of unused files in the example root that you can delete. They take up around 10ish megabytes.

Other than that.. I really don't know. Compress everything as much as possible, get rid of unused graphics.. delete .psd's and other source art. Make sure your example root only contains main.cs, the binary, the opengl2direct3d dll's and openal32.

edit:

Quote:
Compress any mp3's down as tight as possible.

Torque doesn't support mp3's :p And even if it did, compressing a mp3 won't yield much at all.
#8
09/14/2005 (11:44 am)
Thanks guys.

I downloaded UPX but can't seem to get my binary compressed past 2.5 mb. That's pretty good though. I guess it will have to do.
#9
09/14/2005 (12:52 pm)
Here's a short Perl script I used a long time ago, when we packed a zip for distribution for other people quite often - now we just point them to the source control, but it worked well at the time. It is really a quick hack only, and it could do with some refinement. For instance, I was meaning to make sure it only zipped *used* files and it should also compile all DSO files, but never got around to it.

However, it does a somewhat good job of packing together a Torque game without too much extras, and it also uses UPX on exe and dlls if available (in the same dir). Maybe it could serve as a starting point for someone, at the very least. =)

Note: Haven't tested that it still works, it was used last, oh, well over a year ago. But things shouldn't have changed that much. Put it in the "example" directory, change the name "ninja" to whatever your mod is named, and "cetaceans" to what you want your game to be named of course. And you should be good to go. If you have Perl installed. ;-)
#!/usr/bin/perl
use warnings;
use strict;
use Archive::Zip;
use Archive::Zip::Tree;

# Simple script to pack a "release" version of a Torque based
# game. Set name of game, dirs etc and run in root directory.
# At the moment still includes  GUI editor and stuff, will be removed
# soon. Also TODO: Add AZ_OK checks on add commands and fail when failing.

my $gamename = 'cetaceans';
my @dirs = qw(common ninja);

my $exclude = sub 
{
    (/\W(?:editor)\W/ || /prefs.cs$/) ? 0 : print "  $_\n"
};
my $filetypes = "dso|tga|ter|png|ogg|mis|jpg|dts|dsq|dml";


my $zip = Archive::Zip->new();

foreach(@dirs)
{
    print "Adding files in '$_'...\n";
    $zip->addTreeMatching($_, "$gamename/$_", "\.(?:$filetypes)$", $exclude);
}

if(-e 'upx.exe')
{
    print "Compressing executables and libraries...\n";
    system('upx.exe', '-q', '*.dll', 'torqueDemo.exe');
}

print "Adding game DLLs...\n";
$zip->addTreeMatching('.', $gamename, '\.dll$');
print "Adding startup script...\n";
$zip->addFile('main.cs', "$gamename/main.cs");
print "Adding main exe...\n";
$zip->addFile('torqueDemo.exe', "$gamename/$gamename.exe");

print "Writing zip...\n";
$zip->writeToFileNamed("$gamename.zip");
#10
09/14/2005 (1:46 pm)
@Chris,

Take a look at PECompact. It's very cheap for educational and non-commercial purposes. I think it's 5 dollars or something like that.
I use it, and apart from some problems with antivirus scanners, it rocks.
#11
09/15/2005 (3:32 am)
Stoffe- Didn't Tom Bampton also come up with a perl script that would find unused assets ? I just remembered it now. Perhaps I will look his up as well. Can you reccomend a good perl environment ? *I wonder if Eclipse can handle perl*

Stefan - This is a cmmercial product ;) I will look into it though.
#12
09/17/2005 (6:10 pm)
Make sure you also delete any code from your project that you don't need. Classes from Game you don't use are a good bet. Renderers you don't use are also good. With proper trimming you can get a Torque EXE down to < 1mb - of course, it's pretty minimal at that point.
#13
09/17/2005 (6:40 pm)
> Didn't Tom Bampton also come up with a perl script that would find unused assets ?
> I just remembered it now. Perhaps I will look his up as well.

Sounds somewhat familiar yes, maybe could be combined.

> Can you reccomend a good perl environment ?

Nah, not really. I bought and used Komodo several years ago, which is a very good product, but at the end of the day I'm not very much into IDE's, always end up using a good text editor with good project support instead.

> *I wonder if Eclipse can handle perl*

e-p-i-c.sourceforge.net/ - me and Eclipse have never able to make friends despite numerous tries, but I hear this one is pretty good if you are one of those who can handle the Eclipse.