How to prevent players from using old save files?

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
User avatar
GeeSeki
Regular
Posts: 68
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

How to prevent players from using old save files?

#1 Post by GeeSeki » Sat Sep 22, 2018 12:10 am

Not save files from the 'current version' of my game but save files from previous versions of my game. Players keep loading old save files even though I warn them not to and thus running into 'avoidable' bugs. It's frustrating. So I'm wondering if there's a way to just make it so that the old saves are gone or unloadable.

And more specifically, if it's possible. I would want to have save files loadable if the updates are minor (loading 0.19a save file in version 0.19c) but not when it's a major updates (loading 0.17a save file in version 0.19a).

User avatar
xavimat
Eileen-Class Veteran
Posts: 1337
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: How to prevent players from using old save files?

#2 Post by xavimat » Sat Sep 22, 2018 12:53 pm

Some thoughts:
1. I'd prefer, as a user of your game, that my old saves could be used with new versions of the game. That can be done with the use of "default" for new variables. For more complex changes between versions, it can be done using the "label after_load" (I know that wasn't your question, just saying).

2. To answer your question, I'd use a variable inside the game to know what version that save has and check it in the after_load save:

Code: Select all

default myversion = "0.00"
label start:
    $ myversion = config.version
    # the game starts...

label after_load:
    if myversion != config.version:
        scene black with None
        centered "THIS OLD SAVE CAN'T BE PLAYED IN THIS VERSION!!!\n\n You have tried to open a save with an old version ([myversion]). The current version is [config.version]. Start again from the beginning, you old-fashioned gamer!"
        $ renpy.full_restart()
    return
https://www.renpy.org/doc/html/label.ht ... ial-labels

3. More complex behavior is also possible:

Code: Select all

default myversion = "0.00"
label start:
    $ myversion = "0.19c"
    # the game starts...

label after_load:
    if not myversion.startswith("0.19"):  # This will accept every version that starts with "0.19": for example 0.19, 0.19a, 0.19.3, 0.198...
        scene black with None
        centered "THIS OLD SAVE CAN'T BE PLAYED IN THIS VERSION!!!\n\n You have tried to open a save with an old version ([myversion]). The current version is 0.19c. Start again from the beginning, you old-fashioned gamer!"
        $ renpy.full_restart()
    return
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
unknown [Sci-Fi - mystery - computer]
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
GeeSeki
Regular
Posts: 68
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

Re: How to prevent players from using old save files?

#3 Post by GeeSeki » Sat Sep 22, 2018 11:20 pm

Hey! Thanks for that! This is exactly what I need and it worked perfectly! I took your suggestion and made it a warning disclaimer instead stating that it's not suggested to use an old save file while allowing it to be used.

Post Reply

Who is online

Users browsing this forum: No registered users