How powerful is Java?

Started by
47 comments, last by Alpha_ProgDes 11 years, 5 months ago
I shared some thoughts on this recently in a post titled "MYTH: Java not suitable for games". Some notable Java-based games include Minecraft, Runescape, Puzzle Pirates, Wurm Online, Spiral Knights, WAKFU, and Maker's Tale (still in development, but making great progress). Although it wouldn't be my personal choice of language -- I dislike some of the conventions and design decisions -- it's more than capable of creating good quality video-games, and the limiting factor (if there is any) will be your programming capabilities rather than any deficiency in the language or platform, and although slightly lower-level languages have their advantages you may even find the experience easier than using a language like C++ where you have to manually manage your memory.

Note that in those cases where the example games listed above -- or the example games for the engines and libraries listed below -- have simpler or more primitive looking art this is usually a stylistic choice or a result of cheaper/simpler art assets rather than a limitation of the language and platform. A lot of beginners fall into the (somewhat understandable) trap of thinking that because some of the games have what they consider to be poorer graphics that the language or engine must be to blame, but it's very rare that this is the case.

I think it's a good choice for anyone comfortable with the language, and there are some good library and engine choices available including jMonkeyEngine, lwjgl, and Slick, amongst others. The Android SDK is also in Java, and although they do also provide an "NDK" for C and C++ developers they state that "using native code on Android does not result in a noticeable performance improvement".


You can proceed and be happy with your choice of Java for games development.

Hope that helps! smile.png

- Jason Astle-Adams

Advertisement
EDIT: No lol around here it seems unsure.png

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

It is Turing-complete.

I Create Games to Help Tell Stories

Over 9000

It is Turing-complete.

So is brainfuck, but that doesn't make it suitable for games.


Please try to stay on-topic/helpful guys. smile.png

- Jason Astle-Adams

If you want 2D or targeting mobile platforms it's probably okay, for 3d I can't recommend it.
I tried various OpenGL bindings and on some PC's it starts to stutter. It was totally random, even the demo applications that where provided by the Libraries sometimes worked and sometimes didn't.

Besides it's a big dependency and I would stay away from that. Yes, .Net and XNA is the same, which is why I wouldn't recommend it either.
It might seem very simple, but especially when you're targeting causual gamers, you can't expect anything technical. Even installing the proper graphics drivers and DirectX is often asked to much.
And I doubt that you can ship Java with your Installer, as you can do with .Net and XNA.

for 3d I can't recommend it
[...]
on some PC's it starts to stutter

Spiral Knights, RuneScape, and Minecraft don't have those problems. wink.png

When did you last try Java? It used to have pretty serious problems, but it's been perfectly fine for quite a long time. There is a lot of badly written Java software which exhibits problems, but this isn't indicative of the capabilities of the platform.


And I doubt that you can ship Java with your Installer

Redistribution of the Java runtime is allowed.


it's a big dependency

This is a genuine concern that is worth taking into consideration -- end-users will need to either already have Java, get Java, or you will need to include the Java runtime in your installer, which can potentially bloat installer size. Note however that programs developed in C, C++ and other languages also often have similar requirements -- support libraries, runtime distributables, etc. -- anyway.



Full disclosure: I wouldn't choose Java myself, as I'm not a big fan of the language and libraries. I think most of the commonly presented objections to Java are misleading though, and I think it's a fine choice for those that are comfortable with it.

- Jason Astle-Adams

Well from a graphics point of view, everything is abstracted through driver calls at this point, so the choice of language will have essentially zero impact on rendering speed. There are some considerations when it comes to logic code (data structures, memory footprint, etc...) but in most cases, even if a C/C++ coder might give you grief for not caring as much about efficiency and doing things elegantly, in general it does not matter as long as the game runs well enough and the code is maintainable.

As for general development quality of life, I would say it is satisfactory. It's not my favorite language but with a good IDE a good Java coder can create games just as well as any other coder. There are certainly situations where using Java may simply be the wrong choice, but I do not believe game development to be one of those. In fact, it may be a better choice overall, because the JVM takes care of a lot of low-level portability issues that other, more low-level languages may still be struggling with.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”


When did you last try Java? It used to have pretty serious problems, but it's been perfectly fine for quite a long time. There is a lot of badly written Java software which exhibits problems, but this isn't indicative of the capabilities of the platform.

It must have been less than three years, it was defenetly on my current machine. By the way, it's not just bad software that is sometimes exhibiting such strange behaviour. For example Quake Live didn't work correctly either while Minecraft doesn't give me any problems.


View Postshadowomf, on 03 November 2012 - 02:06 AM, said:
it's a big dependency
This is a genuine concern that is worth taking into consideration -- end-users will need to either already have Java, get Java, or you will need to include the Java runtime in your installer, which can potentially bloat installer size. Note however that programs developed in C, C++ and other languages also often have similar requirements -- support libraries, runtime distributables, etc. -- anyway.


Sure it's true, with C/C++ you do often add additional dependencies, as with any other language. I do even know some commercial software that is written in multiple languages (C++, Visual Basic, Tcl, ...) and that has a dependency package that is multiple gigabytes in size (which is bigger than the application itself).

But if you're trying to be reasonable with your dependencies you can built pretty small applications in C++, that are simply installed and don't require additional setup steps for the Runtime and other libraries. This can be important if you're planning to use digital distribution or want to offer a demo that doesn't take long to download. Another thing is, that these additional installation steps, can confuse some users (What is .Net? Why do I need this Runtime-Whatever? Where do I have to put this <fancy marketing name for a library>?) and are always annoying even if you know what they are doing.


even if a C/C++ coder might give you grief for not caring as much about efficiency and doing things elegantly, in general it does not matter as long as the game runs well enough and the code is maintainable.

Sure, you can always ignore the performance of your application and expect the user to buy new hardware. But with C/C++ the minimum system requirement is probably lower and you might sell more.
Always assuming that:
- the developer knows what he/she is doing, no matter if it's a C/C++ or Java developer
- the developer doesn't have to learn C/C++, in that case it is just not feasable to let him start on a game using C/C++ and will probably result in something worse than what he/she could have done with Java

Sure, you can always ignore the performance of your application and expect the user to buy new hardware. But with C/C++ the minimum system requirement is probably lower and you might sell more.

My hypothetical Java coder would not be "ignoring performance" (it's not like he's using bubble sort) he would simply not care as much about squeezing every possible ounce of performance out of the target system. The minimum system requirements would be low enough, and he will benefit from fast development time and will meet his deadlines without worrying about his code becoming more and more arcane as more performance hacks are thrown in (yes, just because you code in C++ doesn't mean the CPU automatically clocks twice as fast, you just have more optimization freedom)

Besides, we are talking about games here, not some high performance computing application. Most people who care about high framerates already have monster rigs, those who don't implicitly accept that some games may run slower by nature. Following your train of thought, every game should be developed under its own real time operating system, in raw assembly, and coded on-demand for every customer hardware configuration. By an assembly guru. Well, I just don't think that's cost effective, that's all.

And yes, I certainly do expect the user to buy new hardware, so that I can implement bigger and better features in my game instead of worrying about how fast it will run on October 4 2012 at 1:44 AM on current technology. Computers only get faster. Think in more than one dimension.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

This topic is closed to new replies.

Advertisement