Read more about advertising your project here
[XP/VX/VXA] Project Optimization (Revision 2.1; Upd-10/23/12)

0 Members and 1 Guest are viewing this topic.

*****
Rep:
Level 80
2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
  • Update History
Spoiler for Update History:
  • < Version 2.1 | 10/23/12 > Added RVDATA2 Compression under Data > RVDATA2 Compression
  • < Version 2.0 | 10/09/12 > Updated for RPG Maker VX Ace; updated appearance.
  • < Version 1.9 | 08/03/11 > Added Radical Image Optimization Tool under Graphics > PNG/JPEG Optimization
  • < Version 1.8 | 07/24/11 >
    • Added a tutorial on media compression.
    • Added a tutorial on time compression.
    • Added MCP under Optional Software Tools.
  • < Version 1.7 | 07/16/11 > Removed the textual tutorial on looping and added a video tutorial.
  • < Version 1.6 | 07/14/11 > Added Blizzard's Resource Tester project under Stowaway Files (thanks GameGuysProjects)
  • < Version 1.5 | 07/13/11 > Added Zeriab's Remove Comments project under Scripts.(RXDATA/RVDATA) Comment Removal.
  • < Version 1.4 | 07/12/11 > Added JPEG & PNG Stripper under PNG/JPEG Optimization.
  • < Version 1.3 | 07/12/11 > Added the Compact RVData script under .RVData Compression.
  • < Version 1.2 | 07/08/11 > Added a tutorial on looping.
  • < Version 1.1 | 07/08/11 > Added Yeyinde's RM Data Checker under Stowaway Files (thanks cozziekuns)
  • < Version 1.0 | 07/08/11 > Initial Release

  • Easy
Spoiler for Easy Category:
  • \ Graphics
    • < PNG/JPEG Optimization (XP/VX/VXA) >
      One of the easiest and quickest ways to shrink your project size is to use a PNG/JPEG optimizer on all of your graphics. While saving roughly 20 kb off of a single file may not seem very impressive, if your project has a large amount of graphics, then these small bits begin to add up quickly.

      For example, I recently optimized a project for a friend which had about 1,500 PNG files. The original size for the entire graphics folder was 84,085,192 bytes (84 mb). The size of the folder after I ran a quick PNG optimization was 57,719,751 bytes (57 mb). That's a difference of 26 megabytes simply by removing excess information that's not being used by the game and then re-compressing the file. No extra scripts or advanced computer knowledge required.

      There are a plethora of options available for PNG/JPEG optimization, but I personally prefer the following programs :

      • PSYDK.ORG PNG Optimizer
        This program features an easy to use interface which you can quickly drag and drop your files into. Very simple to use. By default, the program makes backups for each file that it optimizes, so remember to either disable this feature through the options menu or move the backups after optimization is complete. No installation required; free to use.

      • Radical Image Optimization Tool
        RIOT combines several different compression methods and options for both JPEG and PNG files into one powerful application. It offers a side-by-side comparison which updates whenever you make a change, allowing you to see the end result before it is saved. The program also has a batch optimizer function which can handle multiple files at once. Highly suggested for those wanting more control than PSYDK PNG Optimizer and JPEG & PNG Stripper without the command line aspect of OptiPNG Advanced PNG Optimizer. Small installation required; free to use.

      • OptiPNG Advanced PNG Optimizer
        Unless you're like me and find glee in squeezing every last useless kilobyte out of PNG files, use the PSYDK PNG Optimizer instead. This is a command line PNG optimizer which has advanced options not normally needed, but can occasionally eek out several more kilobytes of unneeded data from the image file. No installation required; free to use.

      • JPEG & PNG Stripper
        Unlike the other two options above, this program removes useless metadata from JPEG files as well. If you are using JPEG files, I highly suggest running them through this optimizer to clear up the most amount of space possible. The program has an easy to use interface which you can quickly drag and drop your files into. Very simple to use. Please note that some anti-virus software may mark this program as malware, but it is not. No installation required; free to use.




    • < Thumbnail Cache Files (XP/VX/VXA) >
      Occasionally I see these database files just hanging around in one or more of the graphics directories, taking up space that they shouldn't be. Thumbs.DB is often the biggest offender. This file is generated automatically by Windows when browsing a folder with image files while the 'thumbnails' view is enabled. Always check to see if you have any such files before you export the release of your game, as I have seen them bloat as high as 5 mb.

    • < Stowaway Files (XP/VX) >
      Quickly run through your current graphic and audio files. Open them up, visually inspect or listen to them. Are you using all of them in your project? I've found myself guilty of allowing stowaway files into my project. That is, images that are not being used in the game and are most likely left overs from a quick graphic test or an older backup version of something that is being used in the game. These normally don't eat up very much space, but in larger games allowing these moochers to tag along can inflate the size of your project by several megabytes.

      If you're unsure if you're still using a certain graphic or music file within your game, move the file out of your project folder and use the following program or script to see if any errors crop up :


  • Intermediate
Spoiler for Intermediate Category:
  • \ Audio
    • < General >
      • Suggested Software Tools

        • Audacity Sound Editor
          Using Audacity is not required, although all of the steps for this tutorial will be done using that program. This is a fairly easy to use and completely free sound editor.

        • fre:ac Audio Encoder/Converter
          If you already have audio files created for your project and want to manage their size through compression, I suggest using fre:ac. The program has a straight forward interface and configuration is quite easy.

      • Optional Software Tools

        • MP3Gain MP3 Audio Normalizer
          Occasionally I will come across MP3s that are just outright loud or strangely quiet. I use this utility to bring their default volume up or down to a more acceptable level. This can be done within Audacity as well.

        • MCP (Media Comparison Program)
          MCP plays up to three audio files simultaneously and provides a side-by-side spectrum analyzer for each as well. In this way, you can visually test the source audio file against a compressed version to see exactly what quality is being missed for the sake of size. As sometimes I simply don't trust my ears to do a comparison, I use this program often to get a visual picture of the difference between two files.




    • < Looping (VX/VXA) >
      Although the Graphics directory is often the biggest offender of project size bloat, the Audio directory can often rival or in many cases surpass its graphical neighbor.

      One way to help reduce the bulk of your Audio directory is to find a section within the music files to lock into an endless and flawless loop. To show the steps required to make a looping OGG file, I have created a short tutorial video which can be viewed below or by clicking the following link : RPG Maker VX/VXA Audio Looping Tutorial

      <a href="http://www.youtube.com/watch?v=2dHo2kBkC6Y" target="_blank">http://www.youtube.com/watch?v=2dHo2kBkC6Y</a>



    • < Media Compression (XP/VX/VXA) >
      If the complicated process of creating audio loops for your project is not something you want to take on or is otherwise not an option, you should consider at least compressing your media so that it takes up less space. Even if you are someone who enjoys high quality audio, I'm sure that you would be surprised about how far you can compress an audio file and still maintain great quality.

      In this tutorial, I will be going through setting up fre:ac to encode and heavily compress MP3 files into OGG files. Please note that you could also use Audacity to compress your files, although fre:ac is better for handling a large quantity of files at once.

      Spoiler for:
      • < Step 1a > : Before we get started actually compressing audio files, we'll need to change a few settings from their defaults. After opening fre:ac, go to the Options menu and select the General Settings ... option.




      • < Step 1b > : Within the Encoders tab and under the Encoder subsection, click on the drop down menu and select the Ogg Vorbis Encoder option. Next, click on the Configure Encoder button which is just to the right of the drop down menu.




      • < Step 1c > : Make sure that the VBR (Variable Bitrate) option is selected before dragging the quality slide bar to the left. Personally, I prefer to set the quality to zero as I have found this squeezes the most out of the source media while leaving pretty decent quality in the end result. If you wish to adjust the slide bar and test your files at different levels of compression, simply make your changes here.

        To save the compression settings, press the OK button.




      • < Step 1d > : If your audio files are already in use within your RPG Maker project, you will need to change another option to keep the program from renaming your files as it encodes them. Within the Encoders tab and under the Filename Pattern subsection, click on the drop down menu and select the <filename> option. This will maintain the naming conventions that you currently have in place. Otherwise, the program will use any metadata tags (ID3, OGG comments, etc) to rename the compressed file.




      • < Step 2a > : Now we'll add the files that we want to compress to the joblist. To do this, simply click on the Add Files button, or click on the drop down arrow beside the button for more options. In this example, I will be using the From Directory ... option, as this allows me to add an entire directory of audio very quickly.




      • < Step 2b > : After clicking on the Browse button on the Add Directory window, we'll navigate to and then select the directory which contains the source audio files. After selecting the directory, press the OK button and the program will add the files to its joblist.




      • < Step 3 > : Now that the audio files have been added to the joblist, make sure that the Output Dir is set to the directory where you wish to have the compressed output sent to.

        Next, we'll make certain that our current encoder is set to Ogg Vorbis. This can easily be determined by looking at the Selected Encoder field which is just above the Output Dir field near the bottom of the program window.

        Once everything is set, we can start encoding either by pressing the Start Encoding toolbar button near the file menu at the top of the program window, or clicking on the Encode menu and selecting the Start Encoding option.




      • < Step 4 > : And we're done! Verify that all of the files have been encoded properly by listening to them before adding them to your project.




      • < Step 5 > (Optional) : If you're worried about heavy loss of quality, you could use Audacity or your favorite media player to toggle between each file, listening carefully to determine if more quality should be applied. Simply return to Step 1c and change the quality setting should you feel that more quality is needed. However, remember that often you will be the only one to notice small drops in quality once your game is released.

        You could also use MCP to play the songs side-by-side as well as view the spectrum analysis from each file. The screen shot below shows the program in use. The bars represent audio data that is currently being played. If the files were exactly alike, the bars would also look the same.

        However, you can see that the compressed audio file (green) dropped some data on the right side in order to gain a higher compression rate. This is not immediately a bad thing, since many people will not be able to notice the missing bits. The rest of the data is fairly close, and the audio still sounds good, so we'll keep the compressed version for the project.




  • Extreme
Spoiler for Extreme Category:
  • \ { Base Directory }
    • < Executable Packing (XP/VX) >
      Although this is wandering into the realm of silliness, you can also shave around 30 kb from the Game.EXE file by using an executable packer. There are many options available for such compressors, although I would suggest using the following program :

      • UPX (Ultimate Packer for eXecutables)
        This is the portable GUI version of the popular UPX program. Quick, reliable and fairly easy to use. No installation required; free to use. Using the following options should allow for optimal compression while not interfering with the normal operation of the executable :



        After packing the executable, remember to run and play through your game to check for any incompatibilities that might arise, although there really should not be any. If everything is running fine, delete the backup file Game.EX~. If the game crashes or displays problems after compression, delete the packed executable and rename the backup file to take its place.


  • \ Audio
    • < Time Compression (XP/VX) >
      Another trick that can be added to a fanatical kilobyte killer's arsenal utilizes RPG Maker's built-in audio pitch control.

      Using Audacity, you can change the speed at which the song plays. Since increasing the speed lowers the amount of time that the song is playing, this also means that it will take up less space once it is compressed. Normally, the newly altered song would sound like something that the Chipmunks performed, but once you import it into your RPG Maker project you can use the native pitch control to slow down the song and thereby making it listenable once more.

      The downside to this trick is that if you have a looping OGG file, you will have to find the loop points within the squished audio data all over again. Also, compressing the audio in this way may degrade its quality. Generally, I squeeze about 300 to 500 kilobytes from each file (comparing original compressed OGG versus time compressed OGG) that I apply this method to, which may not seem like much but it can add up quickly.

      Spoiler for Time Compression:
      • < Step 1 > : Launch Audacity and open the file that you wish to use. I would suggest using the highest quality of source audio available to you.


      • < Step 2 > : We'll now click on the Edit menu and place the mouse over the Select option to expand another menu. Next, we'll click on the All option to select the entire length of the audio file.


      • < Step 3a > : After that, we'll click on the Effect menu and select the Speed option which will bring up the Change Speed window.



        Here you can enter the amount of change you wish to apply to the speed of the song. I would suggest entering a value divisible by five, as the pitch slider bar in RPG Maker goes up or down in increments of five. Also, since RPG Maker only allows you to alter the pitch up to fifty percent in either direction, you should not enter a value above fifty. Personally, I use either a value of 25 or 50.

        After entering the amount that you want, press the OK button and Audacity will begin altering the speed of the song.


      • < Step 3b > : If this is a file that you are wanting to use OGG looping with, remember to find the loop points again and write down the selection start and end information. See my video tutorial above about OGG looping if you are not familiar with how it works.


      • < Step 4a > : Now that we have sped up the song, all that needs to be done is export the new audio data and compress it. This can be done by clicking on the File menu and selecting the Export option.

        The Export File window should then appear and you can either select MP3 or Ogg Vorbis from the Save As Type drop down menu. Personally, I prefer using fre:ac for the encoding of my media files, so I will export the audio data as WAV (Microsoft) to keep the source audio quality high for now. Follow my tutorial on media compression above if you are following my route.

        If you are using the MP3 or Ogg Vorbis options, remember to click on the Options button on the lower right-hand side of the window and choose your desired compression settings.


      • < Step 4b > : Regardless of what format you choose, after you click the OK button, an Edit Metadata window will now appear. Again, if you are using OGG looping you will want to input the selection start and end information here. If not, simply click the OK button to instruct Audacity to begin exporting the newly sped up audio file.


      • < Step 5 > : Import the newly compressed file into your RPG Maker project. You may wish to click on the Tools menu and select the Sound Test option to try and find the correct pitch setting to restore the proper playback.



        The displayed settings above are for an audio file which was sped up by fifty percent.



  • \ Data
    • < .RVDATA Compression (VX) >
      I've currently completed a script to allow for compressing .RVDATA within the Data directory, as its total size can often roam higher than 4 mb in large projects. Current test runs have dropped the size from roughly 5 mb to 500-ish kb (200 maps, full compliment of items, armors, weapons and animations). No third party DLLs or EXEs required.

    • < .RVDATA2 Compression (VXA) >
      Jet has ported over his own compression script to VXA, allowing for .RVDATA2 files within the Data directory to be compressed.

    • < Scripts.(RXDATA/RVDATA) Comment Removal (XP/VX) >
      Although the Scripts.(rxdata/rvdata) file cannot be compressed by the Compact RVData script above, it can still be optimized by removing commented lines and carriage returns. Zeriab has created a project for doing just that and I believe that it does its job well. For example, I have taken a heavily commented Scripts.rvdata which was 270 kb and come away with a 170 kb file after.

      It should be noted that removing the comments and carriage returns will make reading the code very difficult and should only be done when you are ready to release your game. You should also make a copy of your original Scripts.(rxdata/rvdata) and over-write the optimized version after having finalized your compressed distribution file.

      NOTE : There are no guarantees by the author of this project that scripts will be in complete working order after the comments and carriage returns are removed. Please test your game thoroughly before releasing the finished product.

      • Zeriab's Remove Comments (XP/VX)
        To use, place your Scripts.(rxdata/rvdata) file in the Input folder and run Game.exe. This project will require the RPG Maker XP RTP if you do not already have it installed.

« Last Edit: October 24, 2012, 01:01:59 AM by Exhydra »



Is your RPG Maker project optimized? Optimize it!
( TUTORIAL UPDATED 10/23/12 - Revision 2.1 )

Need tools for your RPG Maker project? Browse some!
( LIST UPDATED 10/09/12 - Revision 1.3 )

*
uhuhuhuh
Rep:
Level 75
I've got a good feeling about this one.
2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Very nice tutorial, Exhydra. I look forward to seeing more of this, and more games that won't take up 500 MB.

*
Rep:
Level 96
2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
This is a great tutorial. Nice work Exhydra! Where did you come from anyway? You're so helpful and awesome and I'm not used to that in new members - it's creeping me out :P

*****
Rep:
Level 82
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
http://rmrk.net/index.php?topic=38957.0

This is a cool tool made by Yeyinde for checking if you have unused files in your RM Folder.  Seems a bit faster than Jet's Integrity Script. Anyways, great tutorial Exhydra!

*****
Rep:
Level 80
2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
Very nice tutorial, Exhydra. I look forward to seeing more of this, and more games that won't take up 500 MB.

Thank you! More on the way in regards to audio, which generally causes the most project bloat ...




This is a great tutorial. Nice work Exhydra! Where did you come from anyway? You're so helpful and awesome and I'm not used to that in new members - it's creeping me out :P

I've lurked around the RPG Maker scene for a while, so I'm not exactly new-new. Although it was only recently that I've become more vocal and taken a higher interest in scripting and optimization. :o




http://rmrk.net/index.php?topic=38957.0

This is a cool tool made by Yeyinde for checking if you have unused files in your RM Folder.  Seems a bit faster than Jet's Integrity Script. Anyways, great tutorial Exhydra!

Thanks, Cozzie! I've added that tool into the tutorial. I didn't even know it existed.



Is your RPG Maker project optimized? Optimize it!
( TUTORIAL UPDATED 10/23/12 - Revision 2.1 )

Need tools for your RPG Maker project? Browse some!
( LIST UPDATED 10/09/12 - Revision 1.3 )

*****
Rep:
Level 83
I am the wood of my broom
2010 Project of the YearProject of the Month winner for January 2009Project of the Month winner for January 2010Project of the Month winner for April 2010
This is really cool! Thank you for sharing these stuff bro B)
Do you mind if I spread it to other sites as well to help fellow makers? :D


*****
Rep:
Level 80
2013 Project of the Year2013 Best RPG Maker User (Programming)2013 Most Promising ProjectParticipant - GIAW 11Bronze - GIAW 10
Sure, that's fine by me. The more people with non-500 megabyte projects, the better!  :o



Is your RPG Maker project optimized? Optimize it!
( TUTORIAL UPDATED 10/23/12 - Revision 2.1 )

Need tools for your RPG Maker project? Browse some!
( LIST UPDATED 10/09/12 - Revision 1.3 )

**
Rep:
Level 65
Whatever can go wrong, will go wrong.
Thank you very much for this. You've made my day ;)

**
Rep:
Level 56
Eager to learn
Thank you for making this! this helped me so much and now i am happy and still using these tutorials to help me ;8

Practice doesn't make perfect. Perfect practice makes perfect



*
RMRK's dad
Rep:
Level 84
It hurts because it mattered
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Where have I been? Just found this thread and I am excited to run my VX project throught the steps to reduce its filesize!
:tinysmile: