Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Achievements for Ren'Py

In-depth ingame achievement support for Ren'Py that plugs into the Steam backend. · By Feniks

Need Support? Post here! Sticky

A topic by Feniks created Sep 14, 2023 Views: 166 Replies: 14
Viewing posts 1 to 7
Developer

If you're having trouble or run into any bugs with the code, post a comment here! I will try to get back to you within a few days.

Hey, bro. How do you set up a steam connection? 

Developer(+2)

Hello! In Steamworks, you can go to Technical Tools > Edit Steamworks Settings > Stats & Achievements > Achievements and add a new achievement. The first column, called API Name, is the ID for the achievement. This should be the same ID as you set when you make your Achievement objects in-game using the system. You can then add the locked/unlocked images in Steamworks as per usual. The only important thing is that the achievement has the same ID as the in-game one! Aside from that, the backend of registering and granting the achievement for Steam is all taken care of via the system. Hope that helps!

Thanks for the quick response! I added an achievement with the same ID as in your Example 1 to Steamworks. I also added a steam_appid.txt file with the game id near the .exe file. The in-game achievement works (using $ sample_achievement.grant() ), but it is not granted at Steam. I run the game through Steam and the overlay (Shift+tab) works.

 

Developer(+1)

Did you install the Steam support from the Ren'Py launcher? That's required for any Steam integration. Remember also that you'll have to go through Steam to clear any achievements if you'd like to re-see the popup, as the clear method only clears it on Ren'Py's end. You can install the Steam support via the launcher Preferences -> Install Libraries -> Install Steam Support. The overlay isn't related to whether Steam support is installed or not, just if you're playing it through Steam. Let me know if that fixes it for you!

It's all working now! Thank you!

Hey, this is probably a stupid question, but in what script do you need to write the first code?

Developer

If I understood your question - you can declare the achievements in whichever rpy file in your project you like. The included achievements.rpy file has several example achievements, so it probably makes sense to declare your own achievements there. Be sure to read the included README for more instructions on what details you can provide to each achievement as well! You might consider reading https://feniksdev.com/organizing-a-renpy-project/ if you're new to Ren'Py project organization in general.

Deleted 57 days ago
Developer

Sure thing! You can remove the achievement gallery screen or just not use it anywhere. The popups will work just fine. 

Same thing goes in reverse, too - you can use the config options at the top of the file to remove popups and just use the gallery if you like.  

Deleted 57 days ago
Developer

So if I understood, you just want a notification screen? You certainly don't need to go through the achievement system for that; just make yourself a screen and show it with your desired notification. You can copy the general format of the achievement popup screen and methods for that, but I'm afraid that would be out of the scope of things I can help with for this system.

(1 edit)

Hi, I was having difficulties accessing the achievement screen on my main menu so I looked around and found that deleting the second datetime (line 131 and 148) in the achievements backend solved it. I do not know if it's a bug on my end or my game but thought I'd let you know! Fanatastic asset, very excited to customise it!

Developer

The current achievement code is correct! But sometimes other people import the datetime module separately, which could cause this conflict. It usually looks like from datetime import datetime instead of just import datetime. I would check your project for other places where the datetime module is used to see what's causing that. If you've imported datetime differently, then your fix will work.

Glad you like the system! I hope you find it useful :)

Hello! Thank you very much for the great feature!

As I was testing out the achievement pop-ups I saw that the name of the achievements and descriptions were not showing up, then I realized I set gui.text_color in gui.rpy to black, is there a way to make the achievement text not rely on the same gui type as that of dialogue? Or is there a way to change the color of the popup box to white?

I sincerely apologize for any inconvenience :c

Developer(+1)

Sure! You can change the text colour of any of the screens however you like by adjusting the styles; all of the existing styling is meant to be changed to suit your project. I suggest you hover over the text in question and hit shift+i to find which styles are affecting it, or you can find the lines in achievements.rpy and just add color "#fff" or similar to whichever line of text you need. For example, you can change the line text a.description size 25 to text a.description size 25 color "#fff" to make the text white. Hope that helps!

I figured it out! Thank you very much!