I’ve made a video that gets straight to the point if you don’t want to read all of that: https://youtu.be/4JSirvmjOb0
(Same tutorial but on reddit: Reddit - Dive into anything)
This tutorial doesn’t require any paid plugins, it only covers simple and INTEGER progressive achievements. It works in UE5 and recent UE4 versions.
If you want to add the achievements of your own game it must be accepted by steam and changes must be published. If it isn’t, you can still follow a part of this tutorial using steam’s test app “Spacewar” with its AppId being 480.
- Make sure to enable “Online” plugins in the Engine.
- Setup steam in Unreal Engine. Download the steam SDK and follow the steps (before “Using Sessions”) in the Unreal Online Subsystem Steam documentation.
Steam SDK: Steamworks
Online Subsystem steam: Online Subsystem Steam Interface in Unreal Engine | Unreal Engine 5.1 Documentation
You don’t need to do the steps after “Using Sessions” to use achievements.
Now Steam should be working on your game. To try it, launch your game as a standalone game and you should see the steam overlay when you press shift + tab. If it doesn’t work try to restart the editor
- We can now add achievements.
For every achievements you will need to add their API Names in “DefaultEngine.ini”.
To do so, go back to your “DefaultEngine.ini” and add a new line under [OnlineSubsystemSteam] for each achievements (simple or progressive).
On every line you will need to add:
Achievement_{INDEX}_Id={API_NAME}
You need to increment {INDEX} on each line and {API_NAME} is the steam API name of your achievement, the order shouldn’t matter. Do not add quotation marks around the API name.
This should look like this:
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=2217560
Achievement_0_Id=Level3
Achievement_1_Id=Level6
Achievement_2_Id=Level9
Achievement_3_Id=Level12
Achievement_4_Id=100%
Achievement_5_Id=Damage
Achievement_6_Id=Warming
If the editor was opened, you will need to restart it.
-
- Simple achievements.
Simply add these nodes to your BP when you want to give the achievement, Make sure to change the “Achievement Name” value to your achievement’s API name.
“Progress” is either -1, 0 or 1.
-1 will remove the achievement, 0 will do nothing and 1 will get the achievement.
-
- Progressive achievements.
In Steamworks, create a stat with its TYPE being “INT”. When you give it a name, repeat it and add “_” between the two names, for exemple, “DamageStat” would be:
DamageStat_DamageStat
Make sure to add the stat to your achievement’s progress stat in Steamworks.
An entry in steam’s leaderboard will be created for this stat. You will be able to access it in the “Leaderboards” tab in Steamworks.
There are multiple ways to load and set a stat value. Here’s how I suggest you do it:
- Get the stat’s value and set it in a custom integer variable when the game launches
- Update the variable to the target value in-game
- At the end of the game, write the value to the steam leaderboard
To do so, when the game launches, add these nodes to get the leaderboard value and set it to a custom variable. I did this in my game instance, after the “Event Init”. (Note that you might need to wait a little bit after the game launches to use these nodes, this is why I made a little timer that tries to call the node multiple times if it fails.)
When you write the API Name in unreal, don’t repeat it with “_”.
Then, in-game, you just need to change your custom value to whatever you want, I personally just increment it.
At the end of the game, I set the new value using these nodes:
- Packaging the game.
(This is explained in the Online Subsystem Steam documentation)
When you package your game you will need to add a .txt file to your build under:
{MAIN_FOLDER}\{GAME_NAME}\Binaries\Win64\
To do so, create a new text file called “steam_appid.txt” and inside it paste your app id and nothing else. This id is the number next to your game’s name in Steamworks.
- Enjoy
If you have any questions or find anything inaccurate or unclear please let me know!
Note that I am not sure if you need to add progressive achievements names to “DefaultEngine.ini” and if you need to enable every single Online plugins. You can also use other values than -1,0,1 in the “Progress” pin but it will just make the code less understandable and won’t give other possibilities. I am guessing the achievement order doesn’t matter in “DefaultEngine.ini” but I’m not 100% sure.
For some reason this subject was very dark and not up to date so thank you to everybody who shared about this and have allowed me to add achievements to my own game! I figured making this tutorial could help other people and save their time. I didn’t came up with anything, I just combined the information that seemed to be working.
Here are the links that helped me: