Releasing Extensions Without Losing Save Data

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
Holland
Regular
Posts: 92
Joined: Mon Jun 09, 2014 4:10 pm
Projects: Lycoris: Their Journies [WIP], With or Without You [NaNo19]
Location: NJ, USA
Contact:

Releasing Extensions Without Losing Save Data

#1 Post by Holland » Fri Aug 15, 2014 1:07 pm

Hello! I'm a bit stumped with something here.

The game we're working on now is quite long, so we'd like to break it up into short releases. These releases would add additional music, image, and script files. However, we're not sure how to keep the choice-based variable data from each of the original game saves when a new release is downloaded. I imagine that we could release the new scenes as .zips and just have the player extract the additional script and resources to their old game file, but that seems a bit tedious. Is there any way to automate it on their end so either:

1) The new download puts the script and resources in their old game file for them (preferred),
2) Or the new download grabs the saves from the previous game and imports them to the update.

And would we need a custom installer to do this or is there a feature built into Ren'Py to manage this type of thing?

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

Re: Releasing Extensions Without Losing Save Data

#2 Post by xela » Fri Aug 15, 2014 1:13 pm

Ren'Py Documentation wrote: Multi-Game Persistence

Multi-Game persistence is a feature that lets you share information between Ren'Py games. This may be useful if you plan to make a series of games, and want to have them share information.

To use multipersistent data, a MultiPersistent object must be created inside an init block. The user can then update this object, and save it to disk by calling its save method. Undefined fields default to None. To ensure the object can be loaded again, we suggest not assigning the object instances of user-defined types.

Code: Select all

class MultiPersistent(key)

    Creates a new MultiPersistent object. This should only be called inside an init block, and it returns a new MultiPersistent with the given key.

    key
        The key used to to access the multipersistent data. Games using the same key will access the same multipersistent data.

    save()

        Saves the multipersistent data to disk. This must be called after the data is modified.
Like what we're doing? Support us at:
Image

User avatar
Holland
Regular
Posts: 92
Joined: Mon Jun 09, 2014 4:10 pm
Projects: Lycoris: Their Journies [WIP], With or Without You [NaNo19]
Location: NJ, USA
Contact:

Re: Releasing Extensions Without Losing Save Data

#3 Post by Holland » Fri Aug 15, 2014 1:34 pm

I was hoping there was a feature to this effect :3
Now that I know what it's called, I should be able to look into it more on my own. Thank you!

Onishion
Veteran
Posts: 295
Joined: Mon Apr 20, 2015 10:36 am
Contact:

Re: Releasing Extensions Without Losing Save Data

#4 Post by Onishion » Fri Apr 24, 2015 7:12 am

I had a question on this feature. My plan is to release a game, allow players to progress through it, and then later release an update to the game that adds a lot of new features , but that would ideally allow them to retain all their current progress. The example under the persistence documentation gives a simple example, basically "did they beat the game? yes? Ok, remember that," but is there a simple way to keep track of a ton of variables? Like would I have to code it to represent something like this:

Code: Select all


$ mp.XP = XP
$ mp.HP = HP
$ mp.MP = MP
$ mp.Money = Money
$ mp.Skills = Skills  # (and as an aside, would this be the correct way to "save" a list variable?)
$ mp.ClearedDungeon1 = ClearedDungeon1

#etc. etc. etc.

$ mp.save()

. . .would I have to list out like that every single variable that I wanted to carry over to the new game, or is there a simpler way to batch in basically all the variables from the one game to the other?

Also, I would like it to be possible for players to start fresh on version two if they prefer or if this is the first time they're playing, so I'd also want to be able to initialize all those values to the original defaults if the player goes that route, so I wouldn't want the persistent data to automatically overwrite the defaults.

So basically. . . how does that all work? ;)

Post Reply

Who is online

Users browsing this forum: Google [Bot], Sergei Falcon