• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Size Reduction and Unused File Management

Size Reduction and Unused File Management 2023-06-28

Pokémon Essentials Version
Non-applicable
You've finished your fangame! Great! Before you do that, though, have you thought about the files themselves?
It's not something that comes up a lot when working on a project, since often the goal is to make your story into a full fangame. While it's great that you're ready to publish a game, it's important to consider the other aspects within the game itself; rather, in this case, the sounds and other files. They can take up quite a bit in both aspects, so this guide will cover them individually.

For the sake of this not being a complete text wall, I put all 3 things into separate spoilers. You can look at each point however you want, but I'd recommend to look at it one by one.

Arguably, one of the biggest things (in terms of storage space) in a fangame is the music.
Music and sound effects in general are relatively big files compared to other stuff in the game.
Well, how do we reduce this problem?
As this section goes on, we’ll be using Audacity for the audio editor of choice. It’s free and it’s easy to get a hold of, so why not?

To start things off, looping music is great to do when it comes to reducing sound file size.
Looping music can really help cut down on the size a file can take up. Most engines and games nowadays have built-in systems that automatically loop music files depending on what is defined in the file’s metadata. Something that is seemingly finite can be made into something infinite with this convenient modern feature.
Now, what is a file’s metadata? Most audio formats have metadata that you can write in, often used for things such as defining the song name or artist. However, custom metadata tags can be defined for our own usage. In this case, LOOPSTART and LOOPLENGTH!
Let’s go over this in more detail…
  • In Audacity, click on “Edit -> Metadata…”. This will pull up a new window with a table. This is known as the metadata!
    sFxg9d84WbSYMerSuAzvZLEsPEzYHZMwCP5igA-VKpF7U6iSPX_KB9dUpMtA9LvFkcQ-HU2yt0t0DSfaR7cw_u8FeHXlXFEElnfjP1x1tm9BWbvvoG0D7tGw4ep_I_tsTCx0dcI8ywk6YyV4z4KZ5is
  • If you’re editing an already existing file, chances are that some of the stuff may already be filled out. You can hit the Clear button to remove all the data from this, but if you realize that it may have been a mistake you can hit Cancel to back out.
  • You may notice that LOOPSTART and LOOPLENGTH aren’t manually defined. Hit the Add button to add new tags to the metadata, and put LOOPSTART and LOOPLENGTH into the Tag column as two separate tags.
  • LOOPSTART and LOOPLENGTH use samples as a unit of measurement rather than milliseconds or real time. Audacity has this built in! At the bottom where the units are, click on the arrow and select samples. (Also change the “start and end of selection” to “start and length of selection”.)
    TYZ09kmi3mgbwYeCJdXFSWku2EvYHSCDpANBAWG87ETRxRACGaKwkfeDd1Yx0V-GnmAJ3hPf8AABFhlycuGOD58NQN1u0IS3hQtdOrSmA3x4Pqmgwho5KYLOi1wPE-YiYgmj4v84i7vigheVVnQKXR0
  • Now with the setup complete, it’s time to loop. This will take some time, but find the point where the song loops. (Try looking at patterns in the audio to find the loop better!)
    • Audacity has a built-in loop function that lets you set a starting point and end point for a loop. You can use this to test and see if the loop works.
      07IoiEjVCNsc78Nc80ndZprylE5zly2llSfQyopA4nkv9TwCkCi959NN0JVtVzKTMAtH8FgtKNlm_H0brPPjf_H6ckUzaxnYT_crVs8WUu8bISfvqAHi0JWNoluuW7ukfjzDKDLStvrix7kGb1-4Cmc
  • Once you’ve found a loop that satisfies you, define it in the metadata. If you set it up according to the guide earlier, you should have the LOOPSTART and LOOPLENGTH variables defined at the bottom for you.
    F01C9HZ2QQunDMAdlKlsRT25iPYqfzoOxn5MR1T8iIwQv2zoIYkCeGZtBaZnpd9tw4Ru9MojA2Ileledb9NZC7Pr7nDsqGjvtLvKlsMz4mmdCa3aON3-cA1uzbIZ85VeSQqBzv-iMXtpzHwa-6Ep2Zo
It's great that you have the loop done, but chances are that you most likely got this song in its full form. Since you already defined the looping points inside of the file's metadata, what do we do with the rest of this junk sound?
Well, just delete it!
  • Since the song now loops, you can cut out the rest of it. Take whatever’s passed the looping point and delete it. It’s unused data…
  • Export it as a .ogg file, and now it’s ready!
    oYclnTTVXh1zBA_L26wOIUktd9sj1e7LoSiy6g_Lbm46XJKZHZJD3B7npILCAm_CeiEMbfIFdr97QsGPhMn9iIl1Zlo66e0AUWBa8zy9ghZmdunUiZXILXBrpu33NtEmMk1GJvbzYqFgCP1wihrm8M8
Wait, what’s a .ogg file?

An .ogg file is another audio file type aside from .wav and .mp3. It’s a form of compression that allows you to compress the quality of an audio file to such a point where it’s several times smaller than it originally was. (It's like a zip file in sound format!) This is EXTREMELY useful and I recommend taking advantage of it.
Now, you might have a few questions:
  • Why use a .ogg file?
    As explained above, using mp3 or wav files take up much more space than an ogg file. MP3 files are fairly big and can take up a few MB on average, while wavs are MUCH bigger and can take up several. An ogg can take up a few hundred KB. And just in case if you don’t believe me, here’s a comparison!
    1687913127653.png
  • Wouldn’t setting it to 0 quality make the file sound bad?
    Surprisingly, not really! Because of how Audacity makes these files, a 0 quality file can sound nearly identical to a full quality MP3. Sometimes it can have an impact, but generally in-game it’s not as noticeable. I’d definitely recommend using 0 quality for your files as that takes up the least space.
  • What about other sound files? Should I convert those to this format?
    Honestly, you can! Generally it’s music that’s the big offender when it comes to file size, but nothing’s stopping you from converting misc. sounds to this smaller audio format.

So you've finished up dealing with your sounds! Great! What’s all of this other stuff that’s lying around unused though?
If you’re familiar with PSDK or Essentials, you’re well-aware that they come pre-packaged with a numerous amount of assets for you to use. While this is great when developing your game, it’s important to remember to get rid of the ones you aren’t using when you’re ready to publish the game.
Why is this important?
While PNGs don’t take up a lot of space compared to music, what they do however is slow down the extraction process when extracting the files out of a zipped folder. The more things there are, the longer it takes for your PC to extract these. Considering how each Pokemon sprite has an individual image attached, not to mention the other graphics that are given to you in the kit, an average total amount usually comes down to:
T4nXrx2CCMOsroyJ1uoMsgN5Ev3dofnKk2fpuItEuu9U_51zY3kanqcXUAgY3qkl8MIZ2G0eoALyWPgODtHHBvZ1yC2Rc3RQ3dgMYBOL3qADHlHgN5_chxsijTekt9RH1S-n-j4rUTstvxh1VlT6MM4

a lot of files!
So, how do we tackle this effectively? (This isn't a super great list, but it still illustrates what to do.)
  • Make a list of what Pokémon you’re using in your game. With this knowledge, you can save the ones that are being used and you can get rid of the sprites that aren’t being used. This will cut down the amount of sprites present in the folder massively. Unused Pokémon are a BIG factor in the amount of files.
  • Not including any minigames? Remove the files associated with those. Some fangames don't need minigames, but they're still typically included with the kits available nowadays, meaning they can lie around unused.
  • Look in the characters folder. Not using certain NPCs? Get rid of them. NPCs are usually included with these packs. Whether or not they're going to be used in the final product is up to the maker.
The point is fairly obvious at this point, but this isn’t specific to just PNGs! Get rid of unused sounds as well.

Summary

In general, it's best to remember to go back and get rid of anything you aren't using when you're going to publish your project for the world to see. Unless it's intentional, unused files can bloat the download and generally be useless. Reducing the size of sound files as well does wonders on your PC storage! Hope this helps.
Credits
Thanks to Audacity for being Audacity.
There's not really much else to credit.
Author
FrivolousAqua
Views
1,229
First release
Last update
Rating
5.00 star(s) 3 ratings

More resources from FrivolousAqua

Latest reviews

Thanks for teaching me how to loop a track! It's useful to be able to reduce the size of audio files.
THANK YOU for this one, i see soooo many devs putting every single unnecessary asset that's ever existed in their 5 minute jam game. you guys can take regeleki out of your game i promise it wont kill you
Spot on. I've been using Audacity for waveform editing for some time and I had no idea about "0" quality compression not being as impactful. Only thing to add would be: exporting your own music from a DAW, and depending on your bitrate, can usually result in even smaller sizes for better quality too.
Back
Top