Ren'Py Multi persistent files in Ren'Py

D

Dr PinkCake

Guest
Guest
Hi!
I've been experimenting with multi persistent files when it comes to saving games between releases. My intention is to reduce the size of the binaries by saving a multi persistent file with all variables that I need for in the new release.
I have gotten it to work, but I feel that it's kind of clunky; especially if the player is playing multiple playthroughs at once.

This is my current approach:
1. The player plays until the end of the Episode.
2. The player gets a prompt that asks if he wants the current game to be set as start for the next episode. If 'Yes' -> mp.save() #Multi persistent file is saved
3. In the next episode with a new binary, click Start game and continue playing.

However, if the player wants to play the game in two different ways (or three which is how my game was designed to be played) he must also do the following:
4. In the new episode, save your game. So you can continue playing later.
5. Go back to the previous episode and play until the end. Repeat steps 2. and 3.

I'd rather have the approach that let's the player just save their games as usual (right-click/save) and then load their saved games in the next episode. But this doesn't natively work.

Since there are a lot of experienced devs here, I was wondering if anyone has any valuable pointers or insight on this subject?
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
why should it not work to just save the normal way? It depends how you end the last episode and how you start the next. As long as you don't change the name of the savegame folder in the options.rpy and have them all use the same, they share the same savegames, so just make sure at the end of an episode will be a point where the game jumps to a label like i.e. this:

Code:
label episodeOneEnd:
    $ renpy.force_autosave(take_screenshot=True)
    pause 1.0

    if renpy.loadable('episodeTwo.rpyc') and renpy.loadable('fileNameOfAChapterTwoImage'):
        jump episodeTwoStart
    else:
        jump endOfVersion
Put that code into the game.rpy or wherever you want which can be shipped with every episode.
Well I do it like that, and I seperate my image files and so on in multiple .rpa files so I can just upload the new .rpa files for our players who don't need to download the whole game all over again but just the update.



p.S.: One downside to the multi persistent ist that it's not working on android ;) So if you ever want to work with that you have to figure out a different way for android savegames then anyways :)
 
D

Dr PinkCake

Guest
Guest
Thank you! I will try your suggestion.
I definitely need it to work on android as well so I will scrap the multi persistent approach.
And uploading just .rpa files is a great suggestion that reduces file size too.
 
  • Like
Reactions: Palanto

Deleted member 167032

Alternate Existence
Donor
Game Developer
Aug 16, 2017
2,719
4,944
If I may ask, what do you guys/gals do with regards to your DAZ scenes and model poses?

I have a fight scene at a bar for instance, then i change the models to sitting etc... BUT let's say i come back to it later and i want to change the fighting scene slightly, if i have not saved the models as a scene subset, my poses will have now be changed to the last scene i did.
These files can get big over time, is there another save to preset option one can use that saves the poses if you will for a setting?
 
  • Like
Reactions: Palanto and TuXido

TuXido

Newbie
May 9, 2018
68
76
If I may ask, what do you guys/gals do with regards to your DAZ scenes and model poses?

I have a fight scene at a bar for instance, then i change the models to sitting etc... BUT let's say i come back to it later and i want to change the fighting scene slightly, if i have not saved the models as a scene subset, my poses will have now be changed to the last scene i did.
These files can get big over time, is there another save to preset option one can use that saves the poses if you will for a setting?
I think its the only way to do it... dedicate a hard disk space for your project to store all the RAW generated files from DAZ and renders.... its the only way to ensure that you can access them later on.
 

Deleted member 167032

Alternate Existence
Donor
Game Developer
Aug 16, 2017
2,719
4,944
It's what i have. All my Blender/DAZ/Renpy files are on this drive and nothing else. Also my photoshop psd files for the game.
I am asking as it's not the best way to re create a particular scene again. I can save every pose i suppose but that takes up too much time and planning as it is the game development is taking up most of my evenings.

I think its the only way to do it... dedicate a hard disk space for your project to store all the RAW generated files from DAZ and renders.... its the only way to ensure that you can access them later on.
 
  • Like
Reactions: Palanto

TuXido

Newbie
May 9, 2018
68
76
It's what i have. All my Blender/DAZ/Renpy files are on this drive and nothing else. Also my photoshop psd files for the game.
I am asking as it's not the best way to re create a particular scene again. I can save every pose i suppose but that takes up too much time and planning as it is the game development is taking up most of my evenings.
Well maybe if you can create a timeline for animation and on each frame there is a certain pose of your liking so if you want to go back you can just select that particular frame and guess what.. you can save them in one file... I never tried it but I just thought of it...

TUX
 
D

Dr PinkCake

Guest
Guest
Just like TUX said, it is the way to go. I didn't save my scenes in the beginning and it haunted me when some of the renders needed to be redone. Now I organize the files meticulously after rendering.

I save all my scenes that are prepared for rendering into a folder named "render_these"; this folder is constantly queued up for rendering. Then they are moved to organized folders for storage.
It does take a lot of storage, but the time spent on doing the scene all over from scratch is both demotivating and not worth it. Perhaps investing in a 1TB external harddrive for this purpose is recommended?
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
Thank you! I will try your suggestion.
I definitely need it to work on android as well so I will scrap the multi persistent approach.
And uploading just .rpa files is a great suggestion that reduces file size too.
Well if you've got some questions about that approach, let me know I'll try to clarify how it works best :)
In case of android, updates like that won't work anyways :( Sadly I couldn't figure out a way to patch an .apk file for android yet, meaning the android users will always have to download the full game and can't really update it with just the latest .rpa files... :-\ Sadly it seems like that's how android works...

P.s.: But if you use .webp images and .webm videos it can get pretty small and still have great quality :) (same size as .jpg but still having transparency + better quality than .jpg) sounds pretty good to convert .pngs to .webp :)
 
  • Like
Reactions: Dr PinkCake and bas

bas

retired
Donor
Respected User
Former Staff
May 6, 2017
3,988
30,555
Well if you've got some questions about that approach, let me know I'll try to clarify how it works best :)
In case of android, updates like that won't work anyways :( Sadly I couldn't figure out a way to patch an .apk file for android yet, meaning the android users will always have to download the full game and can't really update it with just the latest .rpa files... :-\ Sadly it seems like that's how android works...

P.s.: But if you use .webp images and .webm videos it can get pretty small and still have great quality :) (same size as .jpg but still having transparency + better quality than .jpg) sounds pretty good to convert .pngs to .webp :)
I made this to create compressed versions of games and it does webp, webm, and Lame MP3:

It doesn't change the file extensions even though it does change the file formats, so you don't have to go back and edit any file extensions in your Ren'Py files. I wanted it to be a simple tool, so there aren't config options but you can easily change the variables in the batch file to tweak the quality settings.
 
  • Like
Reactions: Palanto
D

Dr PinkCake

Guest
Guest
Well if you've got some questions about that approach, let me know I'll try to clarify how it works best :)
In case of android, updates like that won't work anyways :( Sadly I couldn't figure out a way to patch an .apk file for android yet, meaning the android users will always have to download the full game and can't really update it with just the latest .rpa files... :-\ Sadly it seems like that's how android works...

P.s.: But if you use .webp images and .webm videos it can get pretty small and still have great quality :) (same size as .jpg but still having transparency + better quality than .jpg) sounds pretty good to convert .pngs to .webp :)
Thank you! I tried this earlier today and it works like a charm. Yes Android has gotten the short end of the stick with Ren'Py games. I hope that those players can see past that huge flaw.
I do use webm videos and they go from 60Mb down to 60kb during conversion and remain in excellent quality.
I'm using .png images in my project and it really tallies up. I thank you for the resource, I will definitely try it to see if I can save valuable space converting my images.
 
  • Like
Reactions: Palanto
D

Dr PinkCake

Guest
Guest
Well if you've got some questions about that approach, let me know I'll try to clarify how it works best :)
In case of android, updates like that won't work anyways :( Sadly I couldn't figure out a way to patch an .apk file for android yet, meaning the android users will always have to download the full game and can't really update it with just the latest .rpa files... :-\ Sadly it seems like that's how android works...

P.s.: But if you use .webp images and .webm videos it can get pretty small and still have great quality :) (same size as .jpg but still having transparency + better quality than .jpg) sounds pretty good to convert .pngs to .webp :)
Just tried the tool. Works wonders on file compression. I'm pretty sure that those who unpack the game for the images won't like it though, as the images cannot be previewed natively (at least not in Win 10).
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
Well not natively no, but with the it works. It's getting pretty popular so I guess Microsoft might soon add it natively in one of their updates ;)

p.S.: If you click the link above you'll get to a list, below that list, right next to "Install Instructions" are the download links to the Windows, Linux and MAC versions.

On the other hand, I'm only using the compressed images for the android version and a small sized pc version, the normal version gets the real HD .png images. Since on a PC it doesn't really matter how big the game is, and if they really want to have it in lower quality and smaller size they can still take the smaller version or do it themselves with the two above mentioned bat files :)

p.p.S.: Uhm, yeah I can't find the windows explorer codec that was there somewhere before... Hmmm. Well I'm going to check if I can find it somewhere and post another link then ;)


Alright here's the link to a codec page, tried the download checked for malware and so on, nothing found on my end. Installed it and it works like a charm:

 

the66

beware, the germans are cumming
Modder
Donor
Respected User
Jan 27, 2017
7,810
24,391
it's been only tested on a samsung galaxy a5, but it should work elsewhere
i'm using something similar in my dmd android port to export/import data between both chapters
 
  • Like
Reactions: Palanto

Deleted member 167032

Alternate Existence
Donor
Game Developer
Aug 16, 2017
2,719
4,944
If I may, how important do you guys find creating Android versions of one's game? Is a PC / Mac / Linux version not enough?
 
  • Like
Reactions: Palanto

the66

beware, the germans are cumming
Modder
Donor
Respected User
Jan 27, 2017
7,810
24,391
from a dev's viewpoint.. with another supported platform you can reach more paying customers
for me it's only a hobby to kill some time :closedeyesmile:
 
D

Dr PinkCake

Guest
Guest
If I may, how important do you guys find creating Android versions of one's game? Is a PC / Mac / Linux version not enough?
I thought it was enough with that holy trinity at first. Then I saw how simple it was to build an Android app in Ren'Py. After I tried it on my cellphone I was sold. I especially see the need for an app for the younger audience living at home trying to enjoy a game in private. Much easier to do with an app. The only drawback is the save issue and that the games often get very large quickly. The second issue is solved using proper image compression.
Seriously, just take an hour and try to build the app. I think you'll come around. :)