How to detect if a user has obtained a Steam achievement

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
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

How to detect if a user has obtained a Steam achievement

#1 Post by thirstyoctopus »

Hi everyone

I'm working on extra content for my game, Bistro Days, that is already released on Steam. The problem is, this extra content is a side story that is only available to players who have completed the main game (and, in turn, obtained an achievement from Steam to determine the girl who's heart they won).

My first thought was to add a persistent variable at the very end of the last chapter (as long as it's the good end) to set that the player has completed the game in order to unlock the special story, but this is essentially useless if the player has already competed the game before the new content is added - I don't want to have to force the player to play through again, or at least from their last save.

My question is, how can I detect if the user has obtained a specific Steam achievement, so I can then go ahead and unlock the new content for them if they download it AFTER completing the main story?

Thanks
Michael

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

Re: How to detect if a user has obtained a Steam achievement

#2 Post by Ocelot »

First of all: Steam achievements are not a good way to measure anything. They can be unlocked without doing anything, they might not be unlocked even if user earned them (I often play VNs in offline mode, so online achievements are not unlocked reliably.). You might want later to distribute your game outside of Steam...

Probably the better way would be do like Umineko did it: lock it if you cannot determine if player finished the game, but allow unlocking it by clicking on it, warning user about consequences.

If you still want to do this through achivements, documentation has your back: https://www.renpy.org/doc/html/achievem ... vement.has
< < insert Rick Cook quote here > >

User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Re: How to detect if a user has obtained a Steam achievement

#3 Post by thirstyoctopus »

Ocelot wrote: Fri Mar 11, 2022 6:55 am First of all: Steam achievements are not a good way to measure anything. They can be unlocked without doing anything, they might not be unlocked even if user earned them (I often play VNs in offline mode, so online achievements are not unlocked reliably.). You might want later to distribute your game outside of Steam...

Probably the better way would be do like Umineko did it: lock it if you cannot determine if player finished the game, but allow unlocking it by clicking on it, warning user about consequences.

If you still want to do this through achivements, documentation has your back: https://www.renpy.org/doc/html/achievem ... vement.has
Thanks for your response. Who is Umineko? I assume what you mean is a button that unlock the extras regardless of game completion? Since I am not the publisher of the game (only the dev) I'm not sure he would like it done. But I do see your point about the achievments not being the most reliable. Is there a way to read data in a save file though instead?

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

Re: How to detect if a user has obtained a Steam achievement

#4 Post by Ocelot »

thirstyoctopus wrote: Fri Mar 11, 2022 7:51 am Who is Umineko?
Umineko no naku koro ni (Umineko: when seagulls cry) is a episodic VN. Unlock warning looks like that: https://i.imgur.com/fe1W8c7.jpeg
thirstyoctopus wrote: Fri Mar 11, 2022 7:51 am I assume what you mean is a button that unlock the extras regardless of game completion? Since I am not the publisher of the game (only the dev) I'm not sure he would like it done. But I do see your point about the achievments not being the most reliable. Is there a way to read data in a save file though instead?
There is no easy way to extract something from savefile, unless you have written that into savefile for easy retrieval. If you update game right now to start recording received endings (seriously, I am surprised that it is not done yet, this is, like, a staple of VNs from at least 90s), and only those who completed game before that update would be forced to replay the game, when you will eventually release update in the future.
< < insert Rick Cook quote here > >

User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Re: How to detect if a user has obtained a Steam achievement

#5 Post by thirstyoctopus »

I think the unlock option is not the best one in my case.

My save files have bespoke information in them so as long as the info in there matches the correct ending variables I could use that.

There is a variable that determines the character who's route you're on but it's not persistent. I didn't realise this story relied so heavily on the character the player chose - truth be told, I didn't write the VN I only coded it so didn't think I needed any specific persistent data. However, thank you for your help and I think I have some info to help me work something out

Post Reply

Who is online

Users browsing this forum: No registered users