Copying Save function to make Chapter Select

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Goblinounours_2039
Newbie
Posts: 4
Joined: Mon Sep 25, 2023 8:33 am
Contact:

Copying Save function to make Chapter Select

#1 Post by Goblinounours_2039 »

Hi there, first thread on these forums.

First, allow me to explain our situation.
SITUATION:
• We're working on a Renpy game which is non-linear. There are many choices which can affect the story.
• We're still relatively early in development, but there's still several hours of game to play through, even if you abuse the skip feature.
• The game features A LOT of variables (some boolean, some just integers, some strings) to keep track of some player choices further down the line.
• The game features also an Inventory system, a Merchant system (to buy items) and a Gift-giving system (to offer items bought at the merchant to some characters). So we also need to keep track of those on top of some other variables like player-stats (charisma, strength, knowledge, proficiency and money).

Because of the length of the game, we previously had a menu at the start of the game that went like "do you want to jump to [the new content of the latest build of the game]" followed by "[what choice did you make, that will impact the story of the new content]", which could simply jump the player to the new content while setting the biggest story-variable. The issue was that we couldn't possibly make a menu asking the player what decisions they made for everything. First of all, the menu would be ridiculously long. Second, try asking the player "How much money did you get?", the player would answer "All of it, of course".

INITIAL SOLUTION:
We removed the quick-menu button to Save and instead made a Load button renamed "Chapters" and we made regular automatic save points like this:

Code: Select all

$ renpy.save("1-1", "Name of Chapter")
On paper, this would work. Players would no-longer need to make manual saves, and we would handle this for them by having saves at the start of important parts of the game, with understandable names and everything!

PROBLEM:
Due to poor communication, play-testers of the latest build weren't made aware that their saves of the previous build of the game would be incompatible with the newer build (because new variables were added early on), and they weren't properly made aware of the new 'Chapters' feature we made.
So some players were mad that the game was now saving over their own older (and incompatible) saves.
We ran a poll and 55% of our players like the new system, probably because they followed the news-updates, or they're just generally nice and understanding.
The rest, more vocal, either doesn't like the new system and would like us to remove it, or would like us to do something else and better.
I'm making the difficult call of siding with the vocal minority instead of saying "you lost by 5% so I'm gonna do nothing".
Removing the feature entirely leaves us with the issue of the game being really really long even with skip, so I want to look into an alternate solution.

THE THEORY:
If you've read the post so far, first, thank you.
What I would like to do, with no idea exactly where to start or how to proceed, would be to copy the entire Save feature (the 6 slots per page) and rename it as Chapter Select. The idea would be for players to have their manual saves AND for me to be able to set automatic saves. Then everybody's happy.
Maybe I could cut in half the number of pages available in the base Save feature, hide the later part, and that second half of save pages and slots could be used to save chapters?
Eitherway, I don't know which files I need to edit.
Could anyone help me with this, walk me through it?
Thank you very much!

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Copying Save function to make Chapter Select

#2 Post by enaielei »

Code: Select all

$ renpy.save("1-1", "Name of Chapter")
Why not specify "auto-1", "auto-2", etc. for the save slot?
You can leave the numbered pages to the players for their manual saves.

Goblinounours_2039
Newbie
Posts: 4
Joined: Mon Sep 25, 2023 8:33 am
Contact:

Re: Copying Save function to make Chapter Select

#3 Post by Goblinounours_2039 »

enaielei wrote: Tue Dec 12, 2023 7:21 pm Why not specify "auto-1", "auto-2", etc. for the save slot?
You can leave the numbered pages to the players for their manual saves.
Well, how many slots does the autosave system has? Is it not something like 6 or something? Because throughout the full course of the game, we would likely use several dozens of chapters. We're fairly early in development and we have easily 20 chapters to keep track of.

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Copying Save function to make Chapter Select

#4 Post by enaielei »

There's no limit for that. The way you display it on screens is what's limiting the players to see all the possible slots.
I will also add that you need to disable autosaving if you'll manage the autosave slots yourself.

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1057
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Copying Save function to make Chapter Select

#5 Post by m_from_space »

enaielei wrote: Tue Dec 12, 2023 7:21 pm

Code: Select all

$ renpy.save("1-1", "Name of Chapter")
Why not specify "auto-1", "auto-2", etc. for the save slot?
You can leave the numbered pages to the players for their manual saves.
I think you can also just use whatever save names and don't show them to the player. So if you're not using the "#-#" file format, they shouldn't show up inside the usual load and save menus.

By the way there is also:

Code: Select all

renpy.force_autosave()

Goblinounours_2039
Newbie
Posts: 4
Joined: Mon Sep 25, 2023 8:33 am
Contact:

Re: Copying Save function to make Chapter Select

#6 Post by Goblinounours_2039 »

m_from_space wrote: Wed Dec 13, 2023 8:04 am I think you can also just use whatever save names and don't show them to the player. So if you're not using the "#-#" file format, they shouldn't show up inside the usual load and save menus.
Ol' up. So what you're saying is that I can write

Code: Select all

$ renpy.save("Name of Chapter")
EDIT : Yep, tested it, works, found the savefile.

But theeeeen... I dunno, is there a way to do an if statement that looks something like

Code: Select all

If savefile "Name of Chapter" exists:
so that I can then make an image button that loads the save?

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1057
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Copying Save function to make Chapter Select

#7 Post by m_from_space »

Goblinounours_2039 wrote: Wed Dec 13, 2023 12:27 pm But theeeeen... I dunno, is there a way to do an if statement that looks something like

Code: Select all

If savefile "Name of Chapter" exists:
so that I can then make an image button that loads the save?
I always advice people to have a look inside Renpy's really nice documentation: https://www.renpy.org/dev-doc/html/save ... -variables

This will help you out...

Code: Select all

if renpy.can_load(filename)
    ...

Goblinounours_2039
Newbie
Posts: 4
Joined: Mon Sep 25, 2023 8:33 am
Contact:

Re: Copying Save function to make Chapter Select

#8 Post by Goblinounours_2039 »

m_from_space wrote: Wed Dec 13, 2023 3:56 pm I always advice people to have a look inside Renpy's really nice documentation: https://www.renpy.org/dev-doc/html/save ... -variables
I did, but it's not always easy to understand when you're fairly new to RenPy. I wish the documentation had more practical examples.
I've been tinkering with the wrong thing for hours.
So thank you for indicating the one that works better. ^^

Post Reply

Who is online

Users browsing this forum: No registered users