Release a libGDX based game on steam
Hey everyone,
with Timbertales I got greenlight in the beginning of the year. Unfortunately I was working on FlatFatCat the last weeks so I had to delay the release of Timbertales on Steam. This week I was able to finally start the implementation and would like to share my experience with a libGDX based game.
Steamworks
First of all you need to register on steamworks and your game need to be greenlit (for old games). The new system is steam direct with a fixed fee (but I haven’t made any experience there yet). As I said Timbertales was already greenlit so I just had to register an account on the steamworks page. After that is done you need to fill out a lot of stuff about yourself and your company for taxes and so on. As a foreign developer from Germany it was quite easy for me to go through all this stuff and in the end I just needed to send a passport copy to steam. Everything was processed very fast and I was able to fill out the informations about my game. There are actually two different game sections and I will give a short overview over both: Your shop entry and your game build.
Shop entry
The shop entry is quite easy you need to describe your game and upload a lot of different pictures for the store. I always have the problem, that I don’t know which pictures will be shown where. So looked through the store pages and inspect the pictures of others to make a matching. After that was done it was quite easy to provide all the needed assets. For Timbertales we had a lot of assets we could use, so there was no need to design anything from scratch. Then you can just click through the different sections and fill out all informations. The required informations are quite usual such as trailers, reviews, system requirements and so on.
Game build
The game build was bit more challenging, since I had absolutely no idea how the steam upload would work. Anyhow the documentation on the steam site is quite good and there is a lot of tutorials in the internet for uploading a game to steam. So I will focus now a bit more on the libGDX part of coding, which was actual needed.
So the requirements for me were quite simple: I just needed the steam Id of the user for my game. At the moment I did not use any other features provided by the steam api such as achievements or notifications. Since I just wanted to have the SteamId of the user the implementation was very easy:
- First I created a new module in my project with the name steam. Essentially it is the same module as the desktop module from libGDX
- Then I added the Steam related framework as a dependency to that module. You can find it here: Steamworks4j
- Everything you have to do now is calling
try {
somewhere to start the steam api
if (!SteamAPI.init()) {
// Steamworks initialization error, e.g. Steam client not running
}
} catch (SteamException e) {
// Error extracting or loading native libraries
} - For local testing purposes I needed to add my appId, which could be found on the steamworks page, in a textfile called steam_appid.txt in my assets folder
- The next step for me was to query the steamId from the api with that code:
try {
now I am able to get the steamId with
steamUser = new SteamUser(new SteamUserCallback() {
@Override
public void onValidateAuthTicket(SteamID steamID, SteamAuth.AuthSessionResponse authSessionResponse, SteamID ownerSteamID) {}
@Override
public void onMicroTxnAuthorization(int appID, long orderID, boolean authorized) {}
});
} catch (RuntimeException e) {
// steam is not running
}String.valueOf(steamUser.getSteamID().getAccountID())
That was everything code related I needed for my game. As I said very, very basic and simple, if you would like to add more features like achievements or notifications it isn’t very hard either. You will just need to add the api calls, most of them are implemented within steamworks4j.
Making executables and upload your game to steam
Finally we can create our executables and upload them to steam. For creating executables I like to use packr. What you need to do is easy just create a jar file of your game. I normally use gradle for this task so on the commandline in my project folder I just type:
./gradlew steam:dist
“steam” is my module name, so if you would like to create a jar of your desktop module just run ./gradlew desktop:dist. If the building is finished you can find the jar file in your modulefolder/build/libs. Now we can use packr to build our executable for the different platforms (osx, linux, win). I used the win32 and linux32 platforms, because they also work on the 64bit architecture normally. To generate the executable with packr just run the following
java -jar packr.jar --platform linux32 --jdk https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u80-unofficial-linux-i586-image.zip --executable NameOfExecutable --classpath Generated.jar --mainclass YourMainClass --vmargs Xmx1G --minimizejre soft --output OutputDir
Basically you call the packr.jar with your desired platform. You can read through the packr readme for all options. You can find the jdks you will need here. After that is done and you have your different executables for all your supported platforms you can follow the official documentation or this guide to upload your game to steam.
Hope this helps you. For me it was much easier than expected. I had a lot of respect for implementing steam, but in the end with Steamworks4j it is super easy!
Recent Comments