r/javahelp • u/hugeowl • Dec 08 '15
Unsolved Game developer here: Anyone set up a java game in Steam app admin?
Hello Community,
I'm not sure if this is correct subreddit, hope I don't break any rules.. I'm working on a Java game which was Greenlit on Steam a few months ago and Im very close to releasing it (~2 weeks). I'm having troubles with setting up the launch configuration for my game in Steam and while I've set up the config for windows easily (since I use windows myself), I have problems with Mac and Linux.
On windows the Steam can runs the game properly if I define the exectuable as 'Game.jar' or a .bat file which runs 'java -jar Game.jar'. I've got testers which have Linux and Mac, but they cannot help me with providing a proper solution for their OS and I don't want to bug them for an hour each and ask "this works? and now? how about that?". So the question is, if anyone has experience with this, what kind of script could I upload to run the .jar for Mac and Linux, or how could I configure Steam to launch the jar properly? I googled a bit but I've learned that it's not that straightforward with running scripts on Mac and Linux as it is with Windows .bat.
2
u/koalillo Dec 09 '15
You are releasing something for platforms you cannot test directly on? Get a Linux VM and buy a Mac Mini (if they are still selling those).
1
u/hugeowl Dec 09 '15 edited Dec 09 '15
Well it is Java (with Slick2d) and I had people play it on Mac and Linux and the game worked fine, it is just the Steam set up that it's giving me problems.
There is one reason which might force me to set up VM and it is playing cutscenes which I've added recently as apparently there are some lag issues on Linux, but the gameplay itself did not have a single found problem related to specific OS after a few hours of testers testing.1
u/koalillo Dec 09 '15
Well, if you are coding Java it is not unusual for packaging to be one of the most difficult problems you face- add to that Steam which might have its own quirks and that does not surprise me at all.
Really, in order to troubleshoot the packaging problems you will have a much easier time if you can use the target environment- you don't even need a beefy environment- a VM will do to detect Steam launching issues.
My uninformed thoughts is that it might be a good idea to research for a cross-platform installation solution which bundles a JVM- I think Oracle included something in the latest versions of the JDK (see http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm ), although I'm not sure it won't interact badly with the steam thingie. I believe most options are commercial but perhaps some have reasonable pricing.
In some thread in the libgdx forums ( http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=18851 ) they recommend https://github.com/libgdx/packr which looks good (and appliable to non-libgdx).
1
u/hugeowl Dec 09 '15
Yes, it is much more difficult than I expected, it is a first finished JAVA product of mine, and it really shows how much I lack in knowledge in that area.
1
u/shadowfactsdev Extreme Brewer Dec 08 '15
You'll need to write a shell script to run the jar as has been mentioned, however you need to deal with the potential that the end-user doesn't have Java installed.
There are two possible solutions, on the page you could simply say that it requires Java. Or, (the better solution, IMO) you could do what other games have done and bundle the correct JRE with each platform specific version of your app and use that to launch the jar. I can't give you any specific pointers seeing as I've never done it myself, but I know it's been done before and is possible.
1
u/hugeowl Dec 09 '15
Due to time constraints, I will probably write the requirement to have Java installed first and work on bundling JRE in the few days after the release.
1
u/ctharvey Dec 08 '15
The easiest way to do this is looking into how to package your own exe otherwise you're going to run into Java version mismatches.
1
u/hugeowl Dec 09 '15
Making an .exe is cool, but I'm not sure if it helps with mac or Linux. If I wanted to make a .deb executable for Linux (this is the extension, right?) I might get problems with OS distro version.
The game is on purpose built on Java 1.6 to minimize the version problems. I did some investigation and Minecraft is also compiled using 1.6 so this version might be pretty common across gamers' computers.1
u/ctharvey Dec 09 '15
That's thrue about Mac and Linux but I'm sure you can make distributables for those OS as well. Minecraft used to be built against 1.6 but has switched to distributing its own Java jre as well.
1
u/HobHeartsbane Dec 08 '15
I'm sorry that I can't give you any specific information, but I would guess that stackoverflow would yield better results for your question, since most questions asked in this sub are beginner questions.
In regards to scripts on mac/Linux you should look into bash scripts.
0
3
u/GuyWithLag Dec 08 '15
You need to write a shell script for your game, essentially something like this:
However, that file needs to be executable, and I don't know how Steam will handle that (no idea on that side). Further, not all Linux users have Java installed (no idea about Macs), so I don't know how if you can specify that this game need Java installed.
TBH you could just look how other Steam games have done this (I think Spiral Knights f.e. is written in Java), but that might be against the terms of service.
Eclipse (the IDE) has a very interesting system where they bundle a launcher (win/mac/linux versions) that can use a JRE packaged alongside your own JARs, but it might be too late to start working on using that system.