Mod Ren'Py Valdana: The Fall - Improvement Mod [1.3] [flwqo]

flwqo

Newbie
Modder
Jun 6, 2021
87
98
valdana_compare.jpg

Overview:
Improves and cleans up the images in-game.
Improves and interpolates videos to 120 fps.
Improves the performance when playing video.
Fixes hundreds of grammar and spelling errors.
Fixes numerous bugs.
Reduced the size of the game at no quality loss.
Misc. improvements.

Updated: 2024-04-21
Game/Creator: Valdana: The Fall / Tjord
Modder: flwqo
Mod Version: 1.3
Game Version: 2.00
Language: English

Details:
You don't have permission to view the spoiler content. Log in or register now.

Installation:
You don't have permission to view the spoiler content. Log in or register now.

Changelog:
You don't have permission to view the spoiler content. Log in or register now.

Download AIO: - - -
Download 60 fps videos (60 hz monitor or really weak CPU):
- - -
You don't have permission to view the spoiler content. Log in or register now.

menu.png menu_enhanced.jpg
 
Last edited:

flwqo

Newbie
Modder
Jun 6, 2021
87
98
Flwqo, this is only tangential to the thread, but, do you have a full written guide/ video about this process? Would love to know a little bit more about compression and image enhancement, best practices and which tools to use.
So, I'm not sure how much you already know, but if you want me to clarify just write. I'll also preface this by saying that I'm not an expert by any means, this is just what I did. Start by reading the Details in the above post for an overview.

I suppose the first step is to identify if doing some kind of image enhancement could improve the image quality. In this game the images were with so I was pretty sure it would.
The reason why I was pretty sure is that the only reasonable method I can use is to the images and that would help with both.

Since I can't natively render the images at a higher resolution, I need to do it artificially. In other words upscale them.
There are many difference ways to do it, but the best way currently for our purpose of supersamling is to use an AI upscaler.
This is a huge topic on its own, I wont say too much. I used Topaz Photo AI for this.

AI upscalers use trained models to do the upscaling, so you may wonder which model to use, but that depends on your use case. Hopefully there's a description, guide or post from other users.
For this game it wasn't that simple. You'd think that it's a simple case of choosing a model trained for computer graphics but the images in this game doesn't necessarily fit. I just set upscaling to 4x and let Photo AI chose the model and settings for me and save me the hassle, but ideally you'd test different models on an image to see which is the best fit.

So now after that's all done you have a bunch of upscaled images, it's time for the second part, the .
Just like upscaling you can do this in countless different ways. Even opening up the images in paint and save it with a lower resolution would work, but I used .

A question you could ask is which file format to use, png or jpg? Png is higher quality since it's lossless, but often times much bigger than the equivalent jpg. So to save space, my opinion is to use jpg unless you have a reason to use png. One such case is transparency which jpg can't do, which is why all the sprites in this mod is png.

You can read on resizing with ImageMagick. By default it will use an when downsampling which is exactly what I want.

I used a quality of 95 for both png and jpg. Do note, it's a complete coincident I used same quality; this setting means entirely different things when used for png and jpg, see .
I almost certainly could've used a jpg quality of 90, or even 80 to drastically reduce the image sizes without any perceived quality loss at normal use case. I tested different quality on an image from the game I knew showed at lower quality when zoomed in (unrealistic use case) until I settled at 95, only so anyone playing the game would have zero excuse not to use this mod. In general I'd recommend a lower quality to save more space, but it depends on the use case.

The setting I used for jpg was: magick mogrify -resize 25% -quality 95 -format jpg *.png

And that's it.
 
Last edited:
  • Like
Reactions: Bill Temple

cdawg20789

Newbie
Jun 25, 2018
27
32
flwqo will you be updating for 2.0?
I'd like to know this too. I downloaded the base game, but when I noticed this (as well as the updated improvement mod for the prequel), I thought I'd check if this mod is getting an update b/c I'll gladly wait to play it then. I can always replay the prequel with the improvement mod for that in the mean time anyway.
 

flwqo

Newbie
Modder
Jun 6, 2021
87
98
Yes, I will be updating it. I've been away and won't be back for a couple of days still, so I haven't been able to check out the new patch yet. I'd hoped the patch would release before I went away, but it kept being delayed so the timing was unfortunate.

I will attempt the typical visual improvements for the new content of v2.0. A more comprehensive script improvement like for my mod of the prequel is still to be determined.

I can't give an eta, but it will probably be a few weeks at least. I'd need play the patched content, then spin up my workflow. The image and video enhancements is probably going to take 1-2 weeks of processing alone (depending on the amount of new content).
 

cdawg20789

Newbie
Jun 25, 2018
27
32
Yes, I will be updating it. I've been away and won't be back for a couple of days still, so I haven't been able to check out the new patch yet. I'd hoped the patch would release before I went away, but it kept being delayed so the timing was unfortunate.

I will attempt the typical visual improvements for the new content of v2.0. A more comprehensive script improvement like for my mod of the prequel is still to be determined.

I can't give an eta, but it will probably be a few weeks at least. I'd need play the patched content, then spin up my workflow. The image and video enhancements is probably going to take 1-2 weeks of processing alone (depending on the amount of new content).
That's cool. Take your time. It's always better to take your time and get it done right than to rush it and mess it up.
 

flwqo

Newbie
Modder
Jun 6, 2021
87
98
The improvement mod update for Valdana v2.0 is done! Although initially only suppose to be an enhancement of the new images and videos, grew in scope to fixing much more, including many errors in the v2.0 patch.

1.3 changes

Images and videos
  • Remove unused images and videos.
  • Enhance new images and videos from v2.0, including some manual clean up of sprites.
Audio
  • Remove unused sound files.
  • Convert sounds to more efficient opus codec at 128k bitrate, to reduce file size at no perceived quality loss.
  • Change the background sounds to a separate channel for more granular sound control.
Did you know that Valdana have sex sounds during the scenes? I didn't, because I played with the music volume down, and those sounds are in the music channel, getting drowned out by the rock music. If you've played visual novels before, you'd know that those sounds are normally in the sounds channel. Instead I mapped those background sounds (which are mostly sex sounds but also includes a couple of other things) to the unused voice channel, for more granular control.

Script and bugs
  • Fix incorrect sprites when playing scenes from the gallery.
  • Fix bad performance when playing video during scenes, causing stuttering.
  • Fix grammar and spelling errors.
  • Fix some script errors (e.g. showing unavailable sprite).
A gallery was added in v2.0, which used the method from my improvement mod of the prequel, detailed here. Which is great, it's a better way of handling a gallery the way Tjord scripts his games compared to previously. Except... he set up the sprites incorrectly on several scenes. The reason stems from the system Tjord use for sprites.

A sprite in this game has four parts: Character, stage (corruption), style, pose (number). The current stage and style is set globally, which means you only need to set it once and it's remembered in the future until you change it. This makes it convenient when scripting, but hard to keep track because it could've been set way back in another part of the script.

This becomes a problem when setting up the gallery, because you "arrive" to the scene from the main menu, not from earlier in the script, so your stage and style is empty. You therefore need to explicitly set up the correct versions before the scene, which is what Tjord forgot to do for several scenes.

Valdana have a problem with videos. As detailed in my linked post above, the game plays videos on top of previous videos, resulting in multiple playing simultaneously, causing heavy stuttering during playback. While Tjord implemented my fix for v2.0, it was done inconsistently, missing several scenes. In short, the problem of heavy playback wasn't solved. To fix this I manually went through the entire script and corrected everything.

I also changed the way I display video. After extensive testing, I've revised my method for video playback. Instead of using like in my mod for the prequel, I'll instead be using and . A hypothetical best way to display videos would probably be to use the first frame of a movie as the start_image when declaring it using the , then displaying using scene, but barring that I believe this way is the best way to display video in Renpy.

show display a displayable (image/video). Notably, it does so on top of anything else on the layer. hide remove a displayable. scene will remove all displayables, then show it. So basically scene = hide (all) + show. Because of this, the only thing "under" something displayed with scene is a chequered/black Renpy base image.

The problem was that previously, Tjord only used show without hide, stacking videos on top of each other, so the simple fix was just to use scene instead. But this wasn't problem free. Because Renpy takes a while to load the video, the background image is visible before loading it, resulting in flickering. This is most noticeable when fast forwarding or going backwards during game play. This is only partially solved by using a dissolve transition when displaying the video.

In the end, the best method was to use show with dissolve (or some other transition) for movies. If what follows is an image displayed with scene, do nothing. If what follows is another movie, hide the previous movie directly after. Doing it this way means the movies overlap during the transition, resulting in no flickering. If there's an image before or between the movies, that image will be "under" the movies, which if they're similar to the movies, will also possibly help during the transition.

I have fixed a couple of hundreds of grammar and typo errors in the script. This is far from the comprehensive editing of thousands of lines in my mod of the prequel, but one of the reasons is that Tjord is basically . In other words, Tjord has much improved in writing Valdana compared to Isis that there's much less need to fix it. Fixing the script in Isis was an enormous undertaking and doing the same for the much longer Valdana for less reward is not something I plan to do (at least for the forseeable future).

Miscellaneous
  • Add a stripped down version of the transparent text box mod by Penfold Mole.
  • Change return from v2.0 gallery to return to previous gallery instead of main menu.
  • Add separate download of 60fps videos for 60hz monitors and really weak CPUs.
  • Make small change at the end of the second scene from the v2.0 scenes.
  • Swapped position of Yoona and Audrey in a Victorica scene so they don't get flipped.
  • Probably other things I forgot.

All-in-one / Compression
Note: while the typical compression posts has a smaller size due to sacrificing quality, the compression I've done has no perceived quality loss. In fact, due to the enhancements done on images and videos, most of them have better quality at smaller sizes!

There are many superfluous files in the v2.0 release that I removed. These include: base Renpy files, notes, compiled python and Renpy files, unused sprites and movies, fonts, two script drafts for other projects (Valdana sequel? :)), the entire Isis script!

The movies were upscaled/interpolated to 4k/120fps, then encoded to 1080p with best efficient VP9 at crf31. While that may seem high, I've done testing at different levels and couldn't tell any noticable difference between 25-31. The source movies are pretty low quality, so this still results in better visual quality, smaller sized movies. I've attached a comparison to this post. Flip between the images to see the clear reduction in visual artifacts, with higher fps and lower size to boot!

All images were upscaled then downscaled from png to 95 quality jpg (except for sprites). The result is better quality images at smaller sizes! But the best size reduction is removing something completely. Tjord creates every combination of sprites for easier development, but a ton of sprites remain unused. The clean way to do this would be to parse the script and record every sprite used, but with the sprite system Tjord uses this would be tedious. Instead I did it like this:
Code:
Identify used sprites:
Use ProcessMonitor with filter on .exe, path to sprite folder, readfile. Play entire game.
Tool -> file summary -> save as csv

Extract files from csv:
$ cut -d\" -f24 valdana_sprite_usage.CSV | cut -d\\ -f7 | sort | xargs -0 printf "%b" > valdana_sprite_usage.txt

Copy used files to folder:
$ <valdana_sprite_usage.txt xargs -d'\n' cp -t used_sprites
The result is an image size reduction from 1.19GB to 363MB! Remember, this is while having better visually looking images, far different from the regular compression versions which destroys quality.

The audio also had a bunch of unused files, which I tediously removed by searching the script files and manually checking. Then I reencoded all of them with the following. There should be no perceived quality loss of the sounds.
Code:
> for /r %i in (*) do ffmpeg -i %i -c:a libopus -b:a 128k "%~pni.opus"
Summary
The v2.0 release is 1.51GB.
The all-in-one version, Valdana + improvement mod, is 587MB.
The stand alone mod is 559MB.

As such, I strongly encourage you to just download the aio version, which is a much cleaner version, and easier than downloading v2.0 then applying my mod.
 
Last edited:

ThtsMyScrtCapImAlwysHorny

Well-Known Member
Aug 5, 2021
1,258
2,996
AIO gives this error on startup
Code:
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/screens.rpy", line 355, in execute
    screen main_menu():
  File "game/screens.rpy", line 355, in execute
    screen main_menu():
  File "game/screens.rpy", line 360, in execute
    add gui.main_menu_background
Exception: DynamicImage u'images/menu[persistent.completion].jpg': could not find image. (u'images/menuNone.jpg')

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "renpy/ast.py", line 923, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "renpy/python.py", line 2235, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
    python hide:
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
    ui.interact()
  File "renpy/ui.py", line 298, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3276, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
  File "renpy/display/core.py", line 3694, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/core.py", line 568, in visit_all
    d.visit_all(callback, seen)
  File "renpy/display/screen.py", line 432, in visit_all
    callback(self)
  File "renpy/display/core.py", line 3694, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "renpy/display/screen.py", line 443, in per_interact
    self.update()
  File "renpy/display/screen.py", line 631, in update
    self.screen.function(**self.scope)
  File "game/screens.rpy", line 355, in execute
    screen main_menu():
  File "game/screens.rpy", line 355, in execute
    screen main_menu():
  File "game/screens.rpy", line 360, in execute
    add gui.main_menu_background
  File "renpy/sl2/sldisplayables.py", line 431, in sl2add
    d = renpy.easy.displayable(d, scope=scope)
  File "renpy/easy.py", line 113, in displayable
    return renpy.display.image.DynamicImage(d, scope=scope)
  File "renpy/display/image.py", line 571, in __init__
    self.find_target(scope)
  File "renpy/display/image.py", line 652, in find_target
    raise Exception(error)
Exception: DynamicImage u'images/menu[persistent.completion].jpg': could not find image. (u'images/menuNone.jpg')

Windows-10-10.0.19041
Ren'Py 7.4.8.1895
Valdana 2.00i1.3
Sun Apr 21 03:00:22 2024
ETA: tried installing stand-alone mod on OG game, same result. You CAN get around it by hitting ignore, which launches you into a new game, then right-clicking to get to the pause menu if you need to load a save, but even then, trying to return to the main menu gives the error, which means the gallery is inaccessible since the dev only put it on the main menu for some reason.
 
Last edited:

flwqo

Newbie
Modder
Jun 6, 2021
87
98
AIO gives this error on startup
Thanks for reporting the problem. Fixed!
Damn. That's what I get for trying to save a few hundred kilobytes. It worked on my machine so I thought it was fine, it must've been the persistent save.
It has to do with how Tjord set up the main menu background. The None in the image name is because you haven't completed the game yet.
 
Last edited:

AkaQ

Member
May 23, 2022
291
324
I'm amazed to see such a difference in image quality. I even noticed that there's a text bellow the barcode tattoo written "breeder" or "dairy" I didn't see before. My Yoona is even prettier now too. Videos also run better on my potato notebook (the 60fps ones). And almost half of the original size. Sadly saves were not totally compatible.
 

Heimeropen

Well-Known Member
Nov 15, 2019
1,703
1,517
*scratches head*
I'm confused... Do I need the Main Game for this Mod or is the All-In-One version the game but heavily compressed and improved?!
 

AkaQ

Member
May 23, 2022
291
324
*scratches head*
I'm confused... Do I need the Main Game for this Mod or is the All-In-One version the game but heavily compressed and improved?!
Summary
The v2.0 release is 1.51GB.
The all-in-one version, Valdana + improvement mod, is 587MB.
The stand alone mod is 559MB.

As such, I strongly encourage you to just download the aio version, which is a much cleaner version, and easier than downloading v2.0 then applying my mod.
Just download the AIO (all-in-one), it's the full enchanted game.
 
  • Like
Reactions: flwqo