Fixing a bug / patching a game without breaking saves

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
Rosstin
Veteran
Posts: 368
Joined: Mon Jan 31, 2011 5:43 pm
Completed: Rex Rocket, Kitty Love, King's Ascent
Projects: Road Redemption, Queen At Arms
Organization: Aqualuft Games
Contact:

Fixing a bug / patching a game without breaking saves

#1 Post by Rosstin »

So, the worst happened. Someone find a bug deep in our game, in the version we released on Steam. Is there a way we can update the build and fix it without breaking saves?

The worst part is that I have no idea how the Renpy save system works. Does it work by line number? If I alter the script to correct a spelling error will that break saves?
Image

User avatar
Zetsubou
Miko-Class Veteran
Posts: 523
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Fixing a bug / patching a game without breaking saves

#2 Post by Zetsubou »

Fix it and try?
ie. Create a save at a place likely to be affected, fix the bug, then try to load it.

It depends totally on your code how easy it is, but Renpy seems pretty good at this.
Spelling changes, adding lines of text, even adding menu choices works okay, as long as the flow remains the same.
But moving existing text into a new label, or changing the logic of a scene, or deleting content may cause a break.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Fixing a bug / patching a game without breaking saves

#3 Post by xela »

Zetsubou wrote:Fix it and try?
That's excellent advice :)

Otherwise almost any change shouldn't break the saves, but if you add new properties to an object (for example), you may have to mess with label start in order to inject it to all objects which had their state saved. It depends on the case but your options are really, really wide here as Ren'Py's saving system is very flexible.
Like what we're doing? Support us at:
Image

User avatar
Vaendryl
Regular
Posts: 39
Joined: Thu Dec 26, 2013 10:10 pm
Projects: Sunrider
Organization: Love in Space
IRC Nick: vaendryl
Contact:

Re: Fixing a bug / patching a game without breaking saves

#4 Post by Vaendryl »

in my experience things will usually be okay though changing label names and removing lines can get problematic.

Particularly if you use a lot of python stuff (your own classes etc) it may be a good idea to use the 'after_load' label which can fix/update some stuff before a save finishes loading and things start being drawn on screen.

User avatar
PyTom
Ren'Py Creator
Posts: 16122
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Fixing a bug / patching a game without breaking saves

#5 Post by PyTom »

it really depends on the change - if you can explain what change you made, we can give you advice on what the right way to maintain save compatibility is.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

neowired
Regular
Posts: 199
Joined: Mon Dec 01, 2008 2:33 pm
Contact:

Re: Fixing a bug / patching a game without breaking saves

#6 Post by neowired »

I would say, If you change a misspelled variable which is crashing the game when the script gets to it because it doesn't exist, that will not break your saves.
If you change an existing variable into one with a different name and call it, you will have the save call an undefined variable, and that will crash.
If all you are doing is changing some text in the dialogue then there should be no issues.

The saves break if your game tries to read from the saved game a variable which doesn't exist in the saved game.

User avatar
Rosstin
Veteran
Posts: 368
Joined: Mon Jan 31, 2011 5:43 pm
Completed: Rex Rocket, Kitty Love, King's Ascent
Projects: Road Redemption, Queen At Arms
Organization: Aqualuft Games
Contact:

Re: Fixing a bug / patching a game without breaking saves

#7 Post by Rosstin »

In this case, we had an undeclared variable crashing the game when it got to that line, and so we added a line declaring that to our points.rpy file (where we declare all our variables.)

I was hoping for some documentation in-general about how it works-- do saves work by line number? A combination of label and line number?

What we did ultimately was update it: the crasher was on a specific path at the end, only one person had gotten there, and only 20 people had downloaded the game at that point, so there weren't a ton of nightmare scenarios for us. But in case this happens in the future (I don't think it will but you never know), I'd like to know what I can and can't safely do.
Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Fixing a bug / patching a game without breaking saves

#8 Post by xela »

Rosstin wrote:In this case, we had an undeclared variable crashing the game when it got to that line
Prolly the best case scenario, you are very likely to fix it by adding any random file with:

Code: Select all

default var_name = proper_value
and it should be fixed.
Like what we're doing? Support us at:
Image

User avatar
Rosstin
Veteran
Posts: 368
Joined: Mon Jan 31, 2011 5:43 pm
Completed: Rex Rocket, Kitty Love, King's Ascent
Projects: Road Redemption, Queen At Arms
Organization: Aqualuft Games
Contact:

Re: Fixing a bug / patching a game without breaking saves

#9 Post by Rosstin »

xela wrote:
Rosstin wrote:In this case, we had an undeclared variable crashing the game when it got to that line
Prolly the best case scenario, you are very likely to fix it by adding any random file with:

Code: Select all

default var_name = proper_value
and it should be fixed.
Yeah, that's what we did.
Image

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]