I have a basic game that I want to eventually turn into something better. The game is all Java as of right now, but I want to implement the Steamworks SDK into my game (so it can have achievements, and the Workshop, and so on). But Steamworks requires C++. Is it possible to have my full Java game implement the Steamworks SDK without rewriting it in C++? I am currently using the jMonkey Engine 3 for my game.
4 Answers
It's definitely possible, you would just need to create a thin layer wrapping the Steam SDK (or part of it) to java via the Java Native Interface
I'm not aware of any efforts to have an opensource library for this.
-
\$\begingroup\$ This appears to be a very viable solution. My only snag with this now is that I do not know how to implement this into my code or where. I would assume it would be somewhere in the main file, right? \$\endgroup\$ Mar 27, 2014 at 16:23
-
\$\begingroup\$ I took a deeper look at it and I am sure I will be able to figure it out. This answer was really helpful in setting me on the right path. \$\endgroup\$ Mar 28, 2014 at 13:32
-
2\$\begingroup\$ There's steamworks4j, a Java wrapper around some of C++ steamworks API using JNI. \$\endgroup\$– mucahoMay 18, 2015 at 14:59
JNI is a way to go if you want full access, but the Steamworks Web API might be an easier way to go. It's basically an HTTP/HTTPS-based channel to the Steamworks functions, designed to be instantly compatible with access from Java, Python, Ruby, and really anything that isn't intrinsically C/C++.
Of course you know that the issue with JNI is that you would need to compile it seperately for each available OS, which kind of defeats the purpose of any of those languages. Getter methods can be run with basic HTTP; setters (like setting an achievement), as I understand it, require HTTPS, and a unique developer identifier; but the interface is still relatively simple.
Today there exists a ready-to-use wrapper on github:
https://github.com/code-disaster/steamworks4j
This could be what you are looking for!
Use Steam SDK and U can use Jar if they provide. check them issue and API. and after think about implementation. http://steamcommunity.com/dev/