Welcome to My World

Hey everyone, Conash here! With the recent public release of Harem Collector v0.46, I thought now might be a good opportunity to talk about the new modding feature we have! Though this is more going to be a, “How we added it” sorta blog post rather than “How to make them”, for that information I would advise checking out the mod section of our forums (found here) or to join our discord via the link under the ‘Follow Us’ section to find advice or ask questions. Now then, on with the show!

To begin with, it’d probably be good to start with what prompted me to want to get into this. I was already pretty familiar with a lot of the way that RPG Maker stores it’s data files. Heck, the fact that we have the lite releases is because there’s only one file that you have to change to update the game, and we’ve already had a few fans modding their own games with stuff like Cazador’s oldschool Faceset mod, Romeo and Moonblack’s Cerulean+Wiki tan mod, or Omegon’s Extra Hard Mode mod. What really got the ball rolling is I was chatting with a good friend of mine who was thinking of trying their hand at making a mod that would add in an often requested sex scene of that we aren’t planning to add in ourselves. I was inspired to give fans the means not only to make thier own mods but for other players to install them, as a legitimate option in the game.

Any of you who’ve worked with RPG Maker probably have a bit of an idea as to how this wasn’t exactly going to be an easy road, especially those of you who have made scripts in Ruby before. The original plan that I had wasn’t too hard to implement after I did some digging, cross referencing the ‘Index’ they include with the software alongside some scripts we have and a few google searches to learn a few of the various command options you have with the ‘File’ class, but I found what I needed. You see, RPG Maker has a custom made ‘Load Data’ function built into it, based off of some pre-existing functions in Ruby that accomplish something similar. This not only allows it to read data from it’s specially encrypted data, but prioritizes it. This is all well and good for standard play, but I need it so that even when players have an encrypted data set it will sometimes load non-encrypted data stored elsewhere. Not wanting to really divide too deep into how the ‘load_data’ function worked, I instead opted to create a function that would have it so that anytime it tried to load, say, ‘Data/Map003.rvdata2’ it’d first add ‘Mods/’ to the start of it, so if it found a file at ‘Mods/Data/Map003.rvdata2’ it’d load that one instead. This method would work great for Cazador’s mod since that’s exactly what was needed for a graphical mod, and it’s work fine for Romeo and Moonblack’s mod as it was basically built to function this way, but since our game is still in development this function alone wouldn’t be enough.

See, if we take Omegon’s Extra Hard Mode as an example, that mod works by changing how the invisible Hard Mode status works, but with every release of the game we usually add in more status effects so if the game was set to load his file instead of the in-game file it’d risk breaking the game for every release after the mod was made. The same thing would happen for Common Event data, Enemy data, Item data, various things like that, something with a bit more nuance was needed. Now, I’ve got a bit of experience not only working with third party scripts but also making some third party scripts of my own for other games, and for those of you unaware we generally try to setup our codes to make use of ‘tags’. ‘Tags’ are various unique text that you add to something that will create a special interaction with the code we made that way the game developer doesn’t need to have their own resident Conash to custom build every little programming thing, so I decided the best way to go about this was to integrate that into here. This is easy enough for Items, Enemies, Actors, and most of the databases, the modder in question will add a ‘<Modded>’ tag into the ‘note’ section (one of the few times that I will praise Enterbrain for their forward thinking as that section is a godsend for us third party programmers), I then setup my code so that when it’s loading in these databases it will check for a ‘Mods/Data/Enemies/’ folder, create an array of all the files in there, load them up one by one so long as they have ‘.rvdata2’ in their name, and check every entry, if it includes the ‘<Modded>’ tag then it’s to replace the base database, determined by the above paragraph, then it replaces the base database’s entry with this ‘<Modded>’ version. I did worry this might cause some slowdown, but it only runs this once when it starts the game and it should only cause slow down if you’ve got a lot of mods installed. There was however a bit of a snag with this problem, see there are three databases which don’t have a note section. The Animation database, the Troop database, and the Common Events database. Eventually I settled on a way to add tags to these anyways, by either including ‘<Modded>’ in the name of the animation, or by going to the common event/first page of the Troop in question and making the first line of it be a comment that only says ‘<Modded>’. Not the prettiest or most intuitive methods but it functionally accomplishes the same thing. One nice advantage of this more complex modding method though is that it’s also future proofing itself a bit, while I worry that some modders may find it cumbersome to create mods that go into the ‘Mods/Data/CommonEvents/’ folder, this method allows my code to know what the data is to be used for based on the folder it’s in while also allowing the modder to name it say ‘ChimeiTranslated’ or something both so that it doesn’t overwrite their ‘3DSexScene’ Common event data and so that if they ever want to uninstall the mod they know exactly what file does what. This method took me awhile longer to figure out since I had to get all the pieces moving right, but I am happy with how it came out.

Another little modding issue that came up, Maps. See, because of the nature of how the data in RPG Maker maps are stored you can’t exactly just add ‘<Modded>’ and expect it to translate nicely, there’s so many different types of data stored in Maps that I was left with leaving them with the more simple modding that I described before, but that wasn’t exactly going to be satisfactory because several players had expressed interest in making their own custom maps that weren’t in the game already. One noteable example of this is HorseHater who’s working on a custom dungeon where you bring all of the Iron Waifu champions and get to interact with them, I’ve gotten to see a bit of it and highly recommend you keep an eye out for it in the forums! Getting back on track though, there are two major issues that arise with this in that you’d have to coordinate with others what map data you’d be replacing as to not make two mods that try to use say Map950 to store their custom data, but also RPG Maker offloads a lot of the data for all maps into the ‘MapInfo’ file, which means you’d run into the exact same issue that Omegon was having if you want your map to be functional. This is where Map Packs come into play. See, I had this idea where I’d allow the game to store a string that it’d then use to intercept the process of grabbing map data, this would allow modders to say edit an existing map to have a specific script call to load in the name of their map pack, and then transfer the player to one of the maps in it, and then give them a way to return to the base game when done. As long as the player included all the relevant map files and the MapInfo file from when they made the maps this would all be simple right? Well, the first problem is setting up a way for players to enter your Map Pack. They could edit an existing map but that would pose some risks of stepping on the toes of other modders, needing to update their chosen map if we change it later, or various other things, so I wanted to have a way to work into the base game a way to access these Map Packs so that the modder wouldn’t be required to create their own front-door if you would. That’s when I remembered the code machine. You see, when you enter a name into the code machine, with how we have it working it stores whatever you enter as a string, with that knowledge I set it up so that if you entered ‘Map Pack’ as a code, it then asks for a second code, using this it will load the player into Map001 inside the folder of whatever map pack you entered there! I also set it up so that the player will be blind, in the event the modder needed to move you somewhere else or they didn’t like my little back-door entrance so they wanted to send you back for you to enter some other way.

Everything is good with map packs now right? Not exactly, the next issue would be Self switches. Self switches are used a lot in RPG Maker, and are a fundamental tool used for controlling event data to make sure things work properly. See, if I left things at this stage it would open a lot of potential bugs with self switches. How you might be asking? Well, even though it looks like self switches are connected to the events that reference them, they aren’t, at least not directly. Self Switches are all stored independently in the game data, the game just stores each switch in a unique location based on the ID of the map that called for it, the Event it’s associated with, and if it’s switch A, B, C, or D. The thing with Map Packs is they would allow a theoretical infinite number of events that are on different maps sharing the same Map ID and have the same event ID, making it so that if you got unlucky these map packs could start stepping on either one another’s toes or worry about conflicts with the base game. The fix to this one however was easy, I added it in so that if the string where it stores your Map Pack ID has a string in it, that’s also used to determine where it stores the Self Switch, now you’d not only need to have the same Map ID, Event ID, but also the same folder name for the Map Pack, but by that point one set of MapInfo data is already going to have to overwrite the other so I think we’re safe at this point. I have also additionally added in the ability to include ‘Enemy’ data inside Map Packs, this is so that you can have unique enemies for a custom made dungeon that only appear inside the map pack. We ran into a few issues with that though, namely since we used the Yanfly Battle system it turns out that there was some code there that added in extra enemy data that’s not in a base file whenever you loaded the game, and this extra data was required to not crash the game whenever the enemies attacked. The fix to that issue was to just load in this extra data both when loading in the new enemy data, and when returning to the old enemy data when the player returns to the base game. Man, if you ever try to add modding into your own RPG Maker VX Ace game for some reason, if you hit this point you’ll probably find that the most important command throughout all of this is the ‘File.file?’ command to make sure that there’s a file at the location you’re looking at before you try to load in data that doesn’t exist.

This may all seem fairly comprehensive to all of you, but there was one last point that I sorta glossed over throughout all of this, script modding. Script modding is a bit different, see while most files in the ‘Data’ folder are handled by the ‘DataManager’, the ‘DataManger’ itself is apart of the script data. What actually determines the script data being loaded is a combination of the .ini file and some of the secret code Enterbrain doesn’t let us see, heck viewing said secret code would even break the Terms of Service so I don’t advice any of you go looking for it either. Still, this leaves me in a bit of a bind because script are a huge part of how the game runs, and not allowing modding in for them would close off a large segment of options to modders. For now though, I’ve managed to get it into the 0.46.4 release so that if you include either some ‘.rvdata2’ or even a ‘.txt’ file inside the ‘Mods/Data/Scripts/’ folder that the game will run it both when you start a new game and when you load an existing game, this won’t be able to replace any existing script data sadly, as it seems to either hold that data on a higher level or constantly reads it in again overwriting any changes you tried to make. I have also talked with Romeo some more, and I’ve got another addition, ‘Map Scripts’ as I like to call them which will basically serve the same role only they’ll be loaded in every time you change to a different screen in RPG Maker (this distinction is mainly to handle load times while still giving people who like to mess with this stuff a wide range of options), which will help open a few more doors, but sadly I’m afraid that at this time I’m unable to add in the full functionality that script modding would need. I’ll keep looking for how to add in the few bits of script based functionality that are missing in, but I wouldn’t hold your breathe since I’ve hit multiple dead ends on this matter.

But yeah, hope that my rambling didn’t devolve into incoherent nonsense and that a few of you at least enjoyed listening to me gush about programming and how I am totally super smart. Either way, I’ll see you all later (hopefully when I actually get to detailing out what the Yamamaya redesign entailed >.<).

Leave a Reply