Tool RPGM RPGMaker MV Tool to strip unused files and save space

Darksshades

Member
Feb 7, 2020
127
408
I've made a little tool that scans an rpgmaker mv project data folder for unused files and moves them outside of the project to be deleted.
The tool will move the files to 'www/removed', it'll not remove the files, you need to delete that folder yourself.

I'm aware that there is an official feature on rpgmaker mv
when you build your game to strip unused files but its VERY rare to see devs that actually use this in the fear that it'll break some plugin.

The tool comes with a .json file that it'll use to map removeable files. In short, it'll only try to remove files that came from the default empty rpgmaker project. You can generate another json or parse all the project files if you want but its not recommended as the chances it'll break a plugin are high.
This is a cli tool, the instructions are inside and there is also a -h option but I've also added a .bat file for easy execution. Just execute and paste the project www folder path.

So far I've tested it on a few simple small games and it seems to remove on average 100-150 MB of data without breaking the game.

As it only tries to remove the default rpgmaker files, if any plugin breaks, you can easily restore the original file from any new rpgmaker project.

The tool and the source code are in the attachments.
This tool is for rpgmaker MV only! (it'll not work on MZ)
If the project has a www folder its most likely an MV project.

-------------------------------------------
Bonnus tip - Reducing size even more - removing the nw.dll dependency, kinda.

A big chunk of an rpgmaker game is the nw.dll file which is a nwjs file that rpgmaker games runs on. Its basically the fake browser that renders the game, its packaged with browser features that are not used for the game, with each update increasing the size even further.
If you have several rpgamaker games installed, those 80mb to 180mb files stacks up.
To alleviate this problem you can create a folder on your PC to store a common nw.dll to be used by ALL the rpgmaker games.
The nw.dll comes in several different versions and sizes but those changes are not related to the rpgmaker game engine itself and you can use an older or newer version of nw.dll most of the times. Worst case, you can keep multiple copies of the nw.js and use the other if the one you tried doesn't work for other games. I personally use the 82MB 2018 ver of nw.dll for MV projects.
MZ projects might need a newer version because it runs on a 'newer rpgmaker engine'.

Anyways, on windows you can use a mklink command to create a symbolic link to the common usage nw.dll file. On linux you can use an ln command to do the same.
I'll attach a simple .bat script that I use to speedup this, you just need to edit it and change the location of the common usage real nw.dll files.
Execute the .bat file and paste the game folder and it'll put the symbolic link there, just make sure to remove the nw.dll from the game's folder first.

-----EDIT:
lol, I just saw that f95 tagged [VIRUS]. I didn't know this existed. I guess its because there is a lot of reading files and moving files around or maybe some random python lib that got packaged in with the pyinstaller. I didn't use virtual env for this.
Anyways, feel free to execute the program directly for the python source. I'm almost sure I only used standard libraries
 
Last edited:
  • Like
Reactions: Surgy

Miralissa

Maybe?... ;)
Game Developer
Nov 26, 2021
210
242
Sorry, can I see a more detailed instruction on how to use .bat? I really do not understand where to put it and what to write in
"Enter folder path: " and mklink section. Can you show some example? Thank you.
 

Darksshades

Member
Feb 7, 2020
127
408
Sorry, can I see a more detailed instruction on how to use .bat? I really do not understand where to put it and what to write in
"Enter folder path: " and mklink section. Can you show some example? Thank you.
Sure. Basically you can execute the .bat from anywhere, it just need to be in the same folder as the "main_rpgmaker_strip_files.exe". The bat file is just a shortcut to execute the CLI tool for those who don't know how to use cli tools.
So, when you execute the "execute_strip.bat" it'll ask for the rpgmaker mv project www folder.
Copy the path link to the game www folder from windows explorer.
Execute the .bat file and right click anywhere on the console window and it'll paste whatever is copied in the clipboard.
Paste the game path and hit enter and it should work.

So to execute to strip you have to have: The .bat, the .exe and the 2 .jsons in the same folder. Execute the bat. The game don't need to be in the same folder. Just paste the game's www folder and hit enter
stp1.jpg

If everything works well, there will be a folder named 'removed' inside the www folder with all the potentially unused assets.
If you delete them if the game works. And if later anything breaks, the program only tries to remove standard assets so you can easilly restore them by taking the assets from an empty project.

------
The mklink one is a bit more involved.
You actually need to edit the .bat file.
Right click it and choose edit to open it as a text file.
stp3.jpg
Copy a copy of nw.dll to a folder to be used as a shared nw.dll. Note that you can't rename the folder later or you'll break any future mklinks already made.
And change the PATH in red to the path in your computer which will store the nw.dll that will be used for ALL the games.

Now go to the game and rename or delete the nw.dll there as it'll be using the shared one later.
Doing that, you can execute the .bat. But you need to do it with admin privileges as mklink can only be executed as admin.
Then when it asks for the path copy the path for the game root folder (where the nw.dll is)
Right click the console to paste and hit enter.
Hit enter again to close the window.

If everything works well, there will be a symbolic link created in the game's folder.
stp2.jpg

Try the game to see if everything works. Some versions of nw.dll might be incompatible so just be sure the game loads.
 

Miralissa

Maybe?... ;)
Game Developer
Nov 26, 2021
210
242
Thank you, it worked. I received a link. The game opened with just a black screen (I think I can beat it).
As I understand it, your method makes a link only to the "nw.dll" file. This is very cool.
But maybe there is a way to get a link that will launch the game with only the project files
(without folders "locales", "swiftshader", files "nw_elf.dll" etc)?
For example, file "Game.exe"from the folder with the game using such link, uses the entire folder from the RPG Maker to launch?
Not sure, but...).
In any case, thank you very much!
 

Onishirayuki

Newbie
Jun 27, 2019
24
39
This is nice guide. if u have a lot rpgmv/mz game maybe this useful.
sorry for op but i try another way.
i use this app,