Proving the coolness of Java games

Hello all :slight_smile:



So the problem at hand is that I need to prove to some guys that games are worth making in Java - I myself love Java.

Those guys I need to show it to have a bit of C++ background.



Can you guys give me ideas what to bring out?



Some possible topics:

Memory

Performance

Usability

Security

Making big and small scale games

Mainstream and Indie

Benchmarks

Workflow

EDIT: GC makes it hard to create realtime applications, since it runs whenever it wants



Both the good and the bad are welcome not to make a one sided argument.

If you feel you have some good points to make, some good articles to bring out then I would appreciate if you do :slight_smile:

make them read this first :

Java versus C++ benchmarks

This was written 8 years ago, maybe it’s time for C++ lovers to get their head out of their…office…



Besides this wrong idea that Java is slower than C++, there is a lot of things that come to my mind :



*myPointer->callAMethod(&myParameter);



Honestly what’s that thing??? (note that this might not be a valid C++ call however :stuck_out_tongue: )

Java is a lot more easy to understand for fresh programmers and the fact that it handles pointers for you should be a reason enough to use it over C++ IMO.

Garbage Collection is IMO an advantage over C++ too.



And btw, in games the performance bottleneck is the display. Display is handle by GPU in most modern games and the language used for this is the shader language (glsl, hlsl, cg), and this is the same if you use C++ or Java.



the conclusion could be that with any of those 2 languages you can make a crappy application/game, it’s up to the developer to know his way around to make something good of it.

But honestly, I can’t see any reason why to choose C++ over Java when you have the choice.

Of course if your teammates are C++ gurus and that you have a solid C++ engine… go for C++.



EDIT : I forgot to talk about portability…which is also and advantage when using Java

Memory, worse then c++ for code and objects assets are probably around the same , but on the other side advanced gc, like cleaning unneeded assets when memory is low automatically and transparent



Performacne around similar, it depends actually more on your skill with opengl limitations. Most performance needing stuff is done in the graficcard anyway. I would say in general c++ is like 10% faster, so not much difference comparing with the speed increase the Hardware has in half a year.



Usability → if you mean how easy to code I would say java is a bit better since you don’t have various hard to find errors (Nullpointer without proper stacktrace ect) On the downside there may be problems with the JVM tho. Also you are kinda limited with lowlevel functions.



Security → a bit lower by default sine java only compiles to bytecode wich could be decompiled. However there are some possibilities to protect the code. But in the End neither c++ nor Java games are uncrackable (just look how much warez exist if a c++ guy tells you about how secure compiled code is)



Making big and small scale games → Small scale is no much issue

large scale I point at two things:

Private Lineage II servers are programmed in java and handle around 2000 player

http://www.wurmonline.com/ MMo with around 400 online players on one server I think this qualifies as large scale as well. Client and Server in this one are in Java



Mainstream and Indie

→ Java is currently more Indie, but I guess this will change with the time. C++ was in the beginning only Indie as well



Benchmarks

→ If you need data for speed comparing java and c++ and you know what you are doing then you know how senseless MicroBenchmarking is. If you need it to impress someone, just tell tham that OpenCl java interfaces are there and its on gpu blablablabla



Workflow

Way better, also you can sell games for Mac and Linux without much further coding.

Also it runs on 64 and on 32bit.

Eclipse and Netbeans help the developer way better than Vc or Codeblocks are capable.

Also you usually have usefull Exception handling wich helps quite much to detect where the errors are and fix them.

I will bring out some points that a C++ programmer tried to make, be them wrong/right or completely out of ignorance, but here they are:

Java clones objects which makes java slow (would like to have some fun feedback on that one :D). I guess he meant creating new objects is somehow different and more consuming than in C++

Java is 2 times slower than C++

You can not make mainstream games in Java

VM is a slow little bugger.



It would also be a good idea to discuss how java has changed over the last 1,5 decade.



Thank you for that EmpirePhoenix:


Mainstream and Indie
-> Java is currently more Indie, but I guess this will change with the time. C++ was in the beginning only Indie as well


Thank you nehon for:

http://scribblethink.org/Computer/javaCbenchmark.html

And that:

Making big and small scale games -> Small scale is no much issue
large scale I point at two things:
Private Lineage II servers are programmed in java and handle around 2000 player
http://www.wurmonline.com/ MMo with around 400 online players on one server I think this qualifies as large scale as well. Client and Server in this one are in Java
1 Like

Just as an example for the speed part, C vs C++ actually it sounds kinda similar to the one posted by nehon for java ^^ and its from 2004

http://unthought.net/c++/c_vs_c++.html



Also what I forgot







So a change from two algorithms is way more relevant than even a 2X speed increase would be



In case of the n^2 algorithm:

Machine a has speed of 1

Machine b is 10 times faster.

However machine b would only be able to process a around 3 times larger problem in the same time.



Or in other words a calculator with a O(n*log n) algorithm would be faster at some point than your pc. The language does not matter that much after all if its only a slight difference.



A good example for this are sort algorithms

The best without further informations is n * log n, however if you have more informations, like there are never more than 30000 ingame objects, you can use just array with size 30000 and put it at the index what it’s id(networkid in my case) says. so Searching now suddenly only costs O(1) instead of O(n) (for slope over array of items) and they are already sorted without further costs.

My answers would be :

monkey said:
Java clones objects which makes java slow

lol

monkey said:
Java is 2 times slower than C++

lol

monkey said:
You can not make mainstream games in Java

lol, yeah, everybody think that...

monkey said:
VM is a slow little bugger.

lol

Not very constructive I admit :p, and I must confess that my opinion is a bit biased because I use Java since 10 years, but honestly these points make no sense...

LOL no mainstream games? Hmm Minecraft comes to mind, it hit 1,000,000 sales last week :D. I means 500 people buying it a day? Sounds pretty mainstream to me! C++ faster? That’s strange, seeing as the vast majority of C++ based games I’ve played are SLOW! I’d still say they’re around the same speed, on a language scale, I have used some C++ apps that are pretty fast. VM does have some downsides, but slowness is NOT one of them. The fact that JME3 exists depends upon Java’s speed! Its deficiencies mainly have to do with having to run on top of an OS. Oh, an dVista’s UAC gets REALLY annoying when you run Java apps.

why do you have to prove those guys that it is worth making games in java ?

if you manage to prove it will you gain something ?



or will they change immediately to java ?



personally I am have no idea about c,c++, I have a little bit experience with python, c# and java.

and I want to make a game for myself (for fun)

after a long time wandering in net reading reviews I think I should choose java over c++ and python.

java is faster than python, about 95% as fast as C++ (dont know how old the review was, may be 3 years old)

I use Linux and I am lazy and java is write once and use anywhere (Linux,windows,mac,phones,car,later may be ps3 and who knows where else ?)



so java was and is my choice.

I heard about scala - might be the future language, but I think I will stay with java, cause I’m lazy.

and I think your friends or someone will just stay with c++ cause they are used to it,and I think it is useless to prove that java is awesome to them.

Nehon:

Your post made me “giggidy” in a good “giggidy” kind of way :slight_smile:


Not very constructive I admit , and I must confess that my opinion is a bit biased because I use Java since 10 years, but honestly these points make no sense…


geniusgames:
I won't bring out all of your message geniusgames, but it was fun to read in a whole :D

LOL no mainstream games? Hmm Minecraft comes to mind, it hit 1,000,000 sales last week . I means 500 people buying it a day? Sounds pretty mainstream to me!
....
The fact that JME3 exists depends upon Java’s speed!


xieu90:
It's not about proving as much as just living together with them, I am just sick and tired always getting "hit" in my face when I mention Java and games.
Personally I always prefer Java, I have used other languages as well and learned programming on those.
And also a discussion about it in 2011 sounds pretty good to me and I can always reference here to point out facts and ideas that people who know what they are talking about made :) I doubt that any of those guys would change to java and it is also not a requirement.

why do you have to prove those guys that it is worth making games in java ?
if you manage to prove it will you gain something ?

or will they change immediately to java ?

Nobody’s mentioned time-to-market here which surprises me.


nehon said:
`
*myPointer->callAMethod(&myParameter);
`
Honestly what's that thing??? (note that this might not be a valid C++ call however :p )


C++ programmers live in a world where, (if they do things correctly) should be at least as fast as Java, and probably a bit faster than the JVM, as it's ultimately compliled into native executable code on that platform.

The reason people use Java (and you can tell this to your mates) is because it's a much more structured, easy to understand, and rigid framework (I know "rigid" is open to debate btw), that's scalable and is not OS specific. None of your references to pointers, pointers to references, alloc, malloc etc. You can still screw things up, of course you can, but it's the language of choice for serious development because it is so much easier to maintain and understand. It now has an excellent suite of tools such as Spring, Hibernate, and plenty of open-source applications that prove that this is the language of the future where as C++ had it's days back in the 90's when development was the resorve of the MSc students.

Cheers
Richard
1 Like