Steam achievements bug
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.
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.
- dragondatingsim
- Regular
- Posts: 115
- Joined: Sat Feb 14, 2015 10:22 am
- Tumblr: angelswithscalywings
- Contact:
Steam achievements bug
Apparently, there is a bug in our game that triggers a ton of steam achievements to be unlocked when someone quits the game from the menu. However, there is nothing in the code that suggests how/why this would happen.
We use our own in-game achievement system that works properly. It's just that Steam achievements apparently get activated when they shouldn't. The lines of code that activate steam achievements are only with lines that also activate the same achievements in our own in-game system.
Actually playing to a part that gets an achievement works properly - the achievement is unlocked on Steam and our own in-game system, but quitting the game apparently sometimes triggers a lot of steam achievements to be unlocked at once (15-30).
Anyone have any idea why this could be happening?
We use our own in-game achievement system that works properly. It's just that Steam achievements apparently get activated when they shouldn't. The lines of code that activate steam achievements are only with lines that also activate the same achievements in our own in-game system.
Actually playing to a part that gets an achievement works properly - the achievement is unlocked on Steam and our own in-game system, but quitting the game apparently sometimes triggers a lot of steam achievements to be unlocked at once (15-30).
Anyone have any idea why this could be happening?
- PyTom
- Ren'Py Creator
- Posts: 16097
- 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: Steam achievements bug
Can you post your code? The Ren'Py achievement's code is very simple (check common/00achevements.rpy), so this is more likely to be a bug in your code than in Ren'Py's support.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
- dragondatingsim
- Regular
- Posts: 115
- Joined: Sat Feb 14, 2015 10:22 am
- Tumblr: angelswithscalywings
- Contact:
Re: Steam achievements bug
Here is an example for granting an achievement:
I think the most likely culprit is our in-game achievements screen.
It's supposed to synchronize achievements between our system and Steam, so once displayed, it checks for achievements achieved in our in-game sysstem and grants them on Steam:
However, triggering this screen isn't causing the achievements to appear on Steam, and the number of achievements granted this way is also inconsistent with the screen itself and apparently different every time it happens.
These two are the only instances achievement.grant is used. And why of all things, quitting the game would trigger achievements on Steam is beyond me.
Code: Select all
if persistent.c1blood == False:
$ persistent.c1blood = True
$ achievement.grant("Blood Donation")
$ persistent.achievements += 1
play sound "fx/system.wav"
It's supposed to synchronize achievements between our system and Steam, so once displayed, it checks for achievements achieved in our in-game sysstem and grants them on Steam:
Code: Select all
hbox:
spacing 5
if persistent.c1blood == True:
add "achievements/blood_donation.png" xalign 0.5
$ achievement.grant("Blood Donation")
These two are the only instances achievement.grant is used. And why of all things, quitting the game would trigger achievements on Steam is beyond me.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3809
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Steam achievements bug
The problem, as I see it, is that your persistent has no default. It is neither true, nor false.
Upon it being made false, you make it true. Why?
I assume you are checking the achievement has not already been earned?
I suggest changing that so the order is reversed.
Define a default state for achievement earned status at the start of the game.
Check if earned is true. Upon condition met: grant achievement if earned is false, thus, earned becomes true, otherwise does nothing.
To avoid reloading the game, or a new game erasing the true status, add a clause that checks if earned == true before tou define it as default.
Upon it being made false, you make it true. Why?
I assume you are checking the achievement has not already been earned?
I suggest changing that so the order is reversed.
Define a default state for achievement earned status at the start of the game.
Check if earned is true. Upon condition met: grant achievement if earned is false, thus, earned becomes true, otherwise does nothing.
To avoid reloading the game, or a new game erasing the true status, add a clause that checks if earned == true before tou define it as default.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- dragondatingsim
- Regular
- Posts: 115
- Joined: Sat Feb 14, 2015 10:22 am
- Tumblr: angelswithscalywings
- Contact:
Re: Steam achievements bug
They are defined as false by default elsewhere. Keep in mind - our own in-game achievement system (with the persistents) works perfectly fine. It's just that we're getting 10-30 Steam achievement grants just from returning to the main menu from the game for some reason.Imperf3kt wrote:The problem, as I see it, is that your persistent has no default. It is neither true, nor false.
Upon it being made false, you make it true. Why?
I assume you are checking the achievement has not already been earned?
I suggest changing that so the order is reversed.
Define a default state for achievement earned status at the start of the game.
Check if earned is true. Upon condition met: grant achievement if earned is false, thus, earned becomes true, otherwise does nothing.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3809
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Steam achievements bug
Then it sounds like your default is overwriting the persistent true state. Maybe?
Try adding an if conditional to the default so it only becomes false if it isn't already true.
Maybe
Try adding an if conditional to the default so it only becomes false if it isn't already true.
Maybe
Code: Select all
if not persistent.c1blood:
$ persistent.c1blood = False
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- PyTom
- Ren'Py Creator
- Posts: 16097
- 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: Steam achievements bug
Also, you're not allowed to put code with side-effects - like granting an achievement - in a screen. Code in a screen may be run multiple times during image prediction, even if it's in something like an if statement. So that could be what's causing the spurious activations.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
- dragondatingsim
- Regular
- Posts: 115
- Joined: Sat Feb 14, 2015 10:22 am
- Tumblr: angelswithscalywings
- Contact:
Re: Steam achievements bug
That would explain it.PyTom wrote:Also, you're not allowed to put code with side-effects - like granting an achievement - in a screen. Code in a screen may be run multiple times during image prediction, even if it's in something like an if statement. So that could be what's causing the spurious activations.
We'll try something different, then. Thanks!
Who is online
Users browsing this forum: Ocelot