Mod Support Devlog 1: Scripts
It's been awhile since the last dev log I shared, been busy with my job and some other IRL stuff y'know, just before we go in the actual devlog I wanted to say that I am still working on the mod, although at this point, this mod has gone from a simple and easy mod that tried to enhance a little bit the original game with new easy features like the sex diary thing and the fame system back in 2022 to almost a full game project (for one person at least
), not that I whine, I still want to work on it like the first day and create a good product from it, it is not like I'm putting my life on it I just making this on my free time and whenever I feel like it, I understand people would like to play the finished mod right now (me too) but I cannot give a release date for v0.2 (or any other later version) because I cannot determine exactly how much time I need to finish what I have right now, don't want to sound rude tho lol I never expected this thread would get this much attention to begin with.
Also, I think some people expect version v0.2 (or any version 0.*) to have playable/fappable content like other games on this site, I don't want to do that for this mod, I would like version 1.0 to be both the final product and the first version with all playable content, and from there, expand with more content. Which means I'm going to use all these 0.* versions to test systems and balance the game, once I'm happy, I'll start working on v1.0, which will have all the story and events I've been thinking about, also there won't be a lot of v0.* releases, (I expect v0.4 will be the last version which will include the battle system overhaul) like I said, once I'm happy with the base, v1.0 development will start.
For example, these are some features which I consider key-features that needs to be implemented before v1.0:
- *Everything that it is currently on the "In Progress" list on Trello*
- Actors Schedule System
- Mod In-Game Event Conditions
- Ties to the new game story
- Quest System
- Ties to the new game story
- Battle System Overhaul
- Ties to the new game story
- Approach System
- Makes it fun to actually move around in the game and not going from event A to event B
- Follower/Player Random Events
- Makes it fun to actually move around in the game and not going from event A to event B
- Sana Controllable
- Ties to the new game story
- Sana Jobs
- Ties to the new game story
- Sana's Status & Standing Picture
- Shows the current state of Sana on the screen
- Secret NTR Mode
- Ties to the new game story
- Mod Support
- Expands the game with new content
- All of above needs to be expandable to let mods avoid monkey-patching the mod's core
Later v0.* versions will include the things I said above in no particular order
tldr of above: I'm still working on the mod, no ETA for v0.2 tho.
____________________________________________________________________________________________________________
So to the actual devlog part, while I was working on the sex framework I was thinking that I should make it modular so other people could add new animations easily without too much trouble, then I realized that I should expand this modularity to the rest of the mod, not only the sex framework, so in the process of making sana revamped as modular as possible I started the bare-bones of what it will be the mod support system and allow the game to load mods and apply them on runtime (a mod that loads other mods, ironically).
RPG Maker is probably not the best engine to support modding since its data structures are pretty static, but I think I can achieve something good enough to spend time on this, the result may not be the best mod support system ever, but I will try to make the process of making mods as easy as possible
For this first devlog I have managed to get the game to read any number of mods and apply all scripts they may have inside the appropiate folder.
How it works
All mods must be folders and must be located inside a relative directory from the game's folder as well as have an specific JSON file which contains information about that mod in particular, this is an example of the mods folder:
The load order file will be created and can be modified by the user, it will determine the order in which the mods applies their contributions to the game, so you can make
Mod A be loaded after
Mod B or
Mod C.
Inside "example_mod"
The file "
mod_info.json" is the file that provides information about the mod, and must be present to consider that mod as valid, otherwise it won't be loaded.
For example this is what it looks like for the mod "example_mod"
JSON:
{
// Unique mod ID (should not change)
"ModId": "johndoe_myfirstmod",
// Mod version
"ModVersion": "1.0.0",
// Mod author
"ModAuthor": "John Doe",
// Mod name
"ModName": "My First Mod",
// Mod description
"ModDescription": "My first mod description",
// List of other mod IDs that should be loaded before this mod
"ModRequirements": []
}
For now, only the
Scripts folder is usable other folders (Graphics, Audio, Translations...) will be added and I'll explain them with another devlog.
For scripts I plan to support two formats,
loose script files and
packaged script files.
The
Scripts folder of the mod "example_mod" looks like this:
As you can see, there are both
loose files (init.rb) and a
packaged file (Scripts.rvdata2), when loading mods, the loose files will be prioritized over the packaged file, which means that, if
init.rb modifies a script inside
Scripts.rvdata2, init.rb will win the conflict between these two.
The good thing about the packaged file is that it can contain any script files and it allows you to specify the order between them, unlike having loose files, which order will be determined alphabetically, so packages will be the preferrable method
.
Here's an example of running the game loading the scripts of "example_mod":
Mods initialization will be done once every module of sana revamped's core (Tygct::Core) is initialized.
As you can see, I have defined two methods inside Scripts.rvdata2 (method a, and method b), the loose file overwritten method b so that's why the logger wrote that.
Scripts.rvdata2 contents
Code:
module JohnDoe
module MyFirstMod
# Include sana revamped's core modules
include Tygct::Core
def self.packaged_method_a
log_info 'this is the packaged method A from the rvdata2 file'
end
def self.packaged_method_b
log_info 'this is the packaged method B from the rvdata2 file'
end
def self.init
log_info 'Initializing my first mod ever...'
log_info "I'm using the sana revamped logger inside my mod code!"
packaged_method_a
packaged_method_b
log_info 'Initialization completed!'
end
# Mod support will send this event and execute the given callback
register_for_mod_event(ModEvents::Events::EV_GAME_INIT, 'init')
end
end
Loose file contents
Code:
module JohnDoe
module MyFirstMod
def self.packaged_method_a
log_info 'packaged method a has been overwritten by a loose file'
end
end
end
As you can see, A module called
ModEvents is used to initialize the mod, I will cover this one later on another devlog, this one is long enough already.
Caveats
For modders, you will be able to do pretty much everything you want with your scripts, I won't add any limitations, meaning that you can even break the game if you want to.
For users, you may not desire this because anyone can run malicious code using the mod system, but this is needed to allow expanding the game using mods and not be troublesome for modders.
To be honest, since Ruby is a very flexible language, it is not worth to protect you about this since there will be always a way to
bypass any limitation I may add (like overwriting my Mods module to remove limitations, monkey-patching, etc...)
So if any modder in the future creates a mod for sana revamped
that contains scripts files (whether packaged or loose), you may want to check first if they are known in this site (like a reputable modder) or at least check yourself the scripts to make sure no malicious code will be running when you start the game, or use a tool like rubocop that warns you about security issues on any Ruby source code.
Scripts are the only thing a mod can contribute that may be malicious, other things like images (Graphics), translations, new items, new weapons, armors, etc... won't be dangerous.
For the next devlog about mod support I'll talk about adding custom settings to the game's setting menu (the one I shared some months ago) and serialization of mod data, I want to try my best to avoid save file corruption if a mod is installed and removed.
Heyy any idea when v0.2 is gonna drop?
I wish I could give you a definite answer but as for now I cannot, worry not, because I'm still working on it and making progress