How to reduce size of final build?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
lucked
Prole
Posts: 8
Joined: Fri Nov 13, 2020 10:27 am

How to reduce size of final build?

Post by lucked »

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
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: How to reduce size of final build?

Post by GVovkiv »

Maybe you should optimize images, sounds, etc, because often code is only ~5-10% of game's size and other ~90-95% it's assets like sounds, images, etc
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 »

The way you zip the love file can also affect its final size. Make sure to choose the slowest and highest level of compression.
PNGGauntlet can reduce the size of PNGs considerably and FLAC/OGG is considerably smaller than WAVs.
You could also try minifying the Lua code, using something like https://github.com/2dengine/love.maker
Last edited by ivan on Sat Dec 11, 2021 8:16 am, edited 1 time in total.
azoyan
Prole
Posts: 25
Joined: Wed Dec 27, 2017 5:19 pm

Re: How to reduce size of final build?

Post by azoyan »

Does anyone know maybe it will be possible to build love2d without OpenAL and Box2d, because the game does not need sound and physics?
User avatar
Gunroar:Cannon()
Party member
Posts: 1143
Joined: Thu Dec 10, 2020 1:57 am

Re: How to reduce size of final build?

Post by Gunroar:Cannon() »

Maybe in conf.lua you could disable love.physics. I heard that will not include the library in build, but I might be wrong.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
MrFariator
Party member
Posts: 559
Joined: Wed Oct 05, 2016 11:53 am

Re: How to reduce size of final build?

Post by MrFariator »

That prevents love.physics from being loaded and thus probably in small part reduces the runtime RAM usage of löve, but any disabled modules are still very much present in the executable and love.dll. lucked and azoyan are talking about reducing the file size of the shipped game, and for that you'd basically have to build löve from source with the unnecessary modules removed or commented out; conf.lua does nothing there. That should be feasible, but you'll probably have to pull the source code from github and do the stuff yourself.

However, I think that'll only have a rather small impact on the overall file size of your game. Maybe 1-3MB at most in a very generous case, not at all familiar with how much Box2d and OpenAL add together. Considering löve is about 10MB total by itself (according to my Windows machine anyway), that's rather small save (in terms of magnitude) - and great many indie titles today are far larger than that. You're probably better off taking ivan's advice, unless your game doesn't use any external art assets and instead relies purely on love.graphics.rectangle, love.graphics.line, and such. Usually the storage capacity is much less of an issue than any runtime memory usage when it comes to today's games, even if I do dislike modern triple A titles for having uncompressed audio in the tens of gigabytes in their installations.
User avatar
pgimeno
Party member
Posts: 3673
Joined: Sun Oct 18, 2015 2:58 pm

Re: How to reduce size of final build?

Post by pgimeno »

See also:

https://love2d.org/forums/viewtopic.php?f=3&t=89168
https://love2d.org/forums/viewtopic.php?f=4&t=85799

FWIW, Löve 0.3-1 has the modules as shared libraries, so you only include the ones you need. https://sourceforge.net/projects/love/files/love/
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests