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: 122
Joined: Fri Jan 15, 2021 7:29 am
Contact:

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: 1732
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://bitbucket.org/itraykov/love.maker
azoyan
Prole
Posts: 24
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: 415
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.
Why can't pirates code in lua? Because they spend to much time at C! :P

-It might look like nonsense :roll: but there's so much proof.
-Some more if you pls... :? .
It has to be real then, all that talk about the end :shock: .
-How to be saved :huh:
MrFariator
Party member
Posts: 265
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.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests