Skip to content

How Do You Handle Supporting Both Steam and Epic Achievements?

I'm ready to create a build of a game I have on Steam for the Epic store.

Right now, I use Unity with Facepunch and authorize with Steam on startup, and achievements work great.

When building for Epic, I'll need to do the equivalent for that platform. I'd prefer to build my app in a way that is smart enough to connect to Steam for achievements if being launched as a Steam app, or connect to Epic if being launched as an Epic app.

The alternative would be to create different builds for each platform, which seems a little crazy.

How have you handled supporting both stores in your code? Are there any tools or techniques I should be aware of?

1 points3 comments
Open on Reddit
About this post
Posted
Archived
Score
1 · 25% up
Kind
Text
ID
18dw7mt

Author

24
posts
267
comments
1
media
View profile

3 comments

You write an API which interfaces to either depending on which sky is built for. Your game code uses that one API and different care or even know what is running on.

6 points

If you are using C# for example in Unity or Godot you would simply use conditional compiling via preprocessor directives. Basically, you turn parts of your code "on/off" based on which platform you are targeting.

So in the example below the rest of your code simply call SomeClass.Instance.UnlockAchievement(etc) with the correct enum value to unlock the achievements. It does not care whether you on Steam, EGS, Itchio, or whatever.

#if STEAM
using Steamworks;
#elif EGS
using EGSSomething;
#endif

public class SomeClass
{
#if STEAM
  public void UnlockAchievement(Achievement id) 
  { 
    // code related do doing it on Steam,
  }
#elif EGS
  public void UnlockAchievement(Achievement id) 
  { 
    // code related do doing it on EGS
  }
#else
  public void UnlockAchievement(Achievement id) 
  { 
    // do nothing, maybe on itchio with no achievements
  }
#endif
3 points

I once wrote a system to coordinate achievements for one game across iOS, Android and our own system.

It was so good at it, that QA had a hard time testing it because the moment an achievement was on one, it was already on the others. :D

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.