The Lightweight Java Game Library provides a simple API to OpenGL, OpenAL, OpenCL and Game Controllers enabling the production of state of the art games for Windows, Linux and Mac. Version 2.9.0 contains a complete rewrite of the mac backend, support for FreeBSD, new OpenGL/OpenCL extension and bug fixes. The library is used by many high profile games such as Minecraft, Spiral Knights, Revenge of the Titans, Project Zomboid, Starsector, JMonkeyEngine, etc.
If people are wanting to write cross platform games, Mono Game is probably a better option.
Bastion is one notable example of an indie game that uses it.
Yes, you will…
… because you just dropped this without any hint as to why Mono would be better. I, for my part, would not like to see Mono on my machine — although I must admit, Java has lost most of its appeal now that it’s fallen into Oracle’s clutches.
Either way, I think the argument is moot anyway, as Unity runs on all three platforms.
Not defending the OP, his post was indeed lacking argumentation regarding why Mono Game would be a better option than Java equivalents. But if I were to write a multiplatform game in a managed language, I’d probably also look in the direction of Mono-based tech first.
First because Java runtimes are cursed with suckiness on almost all platforms where I’ve had the displeasure of dealing with them. The Windows JRE is the textbook example a user-hostile piece of garbage, Linux runtimes may or may not work in a seemingly random fashion, the mere idea of installing the JRE on iOS or Windows Phone is banned by the respective platform owners, and thanks to OS X 10.8’s “Gatekeeper” feature I’m not even sure that one can still install the JRE on a Mac without tweaking system preferences. In short, the only major consumer platform where Java software works well today and should continue to work well tomorrow is Android, because it’s Java-based itself.
Meanwhile, the Mono runtime works okay on every platform which I’ve tested it on, and you can very easily statically link it to executables so as to ease deployment to “annoying” platforms like iOS (even if you need to keep the terms of the LGPL in mind when doing so).
Also, the Unity toolchain, which you mentioned yourself, is Mono-based, and it’s miles ahead of anything Java-based which I know of. The main difference being that it’s not just a set of libraries targeted at game development, but rather something closer to a full multiplatform game development toolchain.
I’m not saying that there is something intrinsically wrong with the Java language or that it’s impossible to write good games in it, mind you. I’ve played several very nice games written in Java. I’m only arguing that the Java ecosystem seems less suitable than the Mono one for that specific purpose.
Edited 2013-04-25 14:05 UTC
There are a few native compilers worth mentioning like
– Avian (http://oss.readytalk.com/avian/)
– RobotVM (http://www.robovm.org/)
– CodenameOne (http://www.codenameone.com/)
What I don’t understand is why Sun, now Oracle, make it such a strong political issue not to offer AOT compilation on their SDK. Specially when it is part of the SpotVM and embedded Java SDKs.
Just let it be like most environments for FP languages and offer JIT + AOT options to developers.
Once I read in a forum post from someone stating internal information that this was a big political issue inside Sun, not sure if it is really true.
It seems to be very trendy to bash Java these days. Do you care to explain why you think the Java runtime on Windows is a textbook example of a user-hostile piece of garbage? I also don’t understand why you think Linux runtimes may or may not work in a seemingly random fashion.
I have used the Oracle JVM on both Windows and Linux and never experienced any problems with those. I have used the IBM JVM on linux and did experience some compatibility issues. Finally, I’ve also used the OpenJDK on linux. With the OpenJDK I noticed some warnings from software that insists it wants Oracle JDK (Intellij IDEA), but I didn’t really notice any incompatibilities.
The drawback of relying on locked down systems, is living with the fact that someone else decides for you which piece of software you are allowed to run.
Android is not really “Java-based”. A lot of Android aplications are written in a programming language with the same syntax as Java, but they run on the Dalvik VM, which is a different thing than a JVM. AFAIK, you cannot just run any piece of Java software on Android.
No comments about the availability of the appropriate libraries, since I am not familiar enough with those. However, I believe that the JVM is a lot more advanced, and a lot more powerfull and performant than the Mono runtime. I would expect that to be a drawback for games. Maybe it doesn’t matter that much when most of the work is actually done in the external libraries that are themselves written in C or C++.
Edit: Ok, also interesting to know that “Mono Game” is an open source implementation of the Microsoft XNA4 Framework.
Edited 2013-04-26 01:19 UTC
People keep mixing up Java, the language, with the virtual machine that is part of the Oracle Desktop Java Runtime.
I miss the days people really had a clue about languages and implementations.
Nowadays one needs to explain that all the time.
My guess is, that’s because Java is a proprietary programming language where Sun/Oracle’s runtime is the de facto standard while other runtimes are second-class citizen.
In almost all other widespread programming languages, you have a clear-cut and well-documented separation between what constitutes the programming language and what constitutes the platform behind it.
This way, standardized languages can exist independently from their creators, and implementations only differ by how well they implement the language and/or standard library. This is not the case with Java: in the unlikely case where Oracle would go bust tomorrow, the Java ecosystem would likely implode for lack of direction, although Google might manage to pull off a “Dalvik is not Java” and save the Android part of it.
Edited 2013-04-26 07:01 UTC
This is not true for any Java certified VM or native compiler.
What is different about those?
They are also first class citzens.
There are many embedded systems out there running Java Embedded and Java Card runtimes, either in VM or AOT mode.
Many of those systems use certified third party implementations, not the one from Oracle.
If you wish I can produce a list.
What makes these first-class citizens? Are they developed in the same conditions as the JRE, including with the same awareness of, and control on, new language or standard library features?
They are the only option you have when you want to target certain devices with Java:
– Feature phones
– Car navigation systems
– Electric windmill control systems
– Blueray players
– Militar control systems
– Copier firmware
Oracle does not sell such implementations only certifies them.
Ah, I see that we have a different idea of what makes someone a first-class citizen of a platform. For you, an implementation which has a monopoly on some use cases of the platform seems to fit the bill, whereas for me, only entities who have control and visibility on the platform itself would qualify.
Take C and C++, as a counterexample. The associated standards are managed by a non-profit, public standards committee. Representatives of companies which build C/C++ compilers can be part of it, but to the best of my knowledge there isn’t a single company which has the final word and dictates its law on all others. Decisions must be taken through mutual agreement between the different actors, rather than imposed by an almighty overlord.
Edited 2013-04-26 11:50 UTC
That is what JEP is for.
Even ECMA, ISO and ANSI are not that independent, given how much the companies pay to keep them alive.
So what platforms, other than Windows have you used Java on so that is that user unfriendly? All Unix like platforms there are no user oriented issues. As in, you barely know that there is Java installed.
I have provided more details about other systems’ issues elsewhere, but basically, regarding Unices…
-On Linux, Oracle JVM may or may not install properly and survive system updates, while OpenJDK has compatibility issues that may make it abruptly crash without explanations when trying to run some software (at least it was the case last time I dealt with those).
-On OSX, the JRE isn’t installed by default anymore, is banned from the App Store by design, and it gets increasingly hard to install software that’s distributed in a decentralized fashion. Sure, all that is Apple’s fault, not Oracle’s, but tell that to users…
-According to someone else here, Dalvik on Android may have only weak compatibility with Java software.
A) On Linux OpenJDK has progressed beyond usable. With the exception of IntelliJ IDEA(that has some weird internal API dependencies) I use OpenJDK 7 on a day-to-day basis. For development, test and production. Including playing Salem[1].
B) You were complaining the issues that the JDK brings after it installed(toolbars and other bloatware) and that is not the case on any other platform than Windows.
1 – http://www.salemthegame.com/
My pleasure!
From the very first time you run the JRE installer on Windows, you are greeted with an installer with ugly nonstandard controls and lots of unnecessary clicks, that tries to install crapware in an opt-out fashion somewhere in the middle. This is kind of a great way to leave a first impression, in my opinion.
After that, since the Windows JRE is almost as full of security holes as Adobe Reader, it has to be updated very frequently. The availability of frequent updates would be a good thing, if only the updating process was quick and seamless. Only, it’s not. You have to fetch a new version of the runtime manually, retrieve it, run it, go through the installation process all over again, and remind to uncheck the checkbox somewhere that still tries to install crapware on your machine even if you said no the first time.
And obviously, you can’t do all that as a regular user, so if you want your machine to stay secure you have to keep typing your administrator password over and over again, all the time. That’s quite the way to keep it a secret from others… and if you don’t have admin rights on your machine and the admin never logs in by himself, you’re basically screwed with an outdated version of one of the top exploited pieces of Windows software.
Oh, right, but will Java software run well on the JRE? At least it does, if you are very patient. Because every piece of Java software which I’ve had to deal with, no matter how simple it was, took a very long time to start, and then popped multiple warning about unknown security certificates even when I told it that it was a trusted one. Seems like the “remind this certificate” checkbox does not work well for some reaon, so in the end you end up enrolling certificates manually in the impossibly ugly and convoluted runtime configuration windows.
You are definitely more lucky than me then. In my experience, the Sun/Oracle JVM has been as much of a pain to deal with on Linux as every other piece of proprietary software, meaning that if you can’t find a friendly someone who maintains a stable repo for your distribution, it will be painful to install and likely to break on the first slightly significant system update.
Meanwhile, OpenJDK, while it behaved as a good Linux citizen on its side, would frequently refuse to run some software altogether without an explanation (command line aborts without an error message, browser applets silently crash and leave a gray box behind). However, it is true that when software did work, it would work fairly well, save for the occasional app here and there where Unicode text is replaced by a wonderful stream of while box for some reason.
My point was that Android developers dealt mostly with the Java programming language, even if they use a different VM and a different set of underlying libraries, and it seemed to work fine for them.
The Mono runtime is indeed quite a bit slower than the JVM, however it also uses a lot less RAM, which can be an important quality on mobile devices. Anyway, as you said, I wouldn’t write a strongly performance-sensitive program or library in a VM-based language like C# or Java anyway. Native code does still have an edge for some use cases, even if the gap is closing.
Edited 2013-04-26 08:13 UTC
There are native code compilers for C# and Java available.
Just as quick example, are you aware that in Windows Phone 8, C# and VB.NET are actually compiled down to native code?
You are right about that one. These languages are designed for VM work, but nothing prevents one from translating VM bytecode to its native equivalent, no matter how inefficient it can get without the optimizations made possible by knowing the run-time state of the program at translation time.
However I’m not sure that AOT compilation can solve all the performance problems which are frequently encountere with these languages. Besides the issue of context discussed above, it would only eliminate the runtime compilation overhead of the VM, without tackling some other kinds of runtime inefficiencies which are intrinsic to those languages, such as garbage collection cycles.
Edited 2013-04-26 12:07 UTC
The fact that strong typed languages are usually mixed up with VM implementations is an unfortunate fact from young generations not understanding what compiler design is all about.
Strong typing or automatic memory management have nothing to do with VMs.
Using GC enabled languages means you need to code in a different way, just that.
Malloc and friends can be slower than reference counting/GC implementations, depending on the use cases. Not all compilers for languages with manual memory management have performant heap management.
Since my Oberon and Modula-3 days, I am firmly convinced that it is only a matter of time until the hard code C developers get replaced by developers that appreciate GC enabled systems programming languages, generation change will help the process.
moondevil,
There are pro’s and cons of each. Sometimes I prefer having unmanaged pointers and non-GC languages because they give more control and they are more deterministic, but a counterpoint could be that few developers really need this low level control and the sort of determinism we’re talking about isn’t significant in the grand scheme of things.
There’s no doubt that many programmers screw up unmanaged code and it’s the cause of some of the most dangerous vulnerabilities. If someone will not or can not do unmanaged code correctly, they’d undeniably be better off with a GC language.
“Using GC enabled languages means you need to code in a different way, just that.”
I actually prefer coding style with explicit allocation/deallocation since I think it makes the program’s intention clearer than a GC program, and it motivates developers to truly understand the problem better than the GC solution. With GC, we often take memory management for granted, but this can cause oversight of unnecessary alloc/frees activity going on under the hood that would have been caught if it were explicit.
“Not all compilers for languages with manual memory management have performant heap management.”
That’s true, GCC’s default C allocator was pretty bad for multithreaded code the last time I benchmarked it. Although it depends on too many factors to make a generalization.
“I am firmly convinced that it is only a matter of time until the hard code C developers get replaced by developers that appreciate GC enabled systems programming languages, generation change will help the process.”
I’m not convinced GC enabled programming languages are better, but I can probably admit that GC languages will tend to produce better code in the hands of the most typical software developers
This is a good, important point: when GC is available, a lot of developers take memory management for granted, and do not care about it anymore. I have the impression that the newer generations of developers do not even know what exactly is going on behind the scenes. And, personally, I think that you can only fully take advantage of things like e.g. GC if you do know what is going on behind the scenes. For the same reasons, I do think that it’s very important to know the complexity of operations on data structures that are included in the vast libaries of e.g. Java and C#. Sadly, I’ve realized that only very few developers know for example the cost of adding a new element to an ArrayList.
snowbender,
“Sadly, I’ve realized that only very few developers know for example the cost of adding a new element to an ArrayList.”
Oh man, you got me. I’ve used it many times, and yet I really don’t know _what_ an “ArrayList” is.
This is true even for manual memory management languages.
In languages that throw exceptions when memory allocation fails, Pascal family and C++, there is no difference from one with automatic memory management.
As for C, I have seen too much code where the value returned by malloc() and friends is never validated, or they get replaced by a macro that aborts on NULL.
moondevil,
“This is true even for manual memory management languages.”
The state of what’s going on in the head of the developer can be different though. The unmanaged developer implicitly will be aware of memory management in his application, otherwise it won’t run well. The managed developer could be aware, but often is not. That’s not necessarily a con, after all it makes programming a bit easier and allows him to concentrate on other things.
“As for C, I have seen too much code where the value returned by malloc() and friends is never validated, or they get replaced by a macro that aborts on NULL.”
It’s ok if it’s the appropriate thing to do. I’m more annoyed that on platforms like linux, checking for null is futile because malloc always returns success and it’s only when the page is accessed that it segfaults the process. No language can sanely handle OOM conditions when it cannot access the RAM, which malloc already returned successfully.
Ok, can relate to that, especially about the opt-out thing. Personally, if I would be leading a big company like Oracle I would be embarassed for adding that toolbar thing in their installer.
As far as I know, Oracle Java comes with a piece of software that automatically checks for updates, and will warn you when a new update is available. You do not need to download updates manually. Or at least, that’s how it’s been for me on windows.
Ok, but you do understand that this is by design, right? Basic OS security prevents regular users to install new software on the machine. So yes, when you want to install new versions of software on windows, you need admin rights. This is even true for updates coming in through “Windows update”.
I do doubt about it being one of the top exploited pieces of Windows software. Sure it got a lot of media attention lately, but that is in the first place for the browser plugin. Either way, I do agree it has security issues.
This really sounds like running applets, in which case the “long time to start” is probably caused by the fact that the bytecode needed to run the Java program must first be downloaded over the internet.
I honestly never had a Sun/Oracle JVM break on me. I always install proprietary software in a separate folder in /opt.
The stream of white boxes normally means you do not have any fonts that can represent the given characters. I do notice we have different usage patterns. I have to say that I very rarely need to run applets. And the Java programs that I do run from time to time are Eclipse, Intellij IDEA, JBoss and some small Java programs I work on.
I don’t know about the “a lot less RAM” for Mono, but they definitely have different garbage collectors, with the JVM one being a lot more advanced and powerfull. Different garbage collection algorithms can lead to different memory allocation patterns, which can lead to different RAM usage. However, garbage collector performance improves when the garbage collector gets more ram. So while a program that is limited to 1gb of ram needs to spend 2 minute on GC in total, it is very well possible that with 2gb of ram, it would only spend 1 minute on GC. So in the context of GC using more ram might not necessarily bad, if the ram is actually available.
Either way, thanks for explaining the reasons why you feel so negative about Java and the JVM.
Mono works on iOS, Android, Linux, Windows, MacOSX.
The Windows Phone SDK works with MonoDevelop.
C# is a better language IMHO than Java (even thought they are both similar).
As I said bastion is a good example of a successful game built using the Framework.
Edited 2013-04-26 16:27 UTC
There are plenty of successfull multiplatform projects using LWJGL, inluding Minecraft, and most of the releases by Puppy Games (Titan Attacks, Ultratron, Droid Assault…)
Although I prefer stronger type languages, for hobby developers on mobile I would just advice C++, since it is the only language which is supported across all mobile platforms SDKs.
Personally due to personal experience I tend just to use official SDK supported languages.
Too much development effort is lost in writing bindings, plus you never know who to blame when problems arise.
Anyway, Starsector completely slipped under my radar. It looks awesome; I’m sure to check it out.
There should really be some sort of measurement as to when you are allowed to use the term Lightweight.
I guess a sumo-wrestler in some sense also could be considered lightweight if you only measure him against other sumo-wrestlers…