Tool RPGM rpgmpacker: tool for packaging RPG Maker games in an automated pipeline

erri120

Newbie
Jul 11, 2020
52
46
Please post issues on as I'm more likely to see your issue there.
 
Last edited:

erri120

Newbie
Jul 11, 2020
52
46
Guide on how to use this for a build pipeline can be found .
 
Last edited:

kin-kun

Active Member
Modder
Jul 10, 2020
963
2,401
First, good job. I've been thinking about doing something like this and it just saves me time. I appreciate that.

Second, there's a few things that would be helpful:
  1. How to build from source (I've loaded your project in VSCode, not sure how to build)
  2. Allow a config file (yes I can add it to a make file or similar, but that makes sharing things like the RPGMaker directory every project is using a copy and paste thing, rather than include a base config file.)
If you could add these items, it would make other's life much easier. Guess I'm digging into cmake to figure out how to build this.

Edit:
moving more comments to new post
 
Last edited:

erri120

Newbie
Jul 11, 2020
52
46
I will create some more detailed docs about how to build from source but for now just check the GitHub Actions workflow I created: . You basically just create a build directory, configure cmake with source and build output path and then just build the project. I also used VS Code when I started creating the project but have moved on to CLion. Check the VS Code docs for getting a C/C++ dev environment going: .

As for the config file, what exactly do you want to configure? Only thing that comes to mind is using a config file instead of passing CLI arguments to the tool. I recommend for this so I can keep track of it.
 

erri120

Newbie
Jul 11, 2020
52
46
First, good job. I've been thinking about doing something like this and it just saves me time. I appreciate that.

Second, there's a few things that would be helpful:
  1. How to build from source (I've loaded your project in VSCode, not sure how to build)
  2. Allow a config file (yes I can add it to a make file or similar, but that makes sharing things like the RPGMaker directory every project is using a copy and paste thing, rather than include a base config file.)
If you could add these items, it would make other's life much easier. Guess I'm digging into cmake to figure out how to build this.
Added a file to the repo.
 

kin-kun

Active Member
Modder
Jul 10, 2020
963
2,401
I will create some more detailed docs about how to build from source but for now just check the GitHub Actions workflow I created: . You basically just create a build directory, configure cmake with source and build output path and then just build the project. I also used VS Code when I started creating the project but have moved on to CLion. Check the VS Code docs for getting a C/C++ dev environment going: .

As for the config file, what exactly do you want to configure? Only thing that comes to mind is using a config file instead of passing CLI arguments to the tool. I recommend for this so I can keep track of it.
So I figured out CMake in VSCode finally. Thank you very much.

What comes to mind in terms of configuring, is things like the RPGMaker Directory/Directories (it might be nice to be able to specify both version and have the tool use the right one, or pass a switch to tell it which one to use.

Platforms is another thing that comes to mind.

Although I realized, there's a reasonably way to just bring in the options for all my projects through bash.

If I have a bash script with my common options:
Bash:
#!/bin/bash
packer_options+=("--platforms" "linux,win")
packer_options+=("--rpgmaker" "${rpgmaker_tools}/RPG Maker MV")
packer_options+=("--cache" "--hardlinks")
packer_options+=("--threads" "8")
I can bring it in a build script the runs it via:
Bash:
#!/bin/bash
rpgmaker_tools="<MY TOOLS DIRECTORY>"

packer_options=()
source "${rpgmaker_tools}/etc/packer_options_mv.bash"
packer_options+=("--encryptAudio" "--encryptImages" "--encryptionKey" "MYKEY")
packer_options+=("--input" "./<PROJECT_DIRECTORY>")
packer_options+=("--output" "<OUTPUT DIRECTORY>")
packer="${rpgmaker_tools}/bin/RPGMPacker"

"${packer}" "${packer_options[@]}"
Obviously this is not what you might do Windows. That said, feel free to add it as an example to your code base.

Two more things:
  1. You copy the save directory to the output, rpgmaker mv doesn't do that.
  2. In main.cpp line 287, you didn't initialize succeeded and failed values to 0. You need to do that, otherwise you may get a message at the end saying there are failures, with no indication as to what failed.

Edit:
Oh, and about using GitHub issues, I'd love to, but that might expose personally identifiable information which I'd rather keep anonymous. I need to look into getting another (anonymous) account.
 

kin-kun

Active Member
Modder
Jul 10, 2020
963
2,401
erri120
Found one issue, you're updating of the system.json may not work if there's an extra linefeed or something else.

Proper fix is the parse the json and update it.

At the same time, writing json files without spaces can save 40+MB for games, so I added a compress json function.

Here's a patch based on commit 8ee70a85dd

It does take more time to create the RPGMaker directories (1.5 s instead of 0.5 on my machine) so you might want to make compressing the json files optional. That said it seriously simplifies your code for updating system.json.
 

erri120

Newbie
Jul 11, 2020
52
46
erri120
Found one issue, you're updating of the system.json may not work if there's an extra linefeed or something else.

Proper fix is the parse the json and update it.

At the same time, writing json files without spaces can save 40+MB for games, so I added a compress json function.

Here's a patch based on commit 8ee70a85dd

It does take more time to create the RPGMaker directories (1.5 s instead of 0.5 on my machine) so you might want to make compressing the json files optional. That said it seriously simplifies your code for updating system.json.
Thanks for the contribution.

The main problem I have with your patch is the use of another json library. The tool already uses for json parsing and adding another one is kinda overkill. What I ended up doing was simply searching for the closing bracket instead of assuming it's always at filelength-1:

I thought about adding JSON minifier originally but did not do so because RPG Maker already saves the json files in a somewhat minified version. It is not 100% minified but it works. Maybe I'll add something like this later on but not at the moment.
 

kin-kun

Active Member
Modder
Jul 10, 2020
963
2,401
Thanks for the contribution.

The main problem I have with your patch is the use of another json library. The tool already uses for json parsing and adding another one is kinda overkill. What I ended up doing was simply searching for the closing bracket instead of assuming it's always at filelength-1:

I thought about adding JSON minifier originally but did not do so because RPG Maker already saves the json files in a somewhat minified version. It is not 100% minified but it works. Maybe I'll add something like this later on but not at the moment.
I tried using the library you had, but the data structure it built was immutable, so I had to bring in something else. (This actually took a while for me since I had to learn how CPM works with Cmake, and I'm still scratching my head as to why I had to explicitly define the library I added for the include directory, when the others appear to be added implicitly.) I thought that might be a sticking point.

The problem with just looking for the closing brace is, if those items are defined (which happens sometimes when bringing in a game that already exists) then there will be two copies making the JSON invalid.

Edit:
Oh about the minified JSON, I typically see a size reduction of 20+ MB over the original from RPGMaker MV. Given that the games I works with are about 500 MB once the resources are compressed properly or removed if not needed, that's actually a pretty significant chunk of space to get back.
 
Last edited:
  • Like
Reactions: prosmoker1

aura-dev

Active Member
Game Developer
Mar 1, 2021
854
1,987
I'm using the tool to completely automatize my continuous deployment (including automatically building daily and weekly builds for my patron backers!)
I can only recommend it.
 
  • Like
Reactions: erri120

erri120

Newbie
Jul 11, 2020
52
46
rpgmpacker 2.0 is finally out. I've reworked the entire thing and switched from C++ to TypeScript. The should contain all information required for upgrading.