Sex Framework Devlog 2
Hey!
I finished adding modding support for sex animations, to make this possible I had to change some things I said in the previous devlog about the sex framework, specifically how sex animations are read from the game's directory.
Animation Metadata
To add new animations to the game, mods will have to put the animations inside the folder:
"Graphics/Sex Animations/"
Every folder inside that directory (
recursively) will be treated as a sex animation if an
animation metadata JSON file is found within the folder, check this example below:
The folder "Doggy Style 01" and "Blowjob 01" is a sex animation folder because the metadata file "animation_data.json" exists inside of it.
In addition, to standardize the sex animations, they will all have the same folder structure:
- Folder Frames: Where all the frames of the animation will be stored.
- Folder Sounds: where all the sounds of the animation will be stored.
- Folder Overlays: Where all the overlays of the animation will be saved.
Sounds and Overlays are completely optional tho, so animations may exists with no sounds or overlays, actually, frames is also optional, it won't crash the game but if it does not exists it won't show any CG on the screen obviously.
Like I said, I had to modify the animation's metadata to allow creating new animations and modifying existing ones, the main problem I had was that all the animation information was defined inside the file "animation_data.json",
this made it impossible for two mods modifying the same animation to co-exist.
For example, take a mod that modifies the sound of an animation and another one that adds a new overlay, since both of this is defined in the animation_data.json file, one would overwrite the other so you will end up either without the overlay or the sound.
Also, having all data inside the same metadata file
made the file excessively long, the test animations I'm currently using were up to 1,000 lines of data within the same JSON file, which made it very difficult to search for something or add something new, and that was only a few overlays and sounds...
Here's an updated example of a sex animation metadata file:
Now, the animation metadata is used to define essential data that must be shared for all overlays and sounds, for example, the list of slots and the list of frames, the animation ID, etc...
To solve all of this I have taken out the overlays and sounds from the "animation_data.json" file and now there are two ways to add new overlays and sounds:
The group file is a single file that defines a list of overlays or sounds, this file exists within the Overlays or Sounds folder and it is called "overlays_data.json" or "sounds_data.json", respectively.
Overlays group file example
A loose file is just a single file that defines a single overlay or sound, this file exists within the Overlays or Sounds folder and it is called "overlay_data.json" or "sound_data.json", respectively, you can organize these files inside subfolders since the "Overlays" and "Sound" folders are scanned recursively for loose data files.
Sound loose file example
As you can see, the group file defines a list of overlays/sounds and the loose file defines a single overlay/sound, loose files are prioritized over group files so modders can use the loose file to overwrite existing overlays/sounds for a sex animation.
Also, the overlays and sounds metadata file are subject to change, since I'm currently working on this, I will talk about each feature in a new devlog.
Animation Links
Animation links is a small and neat feature that I think it is worth to include, basically what it does is it lets any animation to tell the sex framework which animation "links" with itself, by "link" meaning that both animations shares the same pose but they differ in something such as the number of actors.
Animation links:
- animation_link_remove: Animation that will be used when an actor is removed from the current scene.
- animation_link_add: Animation used when a new actor is added to the sex scene.
- animation_link_prev_stage: Animation used when the user goes to the previous stage.
- animation_link_next_stage:Animation used when the user goes to the next stage.
So for example, if you are currently playing this animation below and a new actor is added, you can assume that new actor is male and create another animation with the same pose but with Sana giving a blowjob to another penis in the same frame, so you can set the "animation_link_add": "ANIMATION_ID" to that animation ID and it will be used when that happens.
You can also use the "prev_stage" and "next_stage" to change slightly the pose, for example, pushing Sana's breasts together with her arms, you can also use this to show an alternate version showing/hiding the male's body, etc...
The purpose of this feature is to add more cohesion when playing one animation and switching to another, either because a new actor has been added or removed or simply because the user has changed the stage, still,
if the animation specified in the link cannot be found it will select a random animation from the list of valid animations, which is the default behavior.
Animation Context
One of the main problems I have encounter designing the sex framework was that some animations may be used in some situations that they do not fit, for example, those of you who have played the original game will know that there are events on a beach, and the CGs of these events have a beach background drawn, some animations created specifically for this situation could be used in other situations because there is no way to differentiate them, the "animation_context" key will be used to provide context for animations that must be used only in a specific situation unlike any generic animation that could be used anywhere.
So, when creating animations for the beach events, you must use a context to tell the game that this animation
must be used only in the beach, for example:
JSON:
{
"animation_pack": "sana",
"animation_name": "beach-doggystyle-01a",
"animation_display_name": "(Beach) Vaginal Doggy Style 1",
"animation_context": "context_beach",
"animation_tags": [
"doggy",
"vaginal"
]
}
When the events in the beach happens, every sex scene created inside the beach location will be using the context "context_beach", so any animation that does not have the same context will be discarded.
The same thing happens the other way around, if an animation does not have context (generic animation) any animation that has one will be discarded.
Like I said, this will be used to filter out animations that does not make sense in certain situations.
Animation Frames
Animation frames are no longer automatically detected inside the "Frames" folder, you will need to specify the list of files and the order inside the animation's metadata file in the key "animation_frames", I have made this change for a few reasons:
- Allow mods to change the order of frames
Mods will be able to change the order in which the frames are shown on the screen, so in the example above, if you want to show the frame "2.png" before "1.png" you can do so.
JSON:
{
"animation_pack": "sana",
"animation_name": "pov-doggystyle-01a",
"animation_display_name": "(POV) Vaginal Doggy Style 1",
"animation_tags": [
"doggy",
"vaginal"
],
"animation_frames": [
"./frames/2.png",
"./frames/1.png"
],
}
- Incompatibility with the mod system
If a mod modifies an animation to add a new sound or overlay (for example) and it does not carry over the list of frames, when the modified animation is created it will overwrite the original animation and the list of frames will be lost because the mod did not carry over the Frames folder, this increases the disk usage because you will have to copy the frames even though they do not change.
- Possible incompatibility with linux-based systems
The original way of scanning the animation frames was reading the "Frames" directory folder and getting the list of frame files in alphabetical order, I believe this behavior may not happen in linux-based systems so I changed it to this way.
I will probably need to do the same thing for overlays.
Modding Support and Animation Registry
To support mods, the animation registry now reads the new database when a new game starts or a save file is loaded to create the registry including the base game animations and mods animations.
The registry joins the animation_pack and the animation_name values using the character ":" to determine the animation ID, so the animation ID would be something like: "sana:doggystyle_01" where "sana" is the animation pack and "doggystyle_01" the animation name.
This allows mods to overwrite the base game animations (and also other mods depending on the load order) in the registry, as long as the animations shares the same ID.
This is the database contents after a new game with a few mods loaded:
- sana
-- mod_element_sex_animation
--- ./Graphics/Sex Animations/Sana/test anim/animation_data.json => mod_element_sex_animation (./Graphics/Sex Animations/Sana/test anim/animation_data.json (sana))
--- ./Graphics/Sex Animations/Sana/test anim 2/animation_data.json => mod_element_sex_animation (./Graphics/Sex Animations/Sana/test anim 2/animation_data.json (sana))
--- ./Graphics/Sex Animations/Sana/test anim 3/animation_data.json => mod_element_sex_animation (./Graphics/Sex Animations/Sana/test anim 3/animation_data.json (sana))
- john_doe_animation_pack
-- mod_element_sex_animation
--- Mods/animation_pack/Graphics/Sex Animations/john_doe/test animation instance/animation_data.json => mod_element_sex_animation (Mods/animation_pack/Graphics/Sex Animations/john_doe/test animation instance/animation_data.json (john_doe_animation_pack))
As you can see, the mod "
john_doe_animation_pack" added a new animation to the game (Graphics/Sex Animations/john_doe/test animation instance), the animation registry will include this animation and it will be ready to be requested by the sex framework.
That's all for now! See y'all in the next devlog.