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
-
Download files: steam_api.dll, steam_api64.dll and steam_appid.txt from this link: https://github.com/rlabrecque/Steamworks.NET/releases
-
Download the dll libs and source code from this link:
https://github.com/code-disaster/steamworks4j
-
Create a 'steam' folder and place the libraries there.
-
Move this folder and txt file to the assets folder.
-
Put the game app id in the txt file.
-
Set achievements in the partner.steamgames.com panel.
-
Load and initiate the libraries in the game.
-
Set achievements in the game.
-
Close the libraries.
-
Copy the steam directory and txt file to the game directory.
Posted Dec 13, 2018, 7:41 AM UTC · edited
Some notes from me (disclaimer: I'm the author of the steamworks4j library):
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.
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.
Call SteamUserStats.storeStats() after updating achievements or user stats.