Persistent Data across multiple games.

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
Halca
Regular
Posts: 34
Joined: Thu Apr 28, 2011 9:21 pm
Location: Orlando, Florida
Contact:

Persistent Data across multiple games.

#1 Post by Halca » Thu Dec 29, 2011 12:13 am

The current project I'm working on is released in very small installments. However, since they are starting to have multiple endings, I need a way to keep the continuity intact. How can I make it so that someone's persistent data in a previous visual novel could be checked by a new visual novel and determine what story they get?

User avatar
Camille
Eileen-Class Veteran
Posts: 1227
Joined: Sat Apr 23, 2011 2:43 pm
Completed: Please see http://trash.moe
Projects: the head well lost
Organization: L3
Tumblr: narihira
Deviantart: crownwaltz
itch: lore
Contact:

Re: Persistent Data across multiple games.

#2 Post by Camille » Thu Dec 29, 2011 12:20 am


Halca
Regular
Posts: 34
Joined: Thu Apr 28, 2011 9:21 pm
Location: Orlando, Florida
Contact:

Re: Persistent Data across multiple games.

#3 Post by Halca » Thu Dec 29, 2011 12:24 am

That should be it, thank you. But I'm a bit confused about how to use it exactly. Is it an automatic thing? Or does the player have to load something?

Lina
Newbie
Posts: 10
Joined: Thu Jan 05, 2012 2:11 pm
Contact:

Re: Persistent Data across multiple games.

#4 Post by Lina » Sun Jan 15, 2012 4:22 pm

I admit that I haven't quite figured it out yet either. Maybe someone can help me with the MultiPersistent Data.

Here is what I want to do: I'm working on a visual novel with different branches, depending on the users choices.
I split the novel into chapters. So, let's say the user gets to make a first choice in chapter one. Chapter one is released in January. The second chapter is released one month later but the game should "remember" what choice the user made in chapter 1. Depending on the choice, the storylines will be different, so it's important that chapter 2 picks it up right.

As I understood, the MultiPersistent Data is the right thing for that. I checked out the Ren'Py Wiki, but I'm not quite sure how to apply the feature.

So, here is my Chapter 1 game:

Code: Select all

init:
    character block
    background images block

    $ mp = MultiPersistent("chapter1_game.org")


label start:
# code for game
# ...

# First choice to be made:
    "Greg" "Will you help me?"

menu:
    "Yes"
    Jump yes

    "No"
    Jump no

label yes:
    $ accepted = "positiv"
    "Greg" "Awesome!"
    jump epilog

label no:
    $ notaccepted = "negativ"
    "Greg" "What a pity."
    jump epilog

    $ mp.beat_part_1 = True
    $ mp.save() 

label epilog:
    "I wonder if I made the right choice".
    
    return

Chapter 2 game

Code: Select all

init:
    character block
    background images block

    $ mp = MultiPersistent("chapter1_game.org")

label start:
    
    if mp.beat_part_1:
    "Since I help Greg everything turned out just fine for me."
    else:
    "Why didn't I help Greg? My life has become a nightmare ever since."

Okay, I copied the persistent-variables from the wiki, but I don't really understand how to use them. So I'm almost certain that a code like that wouldn't work. Could anyone help me out here?

Lina
Newbie
Posts: 10
Joined: Thu Jan 05, 2012 2:11 pm
Contact:

Re: Persistent Data across multiple games.

#5 Post by Lina » Tue Jan 17, 2012 8:54 am

Okay, thanks to the help of someone, I think this is solved.

Game 1:

Code: Select all

init:
   $ mp = MultiPersistent("insertnamehere.com")

label start:

# Code for game

    menu:

        "Yes.":
            jump yes
            
        "No.":
            jump no

label yes:
    $ mp.yes1 = True
    $ mp.no1 = False
    $ mp.save() 
    
    $ accepted = "positiv"
    
    "Greg" "Awesome!"
    jump to newlocation


label no:
    $ mp.yes1 = False
    $ mp.no1 = True
    $ mp.save()    
    
    $ notaccepted = "negativ"
    
    "Greg" "What a pity!"
    jump to newloaction

label newlocation:
# more Code

    $ mp.beat_part_1 = True
    $ mp.save()

    return

Game 2:

Code: Select all

init:   
  
    $ mp = MultiPersistent("insertnamehere.com")

label start:
    if mp.yes1:
        jump yes
        
        
    else:
        jump no
        
label yes:
    #Storyarch A
    "Since I help Greg everything turned out just fine for me."
    
    #jump to another location or return to main menu

label no:
    # Storyarch B
    "Why didn't I help Greg? My life has become a nightmare ever since."
   
    #jump to ...
I tested it and it worked :).

Post Reply

Who is online

Users browsing this forum: Bing [Bot], TioNick