Sign in to follow this  
Dahamonnah

How powerful is Java?

Recommended Posts

Dahamonnah    172
Hi, I'm just wondering about the power of Java compared to other languages (in game development), I'm just starting out on Java and I wanna know how powerful is it and what kind of games it's capable of running.

Thank you.
- Manny.

Share this post


Link to post
Share on other sites
arthurviolence    1621
"what kind of games it's capable of running."

Anything. Really, anything.

Most language differences are regarding things that only affect the process of development. The final result will be possible with the use of most of the tools. Edited by Arthur Souza

Share this post


Link to post
Share on other sites
ic0de    1012
There is nothing technically limiting about the language of Java, there are a few minor annoyances such as the lack of operator overloading but its not a huge issue. However the implementation of java will almost always be in a virtual machine so you can expect some performance penalty. Edited by ic0de

Share this post


Link to post
Share on other sites
slayemin    6089
Check out [url="http://www.wakfu.com"]Wakfu[/url]. It's written entirely in Java. Their game can run on any platform which supports the Java Virtual Machine. (Dunno about mobile phones though). Although I use C# myself, Java would be my second language of choice.

Share this post


Link to post
Share on other sites
tebriel    904
I wouldn't say the JVM (Java Virtual Machine) is a particular weakness for Java. If Java has a weakness it'd probably be related to OS or hardware integration--it is a bit detached from the lower level access that C++ has. Although, modern libs have significantly mitigated that detachment.
For non-professional game development this isn't really a factor IMO.

In fact I think Java is a [i]better [/i]candidate (than C++) for a casual development team. I used C++ for years, but throwing away the productivity Java brings to the table just because "games are supposed to be done in C++" is just asking to make things more difficult for yourself, unless you have a large team and quite a bit of money & time.
I'd have to have a very good reason to use C++ over Java. Game dev used to be one of those, but not anymore. Edited by Tebriel

Share this post


Link to post
Share on other sites
SimonForsman    7642
[quote name='Alpha_ProgDes' timestamp='1351880235' post='4996617']
It's capable of running any game that .NET, C#, or XNA can run.[list]
[*]Games you see on tablets. It can do that.
[*]Games you see on the Nintendo 3DS. It can do that.
[*]Games you see on the PSP and Vita. It can do that.
[*]Games that have been made using XNA (Zune, Windows Phone 7.5, and Xbox360). It can do that.
[*]Games of the last generation (PS2, Xbox, Gamecube, Wii). It can do that.
[/list]
[/quote]

You can add Games of the current console generation to that list as well (There are good native libraries for most performance critical tasks) The higher system requirements can reduce your customerbase quite a bit though.

Share this post


Link to post
Share on other sites
jbadams    25676
I shared some thoughts on this recently in a post titled "[url="http://clicktobegin.net/programming/myth-java-not-suitable-for-games/"]MYTH: Java not suitable for games[/url]". Some notable Java-based games include [url="http://www.minecraft.net/"]Minecraft[/url], [url="http://www.runescape.com/"]Runescape[/url], [url="http://www.puzzlepirates.com/"]Puzzle Pirates[/url], [url="http://www.wurmonline.com/"]Wurm Online[/url], [url="http://www.spiralknights.com/"]Spiral Knights[/url], [url="http://www.wakfu.com/en/mmorpg"]WAKFU[/url], and [url="http://makers-tale.com/"]Maker's Tale[/url] (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 [url="http://jmonkeyengine.com/"]jMonkeyEngine[/url], [url="http://www.lwjgl.org/"]lwjgl[/url], and [url="http://slick.cokeandcode.com/"]Slick[/url], amongst others. The [url="http://developer.android.com/sdk/index.html"]Android SDK[/url] is also in Java, and although they do also provide [url="http://developer.android.com/tools/sdk/ndk/index.html"]an "NDK" for C and C++ developers[/url] 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! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites
jbadams    25676
[quote name='Telcontar' timestamp='1351915419' post='4996755']
It is Turing-complete.
[/quote]
So is [url="http://www.muppetlabs.com/~breadbox/bf/"]brainfuck[/url], but that doesn't make it suitable for games.


Please try to stay on-topic/helpful guys. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites
shadowomf    323
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.

Share this post


Link to post
Share on other sites
Bacterius    13165
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. Edited by Bacterius

Share this post


Link to post
Share on other sites
shadowomf    323
[quote name='jbadams' timestamp='1351927627' post='4996798']
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.
[/quote]
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.

[quote name='jbadams' timestamp='1351927627' post='4996798']
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.
[/quote]

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.

[quote name='Bacterius' timestamp='1351932726' post='4996801']
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.
[/quote]
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

Share this post


Link to post
Share on other sites
Bacterius    13165
[quote name='shadowomf' timestamp='1351941697' post='4996824']
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.[/quote]
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.

Share this post


Link to post
Share on other sites
shadowomf    323
I fear this is to far off topic. Hopefully not.

[quote name='Bacterius' timestamp='1351946684' post='4996843']
My hypothetical Java coder would not be "ignoring performance" (it's not like he's using bubble sort)
[/quote]
As mentioned before, I was assuming the developer knows what he's doing. By the way, bubble sort can sometimes be the right tool for the job e.g. for very small data sets (1-10 or something) it's simplicity can help it outperform more advanced algorithms.

[quote name='Bacterius' timestamp='1351946684' post='4996843']
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.
[/quote]
As far as I know most gamers that I would describe as casual gamers, don't buy new computers if they don't have to. And most of the time they are using them for many years.
If you do not depend on thoose extra sales, you are free to ignore them.

Note, currently I'm working on commercial software (not games) and most of the computers that I'm installing it on, are quite old. Even if computers are new, they are usually the cheap kind. However my impression so far is that private/personal computers are updated even less often.

Of course if you're developing the next Unreal or Crysis you know there are many gamers that will buy a new rig just to play your game. (Well Crytek still targeted DX9 instead of >=DX10... with Crysis 2.)

[quote name='Bacterius' timestamp='1351946684' post='4996843']
those who don't implicitly accept that some games may run slower by nature
[/quote]
Actually they don't take responsibility for slow software. For example, if someone complains that Outlook getting slower with each version, he is making MS responsible.
And he is right, if you have features that justify a higher system requirement that's one thing. But if you waste CPU cycles and can't show anything in return, don't be surprised if the user is thinking "Oh great another upgrade required because the developer is lazy".

[quote name='Bacterius' timestamp='1351946684' post='4996843']
he will benefit from fast development time
[/quote]
Well, if he had learned C/C++ from the beginning he would probably be faster using it than Java. At least for me this is the case.
Why does everybody, think it's faster/easier to use Java? I feel terrible when I have to use it and the lack of good tools doesn't help at all.

Okay, I was trying unsuccessful to find an article I read about how Java is a bad choice for teaching programming. But couldn't find it. Anyway, sometimes that extra difficulty can help making you a better programmer.

[quote name='Bacterius' timestamp='1351946684' post='4996843']
By an assembly guru. Well, I just don't think that's cost effective, that's all.
[/quote]
You're right it's not cost effective. However the thought of it is quite pleasing. :)
Well I like toying around with assembly and I'm glad it was part of my training. Even though I was never forced to use it in production (that would probably be a maintenance hell).

Just to make one thing clear, I think Java is a perfectly valid language choice. It's just my personal preference that if given the choice, I wouldn't choose it.

Share this post


Link to post
Share on other sites
Dunmord    105
[quote name='vladmihail' timestamp='1351885782' post='4996642']
java its very powerfull and its better even than C and in some cases its better than C++
[/quote]

Better on what? It all depends on your target platform. Portability is easier in Java because of the virtual machine.

Java has been greatly optimized during the years, but you still get a performance hit (even small) because you have to run your code through the virtual machine. Java does use more memory than C++ because it is built upon objects. Every datatype in Java is an object, whereas in C++ native data types are not. Most C++ data types have a 1-1 correlation with assembler data types.

(C++) int - dd
(Java) int - dd + functions

The data part of the int in Java does translate to a data type in assembler, but you have functions that use memory.
To some games it may matter, to others it may not.

Last time I checked, C++ had much more mature game development tools than Java. You can even compare tools like Java 3D vs the C++ Irrlicht3D engine (both free).

Share this post


Link to post
Share on other sites
Oberon_Command    6081
[quote name='Dunmord' timestamp='1351968546' post='4996939'] Every datatype in Java is an object, whereas in C++ native data types are not. Most C++ data types have a 1-1 correlation with assembler data types.

(C++) int - dd
(Java) int - dd + functions
[/quote]

This is true in [b]C#[/b], but not Java. Java's "int" type is a primitive type and basically behaves like the "int" type in C++. In C#, "int" is basically syntactic sugar for the System.Single type, which is a value-type structure that represents an int. If you want to treat integers like objects in Java, you need to use the Integer class.

Share this post


Link to post
Share on other sites
CyberRascal    208
[quote name='Oberon_Command' timestamp='1351970212' post='4996946']
[quote name='Dunmord' timestamp='1351968546' post='4996939'] Every datatype in Java is an object, whereas in C++ native data types are not. Most C++ data types have a 1-1 correlation with assembler data types.

(C++) int - dd
(Java) int - dd + functions
[/quote]

This is true in [b]C#[/b], but not Java. Java's "int" type is a primitive type and basically behaves like the "int" type in C++. In C#, "int" is basically syntactic sugar for the System.Single type, which is a value-type structure that represents an int. If you want to treat integers like objects in Java, you need to use the Integer class.
[/quote]

True, but misleading. It seems like you are saying that the implied performance hit when treating an int as an object applies to C# but not Java, but it's the other way around. Given that a primitive (or struct) in C# behaves like automatic variables in C++ (same in Java), there is no performance penalty in C#. However, in Java it is not possible to have arrays without indirection - you can only have arrays of the Integer object, which is a reference type. So basically for most intents and purposes it's [i]more[/i] true that primitives are objects in Java than the other way around.

Share this post


Link to post
Share on other sites
Oberon_Command    6081
[quote name='CyberRascal' timestamp='1351978904' post='4996985']
[quote name='Oberon_Command' timestamp='1351970212' post='4996946']
[quote name='Dunmord' timestamp='1351968546' post='4996939'] Every datatype in Java is an object, whereas in C++ native data types are not. Most C++ data types have a 1-1 correlation with assembler data types.

(C++) int - dd
(Java) int - dd + functions
[/quote]

This is true in [b]C#[/b], but not Java. Java's "int" type is a primitive type and basically behaves like the "int" type in C++. In C#, "int" is basically syntactic sugar for the System.Single type, which is a value-type structure that represents an int. If you want to treat integers like objects in Java, you need to use the Integer class.
[/quote]

True, but misleading. It seems like you are saying that the implied performance hit when treating an int as an object applies to C# but not Java, but it's the other way around. [/quote]

I'm not saying anything of the sort. I'm pointing out facts. I'm not trying to make any implications here.

[quote]However, in Java it is not possible to have arrays without indirection - you can only have arrays of the Integer object, which is a reference type. So basically for most intents and purposes it's more true that primitives are objects in Java than the other way around.[/quote]

[i]Arrays[/i] of the primitive "int" type (as in the type "int[]") are perfectly valid in Java. Were you thinking of the collections libraries (like ArrayList, for instance), which don't support holding primitive types?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this