r/gamedev•
jdsdev

Steam achievements in Java(libgdx). Step by step for dummies.

Concise and simple tutorial on how to implement Steam achievements in Java (libgdx). It can also be useful for other languages.

http://info.polinc.pl/2018/12/steam-achievements-in-javalibgdx-step.html

TL;DR

  1. Download files: steam_api.dll, steam_api64.dll and steam_appid.txt from this link: https://github.com/rlabrecque/Steamworks.NET/releases

  2. Download the dll libs and source code from this link:

https://github.com/code-disaster/steamworks4j

  1. Create a 'steam' folder and place the libraries there.

  2. Move this folder and txt file to the assets folder.

  3. Put the game app id in the txt file.

  4. Set achievements in the partner.steamgames.com panel.

  5. Load and initiate the libraries in the game.

  6. Set achievements in the game.

  7. Close the libraries.

  8. Copy the steam directory and txt file to the game directory.

Posted Dec 13, 2018, 7:41 AM UTC · edited

465
code-disaster•

Some notes from me (disclaimer: I'm the author of the steamworks4j library):

What we need - libs

I publish releases on Maven Central. If you don't use Maven or Gradle, there are direct downloads too. The JAR file contain all libraries required, including the redistributable DLLs. There's no need to pull files from a Steamworks.NET package, or to copy Java source code.

I noticed that without this file (steam_appid.txt) you can not run achievements even in the production version

The probable cause for this is how you launch your game. On startup, the Steam client "injects" into the game's process. If your executable just invokes "java -jar ..." and exits, there's nothing left to identify your application on Steam.init() - it's a new, pristine process, and needs to look for steam_appid.txt as a fallback.

Even if you correctly set the achievement during the test, it is possible that it will not appear immediately in the Steam Client application. I do not know what is causing the delay.

Call SteamUserStats.storeStats() after updating achievements or user stats.

12
feliser•

Yay thanks me love Java and libgdx

2
nwL_•

I can’t use this because it doesn’t apply to me, but I always appreciate people writing guides. Thank you.

1
MPnoir•

I think you also need the .so libs for it to work on Android, since it's Linux.

1
code-disaster•

There is no Android version of the Steamworks SDK. Recent versions of steamworks4j support Windows (32/64 bit), Linux (64 bit) and MacOS (64 bit).

1