rpgmpacker has been one of my biggest non-modding related projects on GitHub and the only reason people visit my blog:

Top queries of my blog

Top queries of my blog

The developer of the game Star Knightess Aura (NSFW) is the first actual user of this tool and contributed a good amount of issues on GitHub driving the development of this project forward.

With some issues still open I stopped working on this project in April 2021 because I knew I had to rework this tool at some point and didn’t have the motivation to do so at that time. I used C++ for 1.x because I wanted to finally build something with this language. I had only done small assignments in Uni with C++ but never done anything more with it, mainly because the language sucks ass.

C/C++ is old, very old, and it clearly shows, not just in the language but the tooling available. Ask 20 C++ developers what build system they use, and you will likely get 10 different answers. Working with dependencies is a nightmare when it comes to C/C++ development. It’s actually impossible to count the amount of times I wanted to contribute to a C++ project only to be blocked by some weird build system that only works in a specific environment when the stars align and the moon is in the Waxing Gibbous lunar phase. Once you did get something to work you now have to deal with the language itself. Let me ask you this: how do you represent a string in C++? Did you know that there is std::string which is actually just std::basic_string<char>, std::u16string which is std::basic_string<char16_t>, std::u32string which is std::basic_string<char32_t> and std::wstring which is std::basic_string<wchar_t> but don’t let that fool you because there is also char8_t from C++ 20 that introduces std::u8string and don’t forget that wchar_t has different sizes depending on the platform, compiler and time of day?

C++ is a fucking mess. Working with strings in C++ should not be this hard.

So lets calm down and look at something different: Rust. I love Rust, it’s C++ in way better and more modern. I wanted to rework rpgmpacker in Rust and actually did exactly that for quite some time but soon realized this was also not the way.

RPG Maker MV/MZ is pure JavaScript with the data files being in JSON. The developers are probably familiar with JavaScript as well so considering the ecosystem, it is more fitting to create a JavaScript tool. Of course, I wouldn’t be doing that, fuck vanilla JavaScript, I’m using TypeScript.

I like to use the right tool for the job. Even though I’m quite the C# and Rust fanatic I went with TypeScript because it makes life very easy. I don’t have to write complex JSON parsers or DTOs, I can just do JSON.parse(...) and access whatever I want. One huge problem was also parsing the plugins for the exclude-unused feature. If you open js/plugins.js in your game, you will find a variable $plugins. With TypeScript I can just use the VM to dynamically load this file and access this variable directly. With any other language I would have to read the file as a string and do some complex string parsing.

Of course there are some problems with TypeScript. I previously complained about the C++ dependency systems but the huge dependency trees you can get when using NPM are also insane. Before I even started on the rework I set my goal to require the least amount of modules which ended up being only 1: yargs because parsing arguments is not something I want to implement myself.

I hope the rework will be received pleasantly by the 2 people using the tool.