Help implementing game logic from fish fillets

General discussion about LÖVE, Lua, game development, puns, and unicorns.
glitchapp
Party member
Posts: 237
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Hi, the assets reached 2Gb and I managed to reduce the full game to around 700mb by using the libwebp library: all graphics have been converted to webp files.
I also made a compromise with the audio and compressed the dubs to a standard quality with .ogg

I don't think there's much more room to optimize the size of the game but if you have any idea feel free to provide feedback.

Just to provide an idea of which assets are the biggest here is the top 5:

Dialogs (dubs): 282.2 Mb
Music: 155.9 Mb
Videos: 83.9 Mb
Classic assets: 77.4 Mb
New Assets: 61.1 Mb

Thanks!
GVovkiv wrote: Fri Jun 23, 2023 7:15 am
glitchapp wrote: Fri Jun 23, 2023 6:58 am Hi, I've recently packaged a reduced version of the game for Windows, Os-X and as AppImage for anyone to test it (there's also a .love file): check details here: https://codeberg.org/glitchapp/fish-fil ... e/releases
Are you tried optimizing assets themselves?
Like "png optimizers" or sound optimizing?
With lossless optimizing you wouldn't save much, but couple megs is still something.
Especially if you not going to add more or edit already existing assets
User avatar
darkfrei
Party member
Posts: 1181
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help implementing game logic from fish fillets

Post by darkfrei »

Can you try to reduce .png size with this tool?
https://forums.factorio.com/viewtopic.p ... 71#p250171
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
glitchapp
Party member
Posts: 237
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Hi Darkfrei, I already tried several methods and none of them have given better results than webp format, besides that, as you can see in the list of biggest assets provided above, the biggest issue are not graphics: the biggest files are voice dubs followed by music... the only format I tested to reduce the size of the dubs is the lyra format by google, but the quality is quite horrible no matter how I tweak it.

Even if I manage to reduce a few mb with a png optimizer (I doubt it will give better results than webp), the biggest files are still the audio files and they are compressed with opus which is a great codec so there's not much I can do I'm afraid.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Help implementing game logic from fish fillets

Post by zorg »

You still need to be aware that even opus has quite a lot of settings you need to understand and pick the most suitable ones. For voice, you can go down to very low bitrates, especially with Opus. 32kbps would be enough for a vocal recording that wouldn't cut out any frequencies human voices can produce.

If your dub audio tracks have lots of silence in them, you could trim all that out, and only save the parts that actually have spoken voice in them; encoders usually won't do anything to silent regions in terms of replacing them with something like "insert x milliseconds of silence from here" so that's still going to be a waste of space.
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.
glitchapp
Party member
Posts: 237
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

zorg wrote: Fri Jun 23, 2023 12:42 pm You still need to be aware that even opus has quite a lot of settings you need to understand and pick the most suitable ones. For voice, you can go down to very low bitrates, especially with Opus. 32kbps would be enough for a vocal recording that wouldn't cut out any frequencies human voices can produce.

If your dub audio tracks have lots of silence in them, you could trim all that out, and only save the parts that actually have spoken voice in them; encoders usually won't do anything to silent regions in terms of replacing them with something like "insert x milliseconds of silence from here" so that's still going to be a waste of space.
Hi zorg, thanks for the feedback. You are right, I've just made some tests and I agree the size of the dubs could be reduced to almost half the current size without being much noticeable, so 141,1Mb would be achievable. There are not much silence in the audio because the dubs are well edited and I'm not sure that would make a difference, but reducing the bitrate or general opus quality would do a difference without compromising much quality. One problem would be to apply all the conversions automatically and recursively because the amount of work to do such work manually would be great: there are hours of dubs and it's only me in charge. I also have doubts that reducing the size of the project from 700mb to 550mb would make such a difference, but if anyone does, that's the reason why I offered now to anyone interested to take over the project and adapt it, fork it and or maintain it.

I will keep adding dubs and I will correct bugs if anyone do some betatesting and find the bugs I did not, but there's no more significant updates I can add at the moment, so just in case anyone likes the project and would like to add its own improvements now it's the best moment.
glitchapp
Party member
Posts: 237
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

I've created a repository for the music player I created for the game. Maybe someone find it useful or can improve it / tweak it. It has some cool features such a spectrogram (tweaked from a contribution made here in the forums), forward and backward controls, volume and it shows track progress and volume with nice bars.

The player I attached here has no music tracks, you need to add them to the music folder and adjust track name and path on musicplayer.lua to make it work.

The repository can be found here: https://codeberg.org/glitchapp/Music-Player-Lua-Love2d
Attachments
musicplayer.love
(963.38 KiB) Downloaded 63 times
musicplayer.png
musicplayer.png (66.39 KiB) Viewed 2882 times
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

Re: Help implementing game logic from fish fillets

Post by pgimeno »

One note. To my knowledge, that's a bar spectrum, not a spectrogram. I consider spectrograms more spectacular and mesmerizing, and would cost very little additional effort. You draw a 2D graph where the X axis is time (of the song), the Y axis is frequency, and the colour is the energy (the height of the bars you're drawing now).

https://en.wikipedia.org/wiki/Spectrogram

Cubic Player had that effect built in, and I loved it so much that made my own spectrogram plug-in for another player, gst123, to get it back when CP was no longer an option for me.

I can see two ways to do them with love: scrolling and the CP way. Cubic Player made a sweep from left to right, darkening pixels that were going to be redrawn, leaving a fading band between the past sweep and the current position. Not sure if I've explained that clearly.

Drawing it may be a bit of a challenge. I can figure a way by using a canvas (two canvases if you plan to use scrolling), an image, an imagedata object of 1 x number_of_frequencies, and the Image:replacePixels function. The ImageData would receive the colours of one pixel row; you'd use it to refresh the image, then draw the image to the canvas and either fade the canvas (for the CP method) or scroll it using the other canvas as an auxiliary one.
Last edited by pgimeno on Sat Jul 01, 2023 11:08 am, edited 1 time in total.
glitchapp
Party member
Posts: 237
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Ah thanks for the correction, English is not my mother tongue and I was not sure of the right word for it, I will correct it in the repository as well, and that's a good idea by the way, never done it but it sounds like a fun challenge... will see If I manage to write a spectrogram with time and frequency... sounds like a great feature to add to the player...
pgimeno wrote: Sat Jul 01, 2023 11:01 am One note. To my knowledge, that's a bar spectrum, not a spectrogram. I consider spectrograms more spectacular and mesmerizing, and would cost very little additional effort. You draw a 2D graph where the X axis is time (of the song), the Y axis is frequency, and the colour is the energy (the height of the bars you're drawing now).

https://en.wikipedia.org/wiki/Spectrogram
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

Re: Help implementing game logic from fish fillets

Post by pgimeno »

Don't miss my edits where I give you some tips :)
glitchapp
Party member
Posts: 237
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

pgimeno wrote: Sat Jul 01, 2023 11:09 am Don't miss my edits where I give you some tips :)
which edits? you mean about this problem of the spectrogram?
I've been checking the code that render the spectrum bars and I actually don't know how to approach it, I guess I need to store some variables in a table with the audio position and then render them but not sure how to do it... I will edit this post if I make any progress..

The code is here just in case anyone wants to take the challenge:

https://codeberg.org/glitchapp/Music-Pl ... alizer.lua
Post Reply

Who is online

Users browsing this forum: No registered users and 55 guests