Page 1 of 1
How to reduce size of final build?
Posted: Sun Jul 19, 2020 1:44 am
by VanBandama
Hi!
I was wondering how to trim/ optimize my game in size? I did pong step by step from cs50 and got around 6 mb. That's a lot for simple game like pong, so I compared it to mari0 and found that (mari0) has sdl, openal32 and DevIL dll's. And my game has msvcp,msvcr and love dll's alongside previously mentioned.
Is there a way to make it smaller besides zipping it? In haxeflixel I used -dce (dead code elimination) command for that.
Thanks for your time
Re: How to reduce size of final build?
Posted: Sun Jul 19, 2020 6:40 am
by zorg
Hi and welcome to the forums!
The newest version of löve has 7 dll files included (clocking in at almost 9 MB); you can't do anything about that.
Your pong game itself is probably just a few kilobytes, or even less. The running environment (löve itself, along with all the stuff it needs to work with luaJIT, handle video, interact with windows, handle sound through OpenALSoft, and most things through SDL) is what's taking up the most space.
You have two choices; first, you could try and see if an older löve version is still suitable for your needs, although people including me will try to dissuade you from that for multiple reasons.
The other option is to distribute only the .love file (a renamed zip archive of your code [and assets] only) and ask people to install/download löve separately... that will drastically reduce the size, and is what i would recommend... at least as an option.
Re: How to reduce size of final build?
Posted: Sun Jul 19, 2020 7:48 pm
by ReFreezed
For code you can use a code minifier (though the code is probably the smallest thing in any project). For PNGs, use
Pngcrush. Use a lossy format for sounds instead of lossless.
As zorg says, distributing a .love file will save you the size of the binaries, but then you're relying on the end user installing a dependency and having to launch the game in a specific way or else things may break (i.e. the wrong version of LÖVE being used).
I'm curious why you want to reduce the size? 10 MB is close to nothing at all, even if it's a small game. Modern computers have lots of storage.
Re: How to reduce size of final build?
Posted: Sun Jul 19, 2020 9:48 pm
by VanBandama
Thanks for advices. Well I'm that kind of guy who likes minimalism and is bit too ambitous
also it's a good way to train writing clean code and maxing out hardware limitations. Like Carmack said "if it runs doom..."
Re: How to reduce size of final build?
Posted: Mon Jul 20, 2020 6:33 am
by ivan
Like ReFreezed said, compressing your PNGs is a great way to do it.
Make sure your PNGs are indexed-color, that's considerably smaller than having an alpha channel.
PNGGauntlet is another good program for optimizing your PNGs.
Also use FLAC or OGG instead of WAV.
Re: How to reduce size of final build?
Posted: Mon Jul 20, 2020 7:48 am
by zorg
ivan wrote: ↑Mon Jul 20, 2020 6:33 am
Also use FLAC or OGG instead of WAV.
Or go tracker format, that can be even smaller
Re: How to reduce size of final build?
Posted: Sat Jul 25, 2020 3:19 pm
by AuahDark
Zopfli compressing possible files is also always an option. Possible files are:
[*] Your .love file using
AdvanceCOMP
[*] PNG files using
zopflipng
[*] Any data that's compressed using zlib or gzip format using
zopfli
[*] Your zipped game distribution files using AdvanceCOMP
Note that compressing single file in zopfli is 80 times slower! So you may want to do that only when you really distributing your game.
Re: How to reduce size of final build?
Posted: Sat Jul 25, 2020 5:26 pm
by pgimeno
You can also compress it to 7z, but beware that the decompression time is slower.
Re: How to reduce size of final build?
Posted: Tue Aug 04, 2020 6:00 pm
by crystal
VanBandama wrote: ↑Sun Jul 19, 2020 9:48 pm
Thanks for advices. Well I'm that kind of guy who likes minimalism and is bit too ambitous
also it's a good way to train writing clean code and maxing out hardware limitations. Like Carmack said "if it runs doom..."
a simple games can be easily written in pure SDL c/c++
and there is also tiny library called LodePNG
i as well im not fan of heavy game engines like unity for 2d games