Ren'Py Save System issue

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.
Message
Author
Valaith
Newbie
Posts: 6
Joined: Wed May 10, 2017 8:01 pm
Contact:

Ren'Py Save System issue

#1 Post by Valaith » Wed May 10, 2017 8:19 pm

Hello everyone. I am fairly new to Ren'Py and am working to develop my own game. In doing so, I am researching ways to do things by playing other games made with this system. Recently, I have come across two games that have an issue with their save system and this may be that they just used default Ren'Py settings.

My wife and I use the same computer, we have our own Windows logins and our own Steam profiles. I purchased numerous games on Steam and I shared my library with her. While I was at work, she played through a few games and got a bunch of achievements. When I got home, I wanted to play one of those games. I noticed immediately that I had access to all the saves that she had created. I also could not unlock any achievements as the game thought I had already done so. It appears that all the save information was being stored in the same folder that the game was installed in. The same thing happened in another game by another dev. Just to make sure there was nothing wrong with my Steam account, I installed a new game that my wife had not yet played and I was able to get achievements. I also, on another computer, installed one of the games that I was having an issue with and got achievements there as well.

So... Here's the question. How does one get the Windows user information so that the game can store save information within that Windows profile (i.e. c:\users\valaith) instead of saving files into the games install folder? I'd like to inform the devs of their issue and also give them a resolution. Hopefully this resolution can also work on platforms other than Windows. I'd like to use this information for my own game(s) so that other families that use one computer do not have the same issue I am seeing.

Thank you in advance for your help.

User avatar
Saltome
Veteran
Posts: 237
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Ren'Py Save System issue

#2 Post by Saltome » Thu May 11, 2017 5:34 pm

*sigh*... This is obnoxious.
What you're asking is a bit much, I doubt many indie developers are gonna bother with such a task.
Still, it might be possible. I assume the game can get the information about the current windows user from the operating system, then cross retrieve a list of possible steam achievements, and keep track of the received achievements for each individual user, offline. I don't really know how steam handles achievements on the same machine. (outside of using separate steam accounts)
And to make matters even MORE fun. Renpy's custom os module doesn't even have the method which would provide the information about the active user. So if they were to do that, they'd either have to put the missing method into renpy, or use it to start a new program which can check the user independently and then give that information to renpy(I think a method like that still exists in renpy). ...All in all, fun times.

Best you can hope for is if they make it possible to create user accounts for the game, so you can keep your saves separate.

As far as achievements go, that isn't happening. Like I said, no idea how steam handles multiple users on the same machine, so you're better off going there and looking into that.
Deviant Art: Image

Valaith
Newbie
Posts: 6
Joined: Wed May 10, 2017 8:01 pm
Contact:

Re: Ren'Py Save System issue

#3 Post by Valaith » Thu May 11, 2017 6:08 pm

Achievements have to be read from something. Is it the persistent file? I'm not a dev on Steam so I don't know but hopefully someone here is and can answer. Whatever file stores this information needs to be moved to where the save files are (as long as it isn't in the game folder, I assume). That would solve that problem.

As long as the game is written correctly, both my wife and I can pop the same achievement in the same game on the same computer. We've done this. I believe it was a Ren'Py game. I've attempted to reach out to the dev but they are not responding. So I came here in hopes that someone has solved this issue and is willing to share how.

User avatar
Saltome
Veteran
Posts: 237
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Ren'Py Save System issue

#4 Post by Saltome » Thu May 11, 2017 6:26 pm

No, as far as I'm aware the achievements are handled on steam. All the game does is tell the server when to unlock the achievement. So games don't normally need to keep track of the achievements on the computer.
Which now that I think about it, presents a unique problem. Since renpy doesn't like saving when there is an open connection. That makes things a little more complicated, but it's irrelevant.

I really don't think this is an universal problem to solve. It's a matter of how each individual game is made, and most aren't made with your particular problem in mind.
Deviant Art: Image

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Ren'Py Save System issue

#5 Post by PyTom » Thu May 11, 2017 6:34 pm

Right now, Ren'Py stores the achievement information with the game. This lets games be moved between computers (say, on a USB stick), without losing any of the important information.

The best workaround would be to configure Steam such that you and your wife each get your own copy of Ren'Py. Apart from that, if you could somehow make the game/saves directory unreadable and unwritiable, it would force Ren'Py to only look in the other (user-specific) location.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Saltome
Veteran
Posts: 237
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Ren'Py Save System issue

#6 Post by Saltome » Thu May 11, 2017 6:52 pm

... how about deleting the folder? I assume renpy will just recreate it though.

Another thing you might try is messing with the folder security permissions. Maybe if you remove everyone's permissions from the folder that has the save data it might be enough to confuse the game.(Especially if you are running it from a different user.)
Deviant Art: Image

Valaith
Newbie
Posts: 6
Joined: Wed May 10, 2017 8:01 pm
Contact:

Re: Ren'Py Save System issue

#7 Post by Valaith » Thu May 11, 2017 7:26 pm

Let's take Steam out of the equation. The save files would still be an issue if the game was sold outside of Steam. Anyone that played the game on the same computer would have access to all the saves that the previous people made.

This shouldn't be.

Saltome wrote:No, as far as I'm aware the achievements are handled on steam. All the game does is tell the server when to unlock the achievement. So games don't normally need to keep track of the achievements on the computer.
This isn't true. I was repeatedly playing one game that my wife played and the achievements wouldn't unlock for me. I followed a guide just to be sure. I played the same game on another computer and I was then able to get the achievement. Steam must be looking at a file on the PC and seeing if the achievement was triggered and then unlocks it. If the file says it was already unlocked, then it won't try to unlock it. Since it was fresh on this other PC, I was able to get the achievement.

User avatar
Saltome
Veteran
Posts: 237
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Ren'Py Save System issue

#8 Post by Saltome » Thu May 11, 2017 7:35 pm

Either way PyTom told you what you should do, and I told you how you can make it happen.
Give it a try.
Deviant Art: Image

Valaith
Newbie
Posts: 6
Joined: Wed May 10, 2017 8:01 pm
Contact:

Re: Ren'Py Save System issue

#9 Post by Valaith » Thu May 11, 2017 7:42 pm

I'm sorry but these are not solutions. Ren'py isn't distributed on Steam so installing it twice doesn't do anything. It shouldn't be up to the end user to get the games to function. I shouldn't have to delete folders or write protect files. If it is a limitation of the software, then we'll leave it at that.

I was hoping that someone might have some code to do the work so that the dev's can fix their game and that I can attempt to use it in my own games. From the look of it right now, I'll have to find a different platform to work with which is unfortunate as I was having fun with Ren'Py.

User avatar
Saltome
Veteran
Posts: 237
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Ren'Py Save System issue

#10 Post by Saltome » Thu May 11, 2017 8:42 pm

And just what renpy game have you played which allows you to have separate steam achievements on the same steam account, on the same machine?
Deviant Art: Image

Valaith
Newbie
Posts: 6
Joined: Wed May 10, 2017 8:01 pm
Contact:

Re: Ren'Py Save System issue

#11 Post by Valaith » Fri May 12, 2017 8:29 am

Saltome wrote:And just what renpy game have you played which allows you to have separate steam achievements on the same steam account, on the same machine?
You misread something somewhere. We are not using the same Steam account. Steam isn't the problem. The programming of the game is. Steam is just the reason that I figured out that there is a problem.
Saltome wrote:I really don't think this is an universal problem to solve
I believe it is. I don't recall ever seeing this issue in the past. Worst case there were save profiles where a player A could save to Block 1 and player B could save to block 2. Here, the saves are fully accessable to all users on the PC with no way of knowing what save belongs to whom.
Saltome wrote:It's a matter of how each individual game is made
Correct
Saltome wrote: and most aren't made with your particular problem in mind.
Because Indy dev's are not testing for this situation. They most likely see that the game is working and stamp it done. If the dev is the only one that has access to the computer, they would never see this as a problem and thus wouldn't account for it.

User avatar
Saltome
Veteran
Posts: 237
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Ren'Py Save System issue

#12 Post by Saltome » Fri May 12, 2017 2:22 pm

Something isn't right here.
When I save a file it creates a copy in both the game/save directory and the %APPDATA% save directory
When loading the list, the game combines the save files from both folders, and if there are save files with the same name but different content, the folder in %APPDATA% takes precedense.
And I couldn't figure out how the game decides which user's appdata to access.
Deviant Art: Image

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

Re: Ren'Py Save System issue

#13 Post by Ocelot » Fri May 12, 2017 2:42 pm

Saltome wrote:And I couldn't figure out how the game decides which user's appdata to access.
...It accesses current user...

Game does not decide anything. It just asks OS where directory for roaming profile data is located. And gets said directory for currently logged in user.
< < insert Rick Cook quote here > >

User avatar
Saltome
Veteran
Posts: 237
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: Ren'Py Save System issue

#14 Post by Saltome » Fri May 12, 2017 2:52 pm

And how does it do that? I already looked into that, and all the relevant methods from the OS module are gone. So how does it check who the user is?
Deviant Art: Image

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

Re: Ren'Py Save System issue

#15 Post by Ocelot » Fri May 12, 2017 3:04 pm

Here is the code used by Renpy to select user-specific save directory:
https://github.com/renpy/renpy/blob/9b7 ... py.py#L127

Code: Select all

if 'APPDATA' in os.environ:
    return os.environ['APPDATA'] + "/RenPy/" + save_directory
else:
    rv = "~/RenPy/" + renpy.config.save_directory
    return os.path.expanduser(rv)
< < insert Rick Cook quote here > >

Post Reply

Who is online

Users browsing this forum: TioNick