Steam achievements implementation for UE4 developers: tips and tricks.

Hello :slight_smile:

After spending noticable amount of time implementing Steam achievements in my own game made in Unreal Engine 4, I realized that the subject is not explaned quite well on the web. There are some online tutorials and documentation, yes, but everything I’ve found so far doesn’t provide some info critical for the achievements implementation. So I’ve decided to write down everything I’ve learned. Please note, that my game is 100% blueprint based and you will not find any useful C++ code here. Also please note, this is not a step-by-step tutorial, but rather an article with some tricky things explained.

Part I. Preparation.

Before start implementing Sream achievements in your UE4 game, be sure to read this official documentation, as it will help you to prepare your project for the achievements correctly: https://docs.unrealengine.com/latest…/Online/Steam/

One of the important parts of the above doc is explanation about DefaultEngine.ini file. But this explanation misses some critical things you should know about in order to make achievements in your game work. Below is the example of what Steam achievements part of the ini file should actually look like:

[/script/engine.gameengine]
+NetDriverDefinitions=(DefName=“GameNetDriver”,DriverClassName=“OnlineSubsystemSteam.SteamNetDriver”,DriverClassNameFallback=“OnlineSubsystemUtils.IpNetDriver”)

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=XXXXXX
Achievement_0_Id=“YYYYYY”
Achievement_1_Id=“YYYYYY”
Achievement_2_Id=“YYYYYY”
Achievement_3_Id=“YYYYYY”
Achievement_4_Id=“YYYYYY”
Achievement_5_Id=“YYYYYY”
Achievement_6_Id=“YYYYYY”
Achievement_7_Id=“YYYYYY”
Achievement_8_Id=“YYYYYY”
Achievement_9_Id=“YYYYYY”
Achievement_10_Id=“YYYYYY”

[/script/onlinesubsystemsteam.steamnetdriver]
NetConnectionClassName=“OnlineSubsystemSteam.SteamNetConnection”

In the example above XXXXXX - is ID of your game on Steam, and YYYYYY are unique IDs of Steam achievements - the ones you are going to use inside the game project, for example: ACH_STE_Kickass or something like that. Please note, that I believe the whole sript for Steam achievements should be removed from the ini file in case if you are assembling the game’s build for stores other than Steam.

Part 2. Triggers and local testing.

Once you’ve prepared everything in accordance to the things mentioned above, you need to implement achievement IDs and triggers inside your game, and test them using print screens that will show achievement IDs and their progress values. It’s better to fix all achivement issues on this stage - you’ll simply save a lot of time and get high quality results you need faster.

Part 3. Achievements on Steam side.

Now, that you’ve finalized your achievements locally, the time has come to set them up on Steam side. Before doing so please note, that in my experience it’s not enough just to set up the achievements themselves. No matter if they have long progress or just got unlocked instantly, you need to set up stats for all achievements, or they may not work properly. Achievements and stats setup on Steam is pretty easy, but have one tricky part worth mentioning. The point is in the API Name column value format in stats section. If you’ve created stat for, say, ACH_STE_Kickass achievement and named the stat Kickass, than you need to name it Kickass_Kickass in API Name column, BUT(!) still use just Kickass name in your game project, or the stat will simply not work.

Part 4. Final blueprinting.

Ok, now you’ve got everything set up on Steam and tested achievement triggers locally. It’s time to make the achievements work with Steam itself. You will need three nodes in your achievements blueprint for this: Write Leaderboard Integer, Cache Achievements, and Write Achievements Progress. There is nothing specific to say about Cache Achievements node, as it simply required for achievements to work. But the rest two nodes are not as simple as they look:

Write Achievements Progress in fact has nothing to do with achievement progress, it simply makes the achievement unlocked when progress value is more than zero. No matter what will your connect to or write into the Progress parameter - 0.1 or 1 or 100, it can only have two values - 0 and 1, so use this node only to unlock corresponding echievements, nothing else.

Write Leaderboard Integer always adds Stat Value to corresponding stat (which equals to zero by default) on Steam, not sets it. So be sure to avoid using pre-calculated values for Stat Value parameter, or achievements will be unlocked much faster than you expected.

Here is working example of the nodes’ usage from my game:

Part 5. Testing achievements on Steam.

Added achievements and stats have to be published on Steam, otherwise you will not be able to test them. Remeber, that once published, achievements will become visible to everyone. If your game is already released, but didn’t have any achievements before, creating announcement about achievements visible for testing purposes would be useful to avoid any misunderstanding.

There’re only two things worth mentioning left in this article. First - don’t forget that you will need Steam client running in order to test achievements in your game. Second - the online.ResetAchievements console command that you may use in game project or standalone game may not work at all. I’ve tried using it several times, and managed to reset the achievements just once. It’s possible that reset may occur with huge delay, I’m not sure. By the way, please note that achievements progress and unlocking may also have quite noticable delays.

I guess this is all I needed to share. Please, let me know if you have any advices about how to improve this article.

Regards,
Sergey Kalmanovich (aka Red Spot Sylphina).

11 Likes

Great tutorial easy and helpful, thanks :slight_smile:

You are welcome :slight_smile:

Hi, is there a way for Steam Stats in Blueprint?

Hello, and sorry for late reply :slight_smile:

As far as I know, Write Leaderboard Integer (mentioned in the tutorial above) is the only node that can affect Steam Stats.

Hello, Can you create a tutorial like this, but for the LeaderBoards?

Thank you for this @RedSpotSylphina

I am unable to get Steam achievement working however, the cache achievement always returns failure.

I had two questions:

  1. my steam achievement ID starts from 2/0 and so I’m wondering if I need to get the ini file to reflect this? I presume Achievement_0_Id won’t work for me since mine starts at 2/0?

  2. You mention stats - do I have to implement stats for achievements to work?

Thank you.

Hi , thanks , a few questions . 1. So some tutorials use the space wars names and put them in there in the default.ini. Are you saying I don’t need to put any of those names in there and I can put the letters you show above in there as placeholders , then reconfigure them in the steam developer page? 2. Does the blueprint nodes need to be in level blueprint? Or can a separate steam achievement blueprint be made? If in level blueprint , does the bp nodes need to be on the specific level bp for the game level that it will be achieved in?(example , with the space wars testing press 1 for achievement tutorial. ) , I put the nodes on the main menu level bp , did not work , but when I put them on level 1 level bp and played standalone on that level (1), it worked. What if an achievement was involving more than 1 level? Like “unlock level 5” for instance?3. Does all the acievement blueprint nodes need to be in the game logic before game is uploaded to steam build with SDK? Or can they be added after?4. If for example you have say 5 achievement ID;s in the default engine.ini , then should there be 5 sets of blueprint nodes in the game logic , 1 for each ID ? And say adding the name of each one in the “write achievements progress” node? 5. I assume that there needs to be other blueprint logic in front of the achievement nodes to reference what the achievement is. Like “unlock level” or “collect 5 balls” for instance. Thanks for any help

Hello!

Sorry for late reply.

Not sure what are you talking about in the first question. Regarding the second one - I had to implement stats in order to make achievements in my game work properly. I think only one-trigger achievemts would work without stats - “complete level”, “finish playthrough”, etc. But when you need an achievement with progress, like “kill X enemies”, you need stats for them as well.

Hi!

Sorry for late reply.

  1. YYYYYY placeholder is just an example. You need to put your real achievement name there.
  2. Ideally, level blueprint needs to be empty. The less you use it - the better. In my game all achievements code is located inside my protagonist’s character blueprint.
  3. Initially my game didn’t have any achievements or placeholders for them, I added them later with one of updates.
  4. I used separate nodes chains for each achievement. Maybe there is a way to make the system more compact, but I didn’t try to think about it.
  5. Well, this is quite simple. You need to track achievement’s completion, and when triggered - pass corresponding values to Steam.

Nice tutorial thanks!

2 Likes

Great tutorial, helped me figure out achievements :slight_smile:

Quick addition, as mentioned in one of the responses on here: Reset Steam achievements - Platform & Builds - Unreal Engine Forums
online.ResetAchievements works if you first call ‘CacheAchievements’ blueprint node.
When I tested it in standalone mode I did have to shut down the play session after that, and the next time my achievements would have been reset.

Hope that helps for others to!

You are welcome! :slight_smile:

Thanks for the info! :slight_smile:

Everything works except my stats are not increasing, they only set the initial 1 and never add to it. Setting the input there as a tracked number doesn’t change that either. Should I be running some function call before that to refresh it?

The SteamCore:: plugin has support for Steam Stats to use in Blueprints
Marketplace: [https://www.unrealengine.com/marketp...ad23bdeb9b2196

](SteamCore in Code Plugins - UE Marketplace)

Major thumbs up, thanks a whole lot!

1 Like

for me im using STEAMCORE in the unreal engine market place it have all the code in blueprint for steam API

When I test in the viewport to make sure my achievements are working, I can trigger them, but only once per editor session. What’s that about? How can I reset them so they trigger every time (so I can repeatedly ensure they’re still working)?

Edit: Also, after packaging–is there any way to see the Steam overlay or test achievements? I try my packaged build and can’t access Steam through it. Is overlay/achievement testing available exclusively in the editor and, eventually, once the game is properly uploaded to Steam?

I know this is a very old thread at this point, but for those wondering why you need to double the stat name in steam, its because the WriteLeaderboardInt function puts the stat name as the leaderboard name
So internally, the write operation tries to make the addressable name by doing Printf(TEXT(%s_%S) *LeaderboardName, *StatName)
so since the node passes the stat name to BOTH it puts every stat on its own board named StatName and every Stat on that board needs to be StatName_StatName

1 Like