Why are things going wrong with reloading 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
User avatar
Chekhov
Regular
Posts: 113
Joined: Tue Jun 26, 2018 9:19 am
Projects: Pluton
Contact:

Why are things going wrong with reloading games?

#1 Post by Chekhov »

One thing I never quite cleared up in the interaction between ren'py / python, is how to use variables in the right way, so that rollbacks work well and that saving/reloading functions as it should.

I've recently picked up ren'py again, so I don't have a specific example. Let me express how I think things work. I'm sure I've made a false assumption somewhere in this short explanation:

----
Correct me where wrong:

* When you want to use variables that are constants and don't change, you set them in an "init python:" block.
* When you want to use variables that can change, you set them with "default variable = xxx"
* You are allowed to set or change these variables with python

----

Question 2:

I like to use plenty of objects. Do the questions above work for objects as well?

Sorry if these are basic questions!

-----

Question 3:

Are there other things I should keep in mind so that reverting things works well?

(I use a lot of nested call / return to navigate the logic, rather than jumps)

uncoded
Regular
Posts: 27
Joined: Fri Apr 09, 2021 10:29 am
Contact:

Re: Why are things going wrong with reloading games?

#2 Post by uncoded »

Without a specific example illustrating a case where "things go wrong after rollback", it's difficult to give a definitive answer.

Although I agree with you in principle that not cancelling operations properly is a recipe for failure, in my (~6 hours) experience with Ren'Py, I feel that data being not perfectly cleared during rollback wouldn't be too much a problem in the case of a VN, which has generally rather simple "flow". I mean, even if multiple story branches, those can be solved with a few (same number of branches) variables : if in the normal flow of the story (without going back), you shouldn't have already "seen" your future choices (ie. going back is "meta"), if necessary you just reset your variable(s) at the start of each branch just to make sure rollbacking won't bite you in the nose.

Specific counter-example :
  1. you display to the player a character appearance customization screen
  2. player customizes stuff, then goes to the next screen(s)
  3. player goes back to the character customization screen
In this case, if my variables still have the values they had when the player left this screen, then "it's not a bug, it's a feature" : because if the player goes back to this screen, it's (presumably) because he or she wants to alter one of two details of the character's appearance (change eyes color but keep haircut and clothes). So it's a polite thing to do to not force him or her to restart character customization from scratch.

Plus, complex customization screens should always contain a button "reset to defaults" anyway.
🐾

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]