How to create a Ren'Py game that updates episodically?

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
arcadekitten
Newbie
Posts: 3
Joined: Fri Apr 23, 2021 3:43 pm
Contact:

How to create a Ren'Py game that updates episodically?

#1 Post by arcadekitten » Fri Apr 23, 2021 6:00 pm

Hello everyone! This is my first time posting on these forums, so forgive me if anything is wrong or out of place.

My question is...well, the title! How would I go about creating a Ren'Py game that updates episodically?

Before I get any responses asking, yes, I am sure I want to do it this way. I'm working on multiple projects at once, so for me, it's much more beneficial to have a game I can update in small increments rather than releasing it all at once. :D !

If you've seen the game Hiveswap: Friendsim, I essentially want to do something like that. If you haven't, then I will try to explain the best I can! When you start up the game and hit "Start", you are greeted by a chapter select in the game's menu, and then an image map that asks you to choose between two characters. The character you click on is a route you will take, and then at the end of said route you'd return to the title screen and select what you want to do next. The game updated in "Volumes" and came with 2 new character routes per volume!

I want to do something like this as well, and update the game in a similar fashion. Around two new character routes per update/chapter until the game is complete!

However, I've only done very basic/simple things with Ren'Py before, so I'm totally unsure how to go about this. I may need my hand held, and you might have to treat me like I'm a liiiiitle stupid. ^__^"

Ideally, what I would like is for the game to be able to update into the same file. So for example, let's say I've got the first part of the game done. It's released with only Chapter 1. I would want to be able to simply update the distributions once Chapter 2 is ready, and the player could just download the updated distributions and it could overwrite the original game files while keeping their save data persistent. However, from looking this up in the past, I'm unsure if this is how it would work?

I've seen others imply that I would need to make multiple projects, and have the persistent data transfer over between them, which is...not ideal. Especially for a game that will update in small increments of about 2 small character routes per update. I would want every chapter accessible from the same file.

Another issue is variables/a point-system. From what I've seen from Hiveswap:Friendsim, it seems like that game uses very little--if any--variables or point-systems. From the looks of it, everything is determined by jumps and labels, or even just extended menu branches. For example, in Friendsim, you can get a characters "good-ending" by picking only the correct menu choices that lead you down one solid path--rather than collecting "points" and needing enough "points" for the good-ending. You can also seemingly start any chapter or character route any time you want. I can't really do this with the plans for my game, as it has a semi-linear narrative and I would need someone to complete all routes in Chapter 1 before starting Chapter 2, etc, which I would control through variables.

It is my understanding that if I needed to introduce new variables later down the line, that may prove problematic and cause issues within the game if I were to update it, like the player needing to start the game back from the beginning in order to play the newest parts with their new variables--otherwise they may run into an error, correct? Something like "chapter3points not defined" when chapter 3 is introduced and trying to introduce the new variable. Even with careful planning of how many variables I may need, I still may end up needing to introduce new variables later down the line!

What is the best way to go about making a game like this? Do I really have to upload separate projects and try to keep save data persistent between them? Would I be able to simply update the distributions without the game crashing or coming up with errors for my players? As stated before, I've really only done very simple things with the program before, so any help or advice is very much appreciated! Thank you for reading regardless! :)

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: How to create a Ren'Py game that updates episodically?

#2 Post by Ocelot » Fri Apr 23, 2021 6:45 pm

Here is a simple example. Create a new project and replace sript.rpy contents with following:

Code: Select all

init -10 python:
    chapters_avaliable = [
        ("Kingship", "ch_mk", []),
        ("Foundation", "ch_ys", ["Malkuth"]),
        ("Splendor", "ch_hd", ["Yesod"]),
        ("Victory", "ch_nz", ["Yesod"]),
    ]

screen chapter_select():
    style_prefix "choice"
    vbox:
        for item in chapters_avaliable:
            $ select = all(getattr(persistent, x) for x in item[2])
            textbutton item[0]:
                sensitive select
                action Return(item[1])

label start:
    scene bg
    call screen chapter_select
    jump expression _return
    return

label ch_mk:
    "The prologue. Must be completed before anything else."
    $ persistent.Malkuth = True
    return

label ch_ys:
    "First real chapter. Must be played after prologue"
    $ persistent.Yesod = True
    return

label ch_hd:
    "Left one of the branching paths."
    $ persistent.Hod = True
    return

label ch_nz:
    "Right one of the branching paths."
    $ persistent.Netzach = True
    return
Then play it. Open all routes, open some routes, does not matter. Then create file script2.rpy with following content:

Code: Select all

init 1 python:
    chapters_avaliable.extend([
        ("Beauty", "ch_tf", ["Hod", "Netzach"]),
        ("Discipline", "ch_gb", ["Tifereth"]),
        ("Kindness", "ch_cs", ["Tifereth"]),
    ])

label ch_tf:
    "First chapter of act 2. Must play all routes of act 1."
    $ persistent.Tifereth = True
    return

label ch_gb:
    "Second of the left paths."
    $ persistent.Geburah = True
    return

label ch_cs:
    "Second of the right paths."
    $ persistent.Chesed = True
    return
Drop that file in the game folder next to other rpy files. Start your game. Chapter list should extend and new chapters will be avaliable depending oh which chapters you have completed. Then you can create a following script3.rpy file:

Code: Select all

init 2 python:
    chapters_avaliable.extend([
        ("Understanding", "ch_bn", ["Geburah", "Chesed"]),
        ("Wisdom", "ch_ck", ["Geburah", "Chesed"]),
        ("Crown", "ch_kt", ["Binah", "Chokhmah"]),
    ])

label ch_bn:
    "End of left routes. Must have played act 2 to completion."
    $ persistent.Binah = True
    return

label ch_ck:
    "End of right routes. Must have played act 2 to completion."
    $ persistent.Chokhmah = True
    return

label ch_kt:
    "Epilogue, all routes must be cleared."
    $ persistent.Keter = True
    return
And do the same thing again. You should get last of the chapters. Check if it is what you want.
< < insert Rick Cook quote here > >

arcadekitten
Newbie
Posts: 3
Joined: Fri Apr 23, 2021 3:43 pm
Contact:

Re: How to create a Ren'Py game that updates episodically?

#3 Post by arcadekitten » Fri Apr 23, 2021 8:57 pm

Thank you, Ocelot! Though I am still having some problems.

The choices themselves work great, and I'm sure with a little fiddling I can get them to work like the imagemaps I want them to! However, I am encountering problems when trying to implement a point-system within a later script.

Essentially, I tried creating a 4th script based off what you gave me but implementing my own labels to make sure I understood the format. That worked just fine! Then, I tried implementing points...

As mentioned in the original post, I may need to implement point-systems later in the game for different endings or events. I don't know what they're all going to be from the start of the game, so I can't really safety-proof that. I decided to test this by attempting to define a point system in the 4th script and loading up a save file to see what happens. I have it formatted as such:

Code: Select all

init 3 python:
    chapters_avaliable.extend([
        ("Angel", "ch_an", ["Keter"]),
        ("Devil", "ch_de", ["angeldone"]),
        ("Afterlife", "ch_af", ["devildone"]),
    ])

$goodpoints = 0

label ch_an:
    $goodpoints += 1
    "End of left routes. Must have played act 3 to completion."
    if goodpoints == 2:
        "Hey, you got two good points!"
    else:
        jump start
    $ persistent.angeldone = True
    return

label ch_de:
    "End of right routes. Must have played act 3 to completion."
    $ persistent.devildone = True
    return

label ch_af:
    "Final Epilogue, all routes must be cleared."
    $ persistent.theafterlife = True
    return

My intention here being that if I clicked on "Angel" twice, I would receive two "goodpoints" and then it would have the game end. Otherwise, it would just put me back at the start until I received two goodpoints. This way I could test if a new point-system implemented later in the game would be functional. Unfortunately, things were just as I suspected. If I tried to load up my save and clicked on "Angel", I would get the error message that "goodpoints" is not defined. It doesn't seem to matter where I try to define "goodpoints", it always ends up with the same message(unless there's some other way to do it?). It seems the only way to get this to work is if I defined "goodpoints" at the very beginning of the game and then started the game from "Start" instead of from a save file. This is what I'm trying to avoid as I don't want players to have to restart the game every time an update is released, rather than just loading directly from their saves(even if their persistents will stay).

I hope the wording isn't too confusing--is there a way I can avoid this? Is there a way to define a new point-system in a later script should I need it? Or do I need to do some other work around to ensure my players won't get an error message when attempting to load in an old file with a new script that has new points? Thank you again for any help you can provide!

User avatar
Jackkel Dragon
Veteran
Posts: 269
Joined: Mon Mar 31, 2014 7:17 pm
Organization: Nightshade, Team Despair
itch: jackkel-dragon
Location: USA
Contact:

Re: How to create a Ren'Py game that updates episodically?

#4 Post by Jackkel Dragon » Fri Apr 23, 2021 11:07 pm

I didn't read through the whole thing yet, but for the undefined variables, make sure you're using "default" statements to set up variables that are used in more than one label. If necessary, make a separate .rpy file just for initializing variables. For instance:

Code: Select all

default route = "alone"
default harem_available = False
default affection = 0
These should be completely unindented, since you want them global and I'm not sure what happens if you put them in python/init/renpy blocks. Basically, the game will use these values on startup if it doesn't find a value in the loaded game and nothing new is set mid-game.

As for actually putting out new episodes of a game, there's technically functionality for a web updater described on the documentation, but I've never tried it. Otherwise, new episodes can be released like new builds of an expanding game (how I handle my open beta projects) or as little packages of files that players then put into the base game folder. (In this latter case, it may be best to use the archive functionality to its fullest to make each episode's assets package into its own .rpa file. This is especially useful for any game that puts out episodes as paid DLC.)

Hopefully that helps. I'll try to read a bit more closely if the above still doesn't make sense.
Main Website
Includes information about and links to many of my current and past projects.

Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series

arcadekitten
Newbie
Posts: 3
Joined: Fri Apr 23, 2021 3:43 pm
Contact:

Re: How to create a Ren'Py game that updates episodically?

#5 Post by arcadekitten » Sat Apr 24, 2021 9:14 am

Thank you so much, Jackkel Dragon! I did exactly what you suggested and made a separate .rpy file for initializing variables. I tried it out with both the goodpoints and adding a new variable called badpoints, and everything works just fine, even when loading from an old save file! Thank you, this is sure to help me with what I need! :D

Post Reply

Who is online

Users browsing this forum: Google [Bot]