Ren'Py Can adding new renders cause errors and crashes when loading old saves?

lawfullame

Active Member
Game Developer
Aug 6, 2019
669
986
I'm considering adding a few renders to the older chapters of my VN. Can it cause problems with older saves? I will not delete any parts or interfere with the variables and conditions in these older chapters
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
I'm considering adding a few renders to the older chapters of my VN. Can it cause problems with older saves? I will not delete any parts or interfere with the variables and conditions in these older chapters

As long as you do what you've described... it'll be fine.

RenPy keeps a cross reference of each line of code in your script. Any time you add / update / delete lines of code, that cross reference is updated.
If you don't alter a line of code, it's cross reference ID remains the same (it's how RenPy copes with scripts constantly changing).
(My experience is that even if you do alter a line - as long as that change is tiny/simple, RenPy will cope).

Those cross reference codes are what is stored in the game's log (used by things like rollback and save/load).

When you load a save file (effectively the game log), it tries to match the last known line executed with the current game's cross reference.

If it finds a match... great... things restart at that point - even if all the code around it has been altered.​
If it doesn't find a match, it goes backward through the game log trying to find a line to match against. It'll usually find one without issue. But it doesn't... then the game has changed beyond all recognition and so the game gives an error.​

The cross reference is stored in the *.rpyc files generated when RenPy effectively "compiles" your scripts.
As long as you never delete any of those rpyc files, it's REALLY hard for RenPy to get confused enough to cause issues.
However, if you do... then the cross reference is rebuilt from scratch. Each line gets a new ID and chances are that new ID won't match the original one.

So yeah... leave the rpyc files alone and you shouldn't have any issues adding or altering scenes, dialogue or images.

Variables can sometimes cause issues. Most of those issues are solved by initializing variables using default (people still copy/paste code doing it the "old" way). But since you aren't planning to do that anyway, it shouldn't be an issue.
 
  • Like
Reactions: lawfullame

TDoddery

Member
Apr 28, 2020
170
160
79flavors knows way more than me but I can confirm from experience that adding new scenes works fine along the lines you are proposing and beyond.

In my case I was concerned that I made an update where the last scene of the previous version was no longer there. It bothered me in case a player had saved the game on that last scene and thus the save might not work.

But no, Ren'py just rolls it back to the previous scene which still exists and goes forward from there.

With stuff like that Ren'py is really very clever !