Description

Live Chat: Discord.
Get the latest builds: Patreon.
Get Mods here: Reddit.
Public Version for Heroine Rescue Team (v0.51): Here.
Download for Heroine Rumble is at the Heroine Rumble page.

Thursday, May 31, 2018

Modding Support

From the poll, it seems that is an overwhelming interest in modding the game. So I have taken the liberty to implement modding support for equitable items in addition to animations. I believe these two are the most common uses of modding, beyond things like tweaks and “cheats” so it makes sense to start with these two. Of course, I also need to explain how to mod / add new content to the game, so here it is.

However, before I get to that, I like to take a moment to talk about some design considerations on the modding system as it current stands. The most important consideration, believe it or not, is for me to create something that works without spending too much time on it. Why is this the case?

Well, first of all, I still got a game to make, so I don’t want to spent too much time on this detour. Secondly, despite the many responses that express interest in adding content, I am a little skeptical on how much new content will be made. I certainly don’t want to spend months to make a kickass modding system that nobody uses in the end. Hence, it is better to start with a minimal viable product and go from there. Finally, I assume that for those that will actually make new content, they are probably enthusiasts and is willing to work through a little hassle.

At the same time, the mod system can’t be too crude. It also needs to be extensible and flexible, with the ideal that mods created today can work with mods in the future.

For the users/consumers, the “installation” should be as hassle free as possible. Ideally - as simple as dragging a folder into the mod file or perhaps an “install mod” button in the in-game mod browser. But unfortunately, it just isn’t there yet to the self-imposed constraints in time due to the reasons mentioned above.

With all that said, here is how modding v0.00001 works:

Installation:

In the installation directory, you will find a new folder called data. In this folder, there are a bunch of json files:


Note the “_FilesToLoad.json” file. This is an “index” file - it tells the engine which files to load. When you open it, it looks like this:


You might notice that the “XXXXXX.json” entries matches the name of the files in the folder. You guessed it, that’s exactly how it works.

As an example, suppose if our friend PowerModder added some new moves to the game. And the data are in 2 new files, so the data folder now looks like this:

If you just copy and pasted the 2 new files to the data folder, it wouldn’t work. Why? Because the game have no idea these 2 new files existed or what type of data they contain. (At least in v0.0001). So you need to make modifications to the “_FilesToLoad.json”:


Now, assuming the content made by our friend PowerModder here is valid, that is all you need to do. Everything else the game will handle (or tries to).

Data File format:

You might notice that the game currently expects 4 different types of data files - animationsFiles, moveFiles, dialogueFiles and itemFiles. Let’s go over each file type:

ItemFiles contains list of extra items (equipment) the game will load. Individually, they look like this:



This isn’t actually valid JSON, because JSON doesn’t support comments ( // ). The comments are not used in code and are meant for humans to read rather than for computers. Feel free to mess around with the values and reload the game to observe their effects.

Two important fields:
  1. “uid” - this is a unique identifier for each item. Their name if you will. No two items should have the same “uid”. 
  2. “meshId” - this is where to load the mesh/model data from. Here is it “meshes\\platearmor.json.” It means that this particular item uses the model data from “platearmor.json” under the subdirectory “meshes.” Indeed, if you open the “meshes” folder in the “data” folder, you can find “platearmor.json” there. 
This means, an item in game actually requires two separate piece of data: an item description (the json above) and a model file. The model file src is encapsulated in the item description to save you the need to tell the game which models to load in a separate file. Graphically, it looks like this: (where <<----- roughly means “reads from” )

Game <<------ Item Description <<------ Model File

Here is an example. If you want to add say, “black_plate_armor_chest” to game. Step one is simple, we copy the existing json file. Then, you have an important decision to make. Do you want this for personal use or do you want to share it with others? If it’s for personal use, that’s easy, just paste the copied segment directly into the existing json file, like this:



JSONs are comma delimited so don’t forget to add a (,) in between! Use things like code editors and tools such as https://jsonlint.com/ to help spot mistakes!

If you want the possibility to eventually share this new addition with others, DO NOT OVERWRITE EXISTING FILES. Here is what you do instead:

First, we create a new .json file:


Then, under “_FilesToLoad.json”, add a new line to “itemFiles”:



Finally, open your new json file, add an [] pair for JSON array, and copy the item description in, so it looks like this:


Give it a new “uid”, mess some values (here rgb values are 0,0,0 for black) , and tada, you are done :D.

Question: is it possible to use own custom models?
Answer: Yes.

For that, you need to have blender that can export to a .json model file. I will provide a complementary .blend file on the next build with some in game models and animations for people to modify and build on. NOTE: I will not be providing a tutorial on how to use blender or providing support related to “how to do 3D modeling” - way too big of a subject. Then it’s a simple matter of setting a new “meshId.”

MoveFiles are additional move/grab/sex data the game will load. They are analogous for moves as ItemFiles for items. However, there is one big difference, is that move files are key-value pairs rather than an array/list (the type in ItemFiles). Arguably, this is a bad idea because of inconsistency, but it’s something I don’t want to fix at this point.

For clarity, MoveFiles uses this form

{
    “MoveName”: {
        ...
    }
}

Rather than
[
    {
         “Uid”: “MoveName”,
          ...
    }
]

AnimationsFiles are the actual animation data. These files is expected to be generated via blender rather than edited by hand. They are analogous to the mesh/model json files. An an individual animation file can contain many different animations.

Graphically, it looks like this:

Game <<---- Move Description <<------ animation(s) <<---- Animations files

Finally, there is DialogueFiles. There isn’t much cool stuff you can do with it yet. It’s mostly there to facilitate testing threesome moves if you edit a couple of lines ;)

And that’s it for a basic summary of how modding works. I think it’s pretty crude, and documentation thin XD, but hey, its functional (I hope). I am willing to expand it further/ provide better docs if/once people actually started to create cool things with it. But until then, my attention is back on making the game. If you got question on modding or not sure how to do X, feel free to ask in the #modding-related channel on the official discord.

5 comments:

  1. well the real question is, how do you even make the animation in the 1st place?

    ReplyDelete
    Replies
    1. There's a complementary .blend file with the rigged models the game uses. It's in the patreon post.

      Delete
  2. Someone should create a video tutorial on hot to turn .Obj files into files for this game.

    ReplyDelete
    Replies
    1. I dont have a video, but I have a tutorial with screenshots here: https://www.patreon.com/posts/v4-4-modding-19166031

      Delete