How could Achievements be wiped but not the Gallery?

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
skybeargames
Newbie
Posts: 10
Joined: Fri May 31, 2019 12:16 am
Completed: The Nine Lives of Nim: Fortune's Fool , Wonderland Nights: White Rabbit's Diary
Projects: Her Jentle Hi-ness
Tumblr: skybeargames
itch: skybeargames
Location: New Zealand
Contact:

How could Achievements be wiped but not the Gallery?

#1 Post by skybeargames » Mon Jun 07, 2021 7:35 pm

Hi all, first time question poster, long time lurker.

I've got a friend I've made on Twitter who has an unusual conundrum with one of my games, and I just cannot figure out what is up with her problem.

The game is The Nine Lives of Nim: Fortune's Fool. This person has played it, unlocked all the achievements, and then updated the game when I released the voice acting update to find that all her achievements are gone in the game's internal achievements record. Steam still has them unlocked though.

BUT, to complicate matters, the galleries in the game are still all filled in!

I'm very confused. I was under the impression that the Achievements API uses persistent data. The only difference I can see in how I programmed my achievements screen and my gallery screen is that the gallery is looking at persistent image unlock variables, and my achievements index is looking at achievement.has. How can one be unlocked, but the other suddenly be locked after an update?

Now, there are a few more complicating factors that I have gleaned from talking to her.
1) It seems another non-Ren'py game is having the same problem for her, internal achievements are showing as locked but Steam says she has them. I asked if she wiped her caches or anything, she can't remember doing so. She's playing on the same machine as before.
2) The game did have a name/branding change after initial release. She unlocked everything before the name change in November last year. I have no idea if this would have any impact. I didn't change any code around the gallery or achievements areas in any of the updates (art upgrade and name change November last year, voice acting update last month).

Does anyone have any ideas? I've tried a bunch of hypotheticals but nothing is working for me. achievements.sync() and achievements.Sync() don't seem to make a difference. Very strange!!

(P.S. I am totally expecting the answer to be something that is going to make me kick myself :lol: )

User avatar
emz911
Regular
Posts: 78
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: How could Achievements be wiped but not the Gallery?

#2 Post by emz911 » Tue Jun 08, 2021 1:22 am

Haven't seen your code, could you have defined or make default your persistent achievement variables? It's hard to tell what's wrong this way.
Despite what's causing the problem, you might want to let players regain their achievements in-game by checking them in init:

Code: Select all

If achievement.has("achievement_name") and not persistent.achievementname:
      #Make the persistent variable to true again
Somewhere along those lines should make up for their lost achievements.

skybeargames
Newbie
Posts: 10
Joined: Fri May 31, 2019 12:16 am
Completed: The Nine Lives of Nim: Fortune's Fool , Wonderland Nights: White Rabbit's Diary
Projects: Her Jentle Hi-ness
Tumblr: skybeargames
itch: skybeargames
Location: New Zealand
Contact:

Re: How could Achievements be wiped but not the Gallery?

#3 Post by skybeargames » Tue Jun 08, 2021 3:30 am

Hey, I appreciate the difficulty with not showing my code, I'll do so if I can think of where it's going to be important because it's a lot of code we're talking about here. But I'll show relevant samples below, thanks.

So I don't have any Achievement persistent values. I was relying solely on the Achievements API to do that. No problems with it up until now. Reading the documentation it says that "By default, the achievement stores information in the persistent file". I'm wondering if the next thing to try is registering the achievements right at the top of the game, rather than immediately before granting them. Maybe if I sync after that, it will make it all pop back in?

Here is how I grant achievements:
$ achievement.grant("My spirits, as in a dream")
$ achievement.register("My spirits, as in a dream")
$ achievement.sync()

Here is how I unlock a gallery picture:
scene bg faerie with fade
$ persistent.unlock_faeriebg = True

Here is how I have coded my achievements screen:
if achievement.has("Fortune's Cat"):
text "{color=#ab944c}You have finished the Friend of Cats storyline.{/color}"
else:
text "You have not finished the Friend of Cats storyline."

For making my gallery I used Dirchansky's Gallery tutorial: https://dirchansky.itch.io/come-for-a-d ... l-tutorial

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1077
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: How could Achievements be wiped but not the Gallery?

#4 Post by Ocelot » Tue Jun 08, 2021 3:48 am

This is something really strange. Are you sure that you don't call achievement.clear_all() anywhere? This is the only thing I can think about. Also it looks like your game does not properly connect to Steam there: achievement.has returns True if achievement is granted in any backend, be it persistent data, or steam.

Syncing achievements tries to grant steam achievements unlocked in persistent data, so it would not help there.
< < insert Rick Cook quote here > >

skybeargames
Newbie
Posts: 10
Joined: Fri May 31, 2019 12:16 am
Completed: The Nine Lives of Nim: Fortune's Fool , Wonderland Nights: White Rabbit's Diary
Projects: Her Jentle Hi-ness
Tumblr: skybeargames
itch: skybeargames
Location: New Zealand
Contact:

Re: How could Achievements be wiped but not the Gallery?

#5 Post by skybeargames » Tue Jun 08, 2021 11:19 pm

Nope, no clear_all, but that's a fair call :lol:

That is interesting to hear that it's not connecting properly with just achievement.has on the achievements screen. And also, achievement.has is how I grant certain new game plus features. So... the problem is with achievement.has? Do you think? Is there something I have to do to connect it up again? Did something change in a Ren'py update perhaps?

User avatar
emz911
Regular
Posts: 78
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: How could Achievements be wiped but not the Gallery?

#6 Post by emz911 » Wed Jun 09, 2021 3:03 pm

skybeargames wrote:
Tue Jun 08, 2021 11:19 pm
Nope, no clear_all, but that's a fair call :lol:

That is interesting to hear that it's not connecting properly with just achievement.has on the achievements screen. And also, achievement.has is how I grant certain new game plus features. So... the problem is with achievement.has? Do you think? Is there something I have to do to connect it up again? Did something change in a Ren'py update perhaps?
What do you mean you use achievement.has to grant other features? This statement only checks for the achievement, returning true if unlocked. For granting you use achievement.grant, not has... It might help if you could show the codes where you unlock achievements, "grant other features," as well as the code of the screen where you check for them.

skybeargames
Newbie
Posts: 10
Joined: Fri May 31, 2019 12:16 am
Completed: The Nine Lives of Nim: Fortune's Fool , Wonderland Nights: White Rabbit's Diary
Projects: Her Jentle Hi-ness
Tumblr: skybeargames
itch: skybeargames
Location: New Zealand
Contact:

Re: How could Achievements be wiped but not the Gallery?

#7 Post by skybeargames » Wed Jun 09, 2021 6:03 pm

No problem, here we go:

Here is how I grant achievements:

Code: Select all

$ achievement.grant("My spirits, as in a dream")
$ achievement.register("My spirits, as in a dream")
$ achievement.sync()
Here is how I have coded my achievements screen:

Code: Select all

if achievement.has("Fortune's Cat"):
text "{color=#ab944c}You have finished the Friend of Cats storyline.{/color}"
else:
text "You have not finished the Friend of Cats storyline."
Here is how I grant special bonuses for new game plus:

Code: Select all

if achievement.has("Fortune's Cat"):
                    $ KNO += 3

User avatar
emz911
Regular
Posts: 78
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: How could Achievements be wiped but not the Gallery?

#8 Post by emz911 » Wed Jun 09, 2021 7:22 pm

Hmm I don't immediately see any problem with the code... Just to make sure, if you clear persistent and test these achievements yourself, they work as intended right?
You also said that you changed the game name/branding, where specifically did the change happen in? options.rpy? If so, I wonder if the Renpy achievement module has something to do with the game's name...
We can do some elimination first then ask in the Discord server!

skybeargames
Newbie
Posts: 10
Joined: Fri May 31, 2019 12:16 am
Completed: The Nine Lives of Nim: Fortune's Fool , Wonderland Nights: White Rabbit's Diary
Projects: Her Jentle Hi-ness
Tumblr: skybeargames
itch: skybeargames
Location: New Zealand
Contact:

Re: How could Achievements be wiped but not the Gallery?

#9 Post by skybeargames » Wed Jun 09, 2021 11:07 pm

Yep, my achievements do unlock as expected if I clear persistence and re-unlock them.

Good idea, here is what I have in options.rpy:

The original release:

Code: Select all

define config.name = _("Prince of Cats")
define build.name = "PrinceOfCats"
The latest release:

Code: Select all

define config.name = _("The Nine Lives of Nim: Fortune's Fool")
define build.name = "FortunesFool"
Not sure about whether the Achievements module relies on them. I do know it needs the steamappid but that's definitely correct in both releases.

User avatar
emz911
Regular
Posts: 78
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: How could Achievements be wiped but not the Gallery?

#10 Post by emz911 » Fri Jun 11, 2021 1:35 am

Maybe experiment by creating a new game. Unlock the achievements with the same code, change those name configurations, then launch the game again and check if the achievements are lost. If you can't replicate it, the problem is most probably on the users side (can't think of anything else that would cause this problem!)

skybeargames
Newbie
Posts: 10
Joined: Fri May 31, 2019 12:16 am
Completed: The Nine Lives of Nim: Fortune's Fool , Wonderland Nights: White Rabbit's Diary
Projects: Her Jentle Hi-ness
Tumblr: skybeargames
itch: skybeargames
Location: New Zealand
Contact:

Re: How could Achievements be wiped but not the Gallery?

#11 Post by skybeargames » Fri Jun 11, 2021 10:47 pm

Thanks emz911, I'll give it a go when I get a chance and post up here how it goes. I'm not sure it will happen for me because it was just that one user experiencing it. But QA life continues :D

Post Reply

Who is online

Users browsing this forum: Google [Bot], LuckyT