An interesting bug where the title screen game gives the player all Steam achievements

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
Aureus
Veteran
Posts: 278
Joined: Sun Aug 06, 2017 4:49 am
Completed: The Tavern, Tales From Windy Meadow
Projects: Roadwarden
Organization: Moral Anxiety Studio
itch: moral-anxiety
Location: Breslau, Poland
Contact:

An interesting bug where the title screen game gives the player all Steam achievements

#1 Post by Aureus »

Hi there! This bug puzzles me extremely.
In my game, achievements are not received in the script, but rather through a screen that examines if conditions to receive an achievement are met. So, for example,

Code: Select all

    if achievement_01 and not achievement.has("achievement_prologue"):
        $achievement.grant("achievement_prologue")
        $achievement.register("achievement_prologue")
        $achievement.sync()
For some reasons, the title screen tends to give some players all of the possible achievements for no clear reason. A few people got it just by starting the game. One claims they got the achievements after they left the title screen open for 15 minutes.

The most common occurrence was when the game ended with the "return". But not if the player skipped through the transitioning fade out - only if they allowed the game to display the entirety of the transition. It stopped happening once I built another, hand-made transition and ended the game with $ MainMenu(confirm=False)() .

Can you think of a way how I could stop this from happening?
Tales From Windy Meadow - slice of life, pixel art Visual Novel set in a fantasy village. now available on Steam.

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: An interesting bug where the title screen game gives the player all Steam achievements

#2 Post by enaielei »

Code: Select all

screen test():
    if achievement_01 and not achievement.has("achievement_prologue"):
        $achievement.grant("achievement_prologue")
        $achievement.register("achievement_prologue")
        $achievement.sync()
NEVER do this.
If you want to set something through screen, esp. if it involves a global variable use actions.

Code: Select all

screen test():
  textbutton "Unlock" action [Function(achievement.grant, "achievement_prologue"), Function(achievement.sync)]
And looking at the documentation for Achievements, it looks like achievement.register should be run only once, probably inside init python.

User avatar
Aureus
Veteran
Posts: 278
Joined: Sun Aug 06, 2017 4:49 am
Completed: The Tavern, Tales From Windy Meadow
Projects: Roadwarden
Organization: Moral Anxiety Studio
itch: moral-anxiety
Location: Breslau, Poland
Contact:

Re: An interesting bug where the title screen game gives the player all Steam achievements

#3 Post by Aureus »

: O
Something more in this direction?

Code: Select all

    if achievement_01 and not achievement.has("achievement_prologue"):
        timer 1.0 repeat False action [Function(achievement.grant, "achievement_prologue"), Function(achievement.register, "achievement_prologue"), Function(achievement.sync)]
I tried to omit achievement.register before and it looked like I was getting an achievement, but Steam didn't announce it on its page.
Tales From Windy Meadow - slice of life, pixel art Visual Novel set in a fantasy village. now available on Steam.

User avatar
Aureus
Veteran
Posts: 278
Joined: Sun Aug 06, 2017 4:49 am
Completed: The Tavern, Tales From Windy Meadow
Projects: Roadwarden
Organization: Moral Anxiety Studio
itch: moral-anxiety
Location: Breslau, Poland
Contact:

Re: An interesting bug where the title screen game gives the player all Steam achievements

#4 Post by Aureus »

It seems to be working - the game didn't achievements after ending from "return", so I assume it's fixed now.
I would love an explanation what my mistake was.
Tales From Windy Meadow - slice of life, pixel art Visual Novel set in a fantasy village. now available on Steam.

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

Re: An interesting bug where the title screen game gives the player all Steam achievements

#5 Post by Ocelot »

Screen code an be run any time with any parameters during predictions. Code itself is always executed, this is why button actions and other similar things are stored in special classes. In your case RenPy decided to run your screen with achievement_01 set to True to check, if it would need to load any additional images. The solution is to either delegate actual code to actions, or to on "show" event.
< < insert Rick Cook quote here > >

User avatar
Aureus
Veteran
Posts: 278
Joined: Sun Aug 06, 2017 4:49 am
Completed: The Tavern, Tales From Windy Meadow
Projects: Roadwarden
Organization: Moral Anxiety Studio
itch: moral-anxiety
Location: Breslau, Poland
Contact:

Re: An interesting bug where the title screen game gives the player all Steam achievements

#6 Post by Aureus »

That makes a lot of sense and will help me avoid it in the future. Thank you!
Tales From Windy Meadow - slice of life, pixel art Visual Novel set in a fantasy village. now available on Steam.

Post Reply

Who is online

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