How to reduce size of final build?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
VanBandama
Prole
Posts: 6
Joined: Wed Sep 04, 2019 5:15 pm

How to reduce size of final build?

Post 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 :)
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to reduce size of final build?

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: How to reduce size of final build?

Post 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.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
VanBandama
Prole
Posts: 6
Joined: Wed Sep 04, 2019 5:15 pm

Re: How to reduce size of final build?

Post 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..."
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: How to reduce size of final build?

Post 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.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to reduce size of final build?

Post 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 :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
AuahDark
Party member
Posts: 107
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

Re: How to reduce size of final build?

Post 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.
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: How to reduce size of final build?

Post by pgimeno »

AuahDark wrote: Sat Jul 25, 2020 3:19 pm [*] Your .love file using AdvanceCOMP
You can also compress it to 7z, but beware that the decompression time is slower.
crystal
Prole
Posts: 15
Joined: Sat Sep 30, 2017 9:53 pm

Re: How to reduce size of final build?

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests