Releasing the Hinterlands on Steam (LibGDX Java game)

We got approved for Steam Greenlight in March 2016, which was a little bit of a surprise, since we originally applied in Dec 2014. The game has had 23% ‘Yes’ votes, and 77% no votes. But there weren’t a lot of other 2d games being approved for steam green light at the time, most greenlit games being either ones with anime style graphics, or 3d games with stock assets (Grass simulator was approved very quickly).

So we had just figured the Steam Greenlight community was more fond of either fully complete 2d games, or partially complete 3d games.

(You can see the final store page for the game at: http://store.steampowered.com/app/454260)

Preparing LibGDX for release on steam

Adding an icon for windows
You’ll probably want an icon for your game while running in windows. To add this, in your Main.class for desktop, you’ll have to add the icon in your ‘LwjglApplicationConfiguration’:

LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.addIcon(“resources_pc/icon_32x32_windows.png”,FileType.Internal);
(replacing the first string with the path to your icon)

Making your game run windowed and borderless instead of full screen
To make your game run windowed, borderless, but look full screen, under the above:
System.setProperty(“org.lwjgl.opengl.Window.undecorated”, “true”);
cfg.width = (int) (LwjglApplicationConfiguration.getDesktopDisplayMode().width);
cfg.height = LwjglApplicationConfiguration.getDesktopDisplayMode().height;

Exporting a runnable jar from eclipse
I had been exporting out PC builds of the game for people to try out for some time, and LibGDX has a decent article about how to do it using eclipse: https://github.com/libgdx/libgdx/wiki/Deploying-your-application. Basically right click on your PC project, go to export, export as a runnable jar, extract or package libraries into the jar.

You’ll now have a runnable jar of your game, but you’ll need to copy all of the assets from your project into the same folder to be able to run it. You can start it from the console to see any debugging info (in case you’re not sure what asset you’re missing) by going to the command line, going to the folder that your .jar file is in, and running it using ‘java -jar thenameofyourjar.jar’. You’ll have to make sure the have your PATH variable setup in windows to java if it is not already (http://stackoverflow.com/questions/1672281/environment-variables-for-java-installation).

So if everything is working properly, you should be able to double click your jar to run it, or run it from the command line like above (to see any debugging output).

Changing your runnable jar to an exe – Picking a tool
There are two tools I’ve found for packing your jar as an exe.
* Launch4j http://launch4j.sourceforge.net/
* packr https://github.com/libgdx/packr

Packr sounds like it would be a lot better, is a tool actually made by the LibGDX guys, and recommended through their wiki. It allows you to also package your jar up for Mac and linux. It also offers the option to slim down a copy of the JRE with your game.

But, some of the negatives compared to launch4j:
* It doesn’t allow you to also have an icon on your exe automatically (and no information on how to do it manually)
* It doesn’t actually wrap your jar file- it creates a small exe and includes your .jar file
* It seems to clear out your destination folder, so if you wanted to copy your assets over manually the first time, it removes them (but has an option to copy over your assets every time)

So I ended going with launch4j (although both generated runnable executables) because of it looking more professional- an exe with an icon. The GUI also gives you feedback if you’re missing something, whereas packr does not. After you output with packr, you can get feedback to figure out what went wrong by running your executable from the command like such as:
TheHinterLands.exe -c –console

Steam submission- including the JRE
The first time I submitted to steam using Launch4j, I got a message back saying that it required an extra library (Java- the JRE), and it needed to have an installer packaged with it, or have the library included. Launch4j will automatically redirect someone launching your app to the Java download site, but it doesn’t look professional, and an end user might not know what version or the JRE they need (x64, x86, ect).

But both packr and Launch4J allow you to specify the location of a bundled JRE. On the packr site, there are actual instructions on what you need to do, whereas the Launchj site had no information, and the best answer on stack overflow was to just include your jre folder from your program files directory!

So packr actually directs you where to download JRE’s you can redistribute with your game, with zip files of the openJDK: https://github.com/alexkasko/openjdk-unofficial-builds.
The page says that project is discontinued, and links to the newer OpenJDK 8 bundles, but only the OpenJDK 7 bundles worked for me.

If you want to support both 32bit and 64 bit operating systems, you can just include the 32bit JRE, and it allows it to run on both systems (the i585= 32bit openjdk-1.7.0-u80-unofficial-windows-i586-image.zip).

Download that, and all you need is the jre folder from the zip that you include with your game.

Now you should have everything to make the game redistributable on Steam.

(Optional) Testing using the bundled JRE
If you’re curious whether the jre folder you included actually works or not, you can manually use it to try to run your jar. Put your jar in the folder with your assets and the jre, and create a new batch file called ‘testing.bat’.
Add the following lines:
jre\bin\java.exe -jar TheHinterLands.jar
pause

Save, and double click the bat file to test it. It should use the java file relative to your batch file to try to run your jar, and will pause after closing, so that you can see any errors/ console output for anything that might have gone wrong.

Required launch4j settings

On the first/’basic’ tab, you need to fill in ‘Output file’, ‘Jar’, and you can add your ‘icon’.
After that you just need to fill in the ‘JRE’ tab with the ‘Bundled JRE path’ as just ‘jre’ (folder relative to your exe), min JRE version 1.7.0, max I just did as 9.0.0 (so that it can work for some time).

To convert your .jar into the exe, you have to click the gear shaped icon, not the play, highlighted button. Once you do that, you should have your exe in the folder you specified.
If all your assets are in there, you should be able to just run your exe, and start up your game.

Uploading To Steam

You’ll find the same write up in the steamworks developer area, but I had a little bit of trouble getting it working. (Follow that documentation for getting your builds/ depots ready on the developer console end)

The videos from the developer area were helpful, but didn’t all work for me, and seemed outdated with the interface (which this might be by the time you read it, but as of right now, builds/depots are under app admin-> the steampipe tab)

First you’ll want to download the sdk, and unzip it to a location you’ll be uploading to Steam from.

Then browse to sdk/tools/ContentBuilder/content and make a new folder named ‘windows_content’, and copy all of your game files you plan to upload to steam there (your exe, your assets, everything needed to run the game). You can run it again from here if you want to check to make sure everything still runs fine.

Then you’ll have to update the included sample scripts under: ‘sdk/tools/ContentBuilder/scripts’, an app build and depot build.

Make sure to grab what you app id and depot id for your game are from the Steamworks interface (2 different 6 character numbers, my depot number was one more than my app number. Example: app_id=900120, depot number = 900121). The SteamWorks tutorials recommend renaming both files with your app and depot numbers instead of the default ones values, so you might as well do that as well.

Open up the app_build file in a text editor, change out your app_id, and your depots values and save. Example:
“appbuild”
{
“appid” “900120”
“desc” “Your build description here” // description for this build
“buildoutput” “..\output\” // build output folder for .log, .csm & .csd files, relative to location of this file
“contentroot” “..\content\” // root content folder, relative to location of this file
“setlive” “” // branch to set live after successful build, non if empty
“preview” “0” // to enable preview builds
“local” “” // set to flie path of local content server

“depots”
{
“900121” “depot_build_900121.vdf”
}
}

Save and open up your depot file. Change your ‘DepotID’, comment out ‘ContentRoot’, change ‘LocalPath’ to:
“LocalPath” “.\windows_content\*” (don’t forget the star, or it doesn’t grab anything).
So an example would be:

“DepotBuildConfig”
{
// Set your assigned depot ID here
“DepotID” “900121”

// Set a root for all content.
// All relative paths specified below (LocalPath in FileMapping entries, and FileExclusion paths)
// will be resolved relative to this root.
// If you don’t define ContentRoot, then it will be assumed to be
// the location of this script file, which probably isn’t what you want
//”ContentRoot” “..\thiswilloverridetheoneinappsettings\”

// include all files recursivley
“FileMapping”
{
// This can be a full path, or a path relative to ContentRoot
“LocalPath” “.\windows_content\*”

// This is a path relative to the install folder of your game
“DepotPath” “.”

// If LocalPath contains wildcards, setting this means that all
// matching files within subdirectories of LocalPath will also
// be included.
“recursive” “1”
}

// but exclude all symbol files
// This can be a full path, or a path relative to ContentRoot
“FileExclusion” “*.pdb”
}

Save, and you can finally work on the final step. Edit in your text editor ‘run_build.bat’ in the folder ‘sdk/tools/ContentBuilder/’. Change out the login with your Steam name and password, and the app_build with whatever yours is named. Example:
builder\steamcmd.exe +login steam_account_name password +run_app_build_http ..\scripts\app_build_900121.vdf +quit

Finally click on the bat file to run it, and it should upload the content for your game to steam! It takes quite awhile (maybe 10 minutes for about 100mbs- might setup stuff on their end for the first run).

Once it finishes, you should be able to see your content in steamworks under App->App Admin->SteamPipe tab->builds. Click on the drop down next to your most recent depot, and click default to make it the default build. You can also download your files (to make sure everything was uploaded correctly) by clicking on the highlighted depot number next to the drop down, and downloading your files as a zip.

If everything works, all you need to do is finish the checklist on your app page (by clicking on your app, and looking on the right hand side for the checklists ‘Your Store Presence’ and ‘Your Game Build’.

The HinterLands PC Version ready for download!

The Free PC version is ready for download. Let me know when you want to see the paid!

Waiting for approval through Amazon for their PC app store.

Steam Greenlight isn’t looking positive – only about 25% “yes” votes, no one is apparently interested in further development on the game on PC 🙁

feature_705x344

Download it here

Description in case you don’t know:

The HinterLands is a multiplayer 2d mining sandbox game, and was released early in alpha to encourage people to contribute to development.
It has grown a ton, and keeps growing thanks to player feedback! Contribute ideas and feedback, and help shape the future of the game.
Mine the world for resources, build great structures, harvest plants, trees and mobs, all with friends or random players!

•• Multiplayer Modes ••
• Play multiplayer over wifi/LAN (with mobile devices or desktops)
• Join a PC server and play with tons of people (both on desktop and mobile devices)
• PvP recently added- fight against friends or random players!

•• Features ••
• Fight mobs with fast combo attacks, or slow strong attacks, blocking, or turn off hostile mobs, go into creative mode, it’s all your choice!
• Build structures using tons of blocks and items!
• Farm mobs for resources, or destroy them for food to regain health, and stop hunger
• Harvest trees and plants for food, potions, or seeds to replant and grow your own forests

•• Features Coming Soon ••
• Redesigned UI: easier inventory system, more advanced item, armor and weapon crafting system, equippable armor and clothes, and quests
• Bosses, more mobs, and more biomes

•• Planned features ••
• Player vs. Player: Free for all, capture the flag, team oriented with different classes, tower defense with creeps and towers
• NPC’s: Characters to give you quests, buy and trade items
• Pets: Animals to join you on quests and in combat
• Level editor: Submit levels for public servers!
• Character leveling and skills: customize your character for your playstyle. Create a invincible tank, a stealthy rogue, or a powerful mage
• Farming: Domesticate mobs, take care of them in your barn and breed them! Grow crops for creating potions, money or aid in exploring
• UI system for advanced custom crafting of weapons, armor and vehicles. Quality based on character crafting skill, with adding gems and enhancements
• Polygon based worlds. Mini planets, solar systems, and space travel

•• Instructions ••
• Customize and create your player and world
• Play single player, wifi game, or join a public server
• Mine dirt, stone, ect with the pickaxe. Chop trees and items with the axe. Use the hammer to break down backgrounds or items
• Keys: W(move left), A or Space(jump/ double jump), S(move down, duck, go prone, or slide), D(move right), and Shift to walk. Click to mine, place or attack.
• Use the fast attack button to combo attacks on mobs(Left Click). Use the strong attack for higher damage(Right Click). Use the shield to become invincible(Middle mouse button or ‘E’)
• Mouse scroll to zoom in / out of the world; open your inventory and scroll to increase / decrease button size. Move items by holding them down for 1s, or split stacks by holding down longer
• Build amazing structures, upgrade your tools, and share on our facebook page! http://goo.gl/vsclYF
• More instructions on the wiki: http://goo.gl/UZcn2N

•• Bugs ••
• World format: needs to be changed, to optimize network, allow boss areas/ scripting, and allow more biomes+bigger worlds
• Lighting system was too slow, so has been cut down and needs to be redone
• Multiplayer movement needs to be changed to look smoother

The game is still in alpha, because there is so much still that we want to add.
There are only 2 of us working on it, but we appreciate everyone who plays the game, helps contribute by finding bugs, adding ideas, suggestions and feedback

Join the forums: http://goo.gl/Zxe3hb
Please leave feedback, have friends play with you, and be a part of helping an indie game grow! Let us know what you want added first!

•• Free Version vs Paid ••
We want to have everyone be able to play the game, both to try it out, and for people who can’t invest in its development yet. The Paid version has a much bigger inventory (80 vs. 20), and each character also starts with a “Backers Reward”, which allows you to teleport to and from your spawn point. We hope you help fund development, but understand if you can’t.