Questions on rollback

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
Quin
Regular
Posts: 117
Joined: Sun Nov 20, 2005 4:29 am
Location: Maine
Contact:

Questions on rollback

#1 Post by Quin » Tue Nov 22, 2005 4:56 am

I've written my first paltry Ren'Py script, and I've gotten so excited that I'm ready to jump with both feet into writing a proof-of-concept game. But even though I'm still on my first sheet of scrap paper (and, boy, do I go through scrap paper!), I've already run into a couple of issues I'm uncertain about, both regarding rollback. (If these questions are ignorant, forgive me; I've only played a few ren'ai games so far.)

First, I noticed one of the games I've played (The Garden Society: Kykuit), which was made pre-5.1.4, allows 10 lines of rollback after loading a saved game. The Ren'Py blog mentions 5.1.4 increased default rollback to 100 lines (which I assume means it can be set to something else), and that it can also be blocked at points with renpy.block_rollback().
My question: Does all this mean that if I make no reference to rollback in my script, the game will now allow rollback up to 100 lines in a session, even if the player loads a saved game?

Second, I'd like to know how rollback affects variables and flags. I'll write the example in English because I'd probably mess it up in code at this point.

Code: Select all

Menu header:  "What do you want to do this afternoon?"
Menu choice:  "Take a nap"
     "You feel rested."
Menu choice:  "Rake leaves for Mrs. C"
     "You rake leaves and get paid $5."
     dollars = dollars + 5
     hard_worker = True
Menu choice:  "Buy a surfboard" (appears only if dollars > or = 250)
     "You head down to the surf shop and purchase a snazzy board."
     dollars = dollars - 250
     have_surfboard = True
(end of menu)
What happens if a user picks the "Rake leaves" option and gets $5, then rolls back to the menu and picks "Rake leaves" again? Does the rollback allow the increment in dollars over and over again? Or does the rollback decrement the dollars on the way back? Likewise with the hard_worker flag -- if it was False before the menu, the player picks "Rake leaves", then rolls back and picks "Take a nap", does the flag end up true or false?

And while I'm here, what is the actual syntax to increment/decrement a variable? I see from the manual that setting a value is:

Code: Select all

$ dollars = 20
I'm not up on my Python; what's the syntax to increment/decrement?

Thanks so much... I'm getting very excited about this!

User avatar
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#2 Post by monele » Tue Nov 22, 2005 6:53 am

I haven't tested it but I'd be very surprised if rollback permitted such cheating maneuvers ;). Ok, I'll be bold : yes it sets variables back to their previous state if you rollback.

To increment :

Code: Select all

$ var = var + 10
or
$ var += 10
To decrement, replace '+' by '-'

User avatar
PyTom
Ren'Py Creator
Posts: 15986
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:

#3 Post by PyTom » Tue Nov 22, 2005 9:00 am

Just to confirm, monele has it right. Rollback will reset variables to the values they had before the rollback. (This is true for variables changed after the initial init phase, and for objects reachable from such variables.)

In general, Ren'Py tries to do The Right Thing when it comes to rollback.
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

User avatar
Quin
Regular
Posts: 117
Joined: Sun Nov 20, 2005 4:29 am
Location: Maine
Contact:

#4 Post by Quin » Tue Nov 22, 2005 11:24 am

This... is just... amazing.

Where else can you ask a noobesque question before going to bed and wake up to find two good answers... which agree with each other... and without any snide mockery or counternoobance?

I'm so... happy! (brushes away tear of joy)

Thank you so much, monele and PyTom! I'll make you proud to have helped me, I promise!

(runs off to channel some of this emotion into game design)

Guest

Re: Questions on rollback

#5 Post by Guest » Tue Jan 06, 2009 3:13 pm

A tiny question about this topic:
Is it possible to make exceptions from this rule?
For example: I want to summarize the last five pages of dialogue by setting a flag named "recollection01".
The flag is set after a certain point of the game and on rollback the summarization is presented instead of the
normal history or rollback.

User avatar
PyTom
Ren'Py Creator
Posts: 15986
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: Questions on rollback

#6 Post by PyTom » Tue Jan 06, 2009 3:24 pm

This isn't easy. For one thing, it's actually pretty hard to set recollection01 in such a way that it doesn't get unset when rolling back to before the point where it was first set.
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

iichan_lolbot
Veteran
Posts: 206
Joined: Tue Dec 30, 2008 9:18 am
Projects: iichan erogame
Contact:

Re: Questions on rollback

#7 Post by iichan_lolbot » Fri Jan 09, 2009 12:31 pm

PyTom wrote:This isn't easy. For one thing, it's actually pretty hard to set recollection01 in such a way that it doesn't get unset when rolling back to before the point where it was first set.
Do you mean, that even persistent.* values would suffer?

User avatar
PyTom
Ren'Py Creator
Posts: 15986
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: Questions on rollback

#8 Post by PyTom » Fri Jan 09, 2009 12:33 pm

They won't, but the problem with using persistent data here is that it stays set during the next play-through.
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

User avatar
JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Questions on rollback

#9 Post by JQuartz » Fri Jan 09, 2009 5:37 pm

There used to be a method in the past but it seem to not work anymore Last time the data in lists will not reset on rollback, kind of annoying, had to make a set of code to reset the data. If you know why this happened last time, maybe you can use the same priciple to prevent rollback from reseting your data.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

User avatar
PyTom
Ren'Py Creator
Posts: 15986
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: Questions on rollback

#10 Post by PyTom » Fri Jan 09, 2009 5:40 pm

Generally, any data failing to reset during rollback is a bug, and should be treated as such, not relied on.
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

User avatar
JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Questions on rollback

#11 Post by JQuartz » Fri Jan 09, 2009 6:01 pm

I see. It was really a bug. I had suspected it to be so. If I knew it was going to be fixed I wouldn't need to make a set of code to reset the data.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

Lurker
Newbie
Posts: 9
Joined: Sun Sep 28, 2008 10:38 pm
Contact:

Re: Questions on rollback

#12 Post by Lurker » Mon Mar 02, 2009 1:42 am

Sorry for bringing this up but I have a question related to the topic.

Can I make the rollback so that the user won't be able to redo the choice they have made (except for loading back to that save slot)?

User avatar
JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Questions on rollback

#13 Post by JQuartz » Mon Mar 02, 2009 10:07 am

Lurker wrote:Can I make the rollback so that the user won't be able to redo the choice they have made (except for loading back to that save slot)?
Is this what you wanted? http://www.renpy.org/wiki/renpy/doc/ref ... k_rollback
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

Lurker
Newbie
Posts: 9
Joined: Sun Sep 28, 2008 10:38 pm
Contact:

Re: Questions on rollback

#14 Post by Lurker » Mon Mar 02, 2009 11:55 am

Wa, can't believe I missed that :shock: . Thank you very much.

Ah and I forgot to mention this in the first post but can we make it so that when the user roll back, the screen will show past dialogue in NVL mode like most of dating sim game out there?

This is not really important to me but if possible, I would like to include this in my game.

User avatar
chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

Re: Questions on rollback

#15 Post by chronoluminaire » Mon Mar 02, 2009 1:35 pm

The combination of the two features you're asking for - displaying past text in a different colour, and stopping the user changing their choice - are in combination known as "readback", to distinguish from "rollback" which makes it really as if you'd gone back in time.

Readback is controversial. PyTom has always had major philosophical objections to it (you can see some of his posts about it here). Despite that, he implemented a version of it back in 2005 for Ren'Py 4.7, and a few people used it in games, including me in When I Rule The World. There turned out to be significant bugs in that implementation, and readback mode was plagued with bugs for as long as it was supported. Some of the people who requested it in the first place, such as me, became convinced over time that PyTom's opinion actually made sense, and so as the problems with that module became apparent and the core Ren'Py code changed to become incompatible with it, support was dropped.


That thread includes a comparison saying that readback is a bit like shooting a film in black-and-white. Colour is better technically and provides a richer user experience, but some creators might prefer to provide things in black-and-white.

I think there's something to that comparison, but you should think very hard before trying to ban rollback in favour of readback. In particular, consider:
* Are you banning saving and loading games? If not, then the player could just save her game before or at every branch. They're going through more hassle and fiddly interaction with the game menu to achieve the same thing rollback provides for free.
* If you are banning saving and loading games, are you banning restarting the game, skip mode, and reinstalling it?
* What kind of players are you imagining this decision is for?
** There are players who'll play straight through even when rollback is available, and won't be affected at all. They might step back to reread some text they missed due to an accidental double-click, but they won't change their decisions.
** There are players who want to see both ways a branch can go, for whatever reason. If you're banning rollback in favour of readback, but allowing saving and loading, then all you're doing is making things more fiddly for these users: either they have to go in and out of the game menu (breaking immersion) to play in their desired style, or they have to go back to the start of the game and skip through back to that choice.

Displaying rollback text in a different style is possible, I think. This page suggests that specifying a Ren'Py style for "style.say_dialogue['rollback']" will let you change the colour of rolled-back text (and you can replace "say_dialogue" with any other style chosen from your shift-D Style Hierarchy).


If, after consideration of all these things, you still want to use readback, then there's a readback module available here which apparently works in Ren'Py 6.7. Give it a try and see if it works for you.
I released 3 VNs, many moons ago: Elven Relations (IntRenAiMo 2007), When I Rule The World (NaNoRenO 2005), and Cloud Fairy (the Cute Light & Fluffy Project, 2009).
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!

Post Reply

Who is online

Users browsing this forum: Google [Bot]