• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# [java] I am sick and tired of prejudism!

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

32 replies to this topic

### #1felonius  Members

Posted 15 June 2000 - 12:45 PM

When I talk with people about gaming they often laugh when I tell I use Java. I am sick an tired of it and are now trying to educate people a little. I have therefore written this article, which I will post more places later. First, though, I would like to know any of you here have any comments and corrections that can be made to the subject. The article is here: http://www.marner.dk/articles/WhyJavaCanBeUsedForGames/index.htm Jacob Marner Edited by - felonius on 6/25/00 8:27:19 AM

### #2Jim_Ross  Members

Posted 15 June 2000 - 03:53 PM

I usually just smile inwardly and stop talking to people like that.

In a passing note, I''ve started doing stuff with enhydra app server (www.enhydra.org), and it seems to be the _fastest_ thing for web applications i''ve seen to date (faster than cold fusion, asp 2 & 3, php4). I''m going to do more concrete benchmarks this saturday.

### #3nes8bit  Members

Posted 15 June 2000 - 05:07 PM

YOU feel terrible! YOU feel terrible??? You should read my posts. When I even hint that I don''t use C++ people start telling me how freeking great C++ is. I wish I could tell them to stick that C++ up their a. Well sorry for that complaint, but you''re not alone.

------------------------
Captured Reality.

### #4SeanHowe  Members

Posted 15 June 2000 - 05:23 PM

Well, I use C++, and I can tell you, all other languages suck!
In case you couldn''t tell, I''m being sarcastic. Although it is true that I use C++, there are definitely advantages to using any language(well, ok, *most* languages), and, as I always say, to each their own.

### #5Syntax  Members

Posted 15 June 2000 - 05:23 PM

well...I am not saying this to start a flame war or anything but... C and C++ quite simply is a better language. By saying that though I do not mean to imply that Java is not a good language..It has some really good qualities to it that C/C++ does not have..once again though C/C++ has some good qualities that Java does not..It really depends on what your current project requires..but most people do not like Java because it is inheritantly slower..because of that C/C++ will be the language that most people choose for quite awhile.. I prefer C/C++ because it is faster, and more suitable for games..
When someone says something bad about you using Java..they are not taking into account what reasons you may have for using Java..and they are in a sense choosing to be ignorant..
In my short excistence on this planet I luckily have gotten use to ignorance and stupidity..if I were you, I would adapt..

-Lucas
-dieraxx@iname.com

### #6Bracket  Members

Posted 15 June 2000 - 05:35 PM

This thread inspires the thought "oh, for Goodness'' sake, GROW UP (and study some basic CompSci theory)!" Java, C++, (Visual) Basic, COBOL, LISP, FORTRAN, Python, Pascal, Ada, and almost any other language out there has merits and demerits for a particular application. There IS no right answer when it comes to choosing a language - and there will continue to be no right answer, as new and improved languages are arriving all the time. [Tim Sweeny wrote a really good article on a similar topic a while ago, I think it was on Gamespy].

### #7felonius  Members

Posted 15 June 2000 - 06:51 PM

To Syntax,
Did you actually read the article or are you just posting out your usual opinions?

To Bracket,
I think we all here know that you are right. Every language has its advantages. I am myself a great fan of both ML and Oberon-2, but the issue here is whether a certain language is useful in game development of professional class games.
Here C++ is the standard everything is mesaured by and when starting out a new project the choice of language is quite an important design decision to make. Afterall, no matter how I do it I cannot use ML for games. The only real alternative to C++ at the moment is Java - and that is why the issue is discussed.
The people that I talk about that dislikes Java often like it as for web applications but not games. That is what I trying to change.

Jacob Marner

Note: I edited the article to correct a few typos and make it clear that it is not about language flaming.

### #8Captain Goatse  Banned

Posted 15 June 2000 - 08:00 PM

Well, if somebody despises me when I tell I''m using Java, I ask them what they have done with their Super hyper coooooooooooooooooooooooooooooooooooooooooooool language. They show me something crappy like tetris, but when I bring my Isometric engine made from simple polygons(noone knows that) they usualle get very amazed. They probably thought that I''m pummeling with crappy applets while they are trying to instal Direct X. Those who usually doubt Java are somewhat newbie programmers without much experience, because usually better programmers know that every language has it''s pros and cons.

Time comes, time goes and I only am.

### #9Ingenu  Members

Posted 15 June 2000 - 09:12 PM

I know C/C++, JAVA, BASIC, PASCAL, OO PAscal (in delphi) ....
And I can tell that I prefer JAVA for the OO things, but I prefer C for speed... and euh... well c++ is really bad, even if I use it.

In fact if I use it it''s by lack of better language, a faster JAVA for example.

-* Sounds, music and story makes the difference between good and great games *-

### #10blue-lightning  Members

Posted 16 June 2000 - 08:14 AM

I have extensively used both Java and C++. I do agree with you that a decent game can, and probably has been written in Java. Although I think that a fast graphic intensive game would require some JNI. So the only real advantages I see in using Java for a game is its cross-platform capabilities, and possibly faster development.

C++ can be more that 10% faster than Java. It depends how you use C++. I personally use it to somewhat break the rules. Most of this comes from using pointers in whatever way I feel like using them. For example all those get and set functions actually take CPU time! In C++ protected and private only stop beginners. Then there are some examples that I have found that can''t be easily translated into Java.

1.Casting. Java does not let me cast an array of primitives into an array of a different kind of primitives. There is no security flaw involved in it. I know that big endian and little endian would represent it differently, but I could have used a switch to make up for it. So what do I have to do in Java to emulate this? Loads of shifting and oring.

2.Good string manipulation. I am fairly sure that Java''s string class like most others actually copies the data when I want a substring. Again a little pointer arthmetic, and in this case sometimes saving the string length is what I would do in C. And why both with having 2 seperate string classes?

3.Seccurity restrictions, and exceptions. I get sick of having everything I do get check with system to see if its all right. Especially with those out of bounds exceptions. They are incredibly slow. They are good for debugging, but eventually I know that I''m not going to go out of bounds.

I do agree that in all of those instances JNI does solve the problem. Then your code isn''t platform independant; there goes one of the main reasons to use Java. And of course if you are making an applet you can''t even use JNI.

I also agree that most programmers using C++ can easily mess it up, and they should be using Java. But for advanced programmers who program closer to the CPU''s architechture, C++ is much better. When I tell Java programmers to grow up and use a real language, I mean get out of the sandbox and break some rules!

### #11felonius  Members

Posted 16 June 2000 - 10:46 PM

To blue-lightning:

I think we both agree that 100% pure Java is useless for commerical-class games and that some kind of JNI (or other native support) is needed.

And sure, a finely tuned and hand optimized C++ program can never be outrun by a Java program no matter how clever the Java compiler is.

As you can see in the article I actually propose that C++ are used for for all the parts where speed is absolutelty essential (and we need to "break the rules"). May point is that too many people are using C++ too many places where it is not needed.
There is no need to finely tune every single line of the control code of your game, because it not is run as often as, for instance, the graphics routines. If you break the rules with every line of code all over your program you are building yourself a "bug-bomb" that is completely unmaintainable. (Just look at all the bugged games apprearing every month)

So in conclusion I think it is just as stupid to build a program in pure C++ as it is to build it in pure you. So to all the C++ programmers out there: Grow up and and learn how to save time!

Jacob Marner

### #12NeilArrow  Members

Posted 20 June 2000 - 12:32 AM

Surely it''s ownly a matter of time until someone comes up with a much faster Java virtual machine though. I''m sure that the gap between Java and C++ will get smaller, and less significant when we have faster processors.

I prefer to use Java becuase it just feels "tidier" and more OO.

Neil

### #13ncsu121978  Members

Posted 20 June 2000 - 12:47 AM

I am sure they will make faster java virtual machines but i dont think it will ever reach the speeds of c or c++.....why ?
because c++ generates machine code when run through the compiler that gives instructions to the cpu.....java produces a different kind of code when compiled......it produces code that is run through the virtual machine, translated into the machine code for that operating system, then that translated code gives instructions to the cpu.....or at least this is how I understand how java works (I am not too familiar with java, YET)....
so there is always that buffer layer there between a java produced executable (i dont think java calls there''s executables but since I dont remember what they call it this will suffice) and the cpu whereas c++ executable gives instructoins to the cpu without going through that buffered layer

"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

### #14Captain Goatse  Banned

Posted 20 June 2000 - 04:59 AM

But doesn''t virtual machine convert byte code machine code once, before everything else, not all the time, so it would make sense that once there could be VMs which could be able to create as fast as C++ code.

Aah Quest for the holy grail

"NI"
-A Knight who says NI

### #15Joviex  Members

Posted 20 June 2000 - 06:50 AM

quote:
Original post by ncsu121978

I am sure they will make faster java virtual machines but i dont think it will ever reach the speeds of c or c++.....why ?
because c++ generates machine code when run through the compiler that gives instructions to the cpu.....java produces a different kind of code when compiled......it produces code that is run through the virtual machine, translated into the machine code for that operating system, then that translated code gives instructions to the cpu.....or at least this is how I understand how java works (I am not too familiar with java, YET)....

Well, then you honestly shouldn''t say what you don''t know. Java does indeed have a native compiler. However, using it, like in C++ causes the distributed file to only be "runnable" on one platform (the compiled one). Thus, Java is portable because of the JVM, not limited by it.

"Five passengers set sail that day, for a three hour tour, a three hour tour...."

### #16ManaSink  Members

Posted 20 June 2000 - 10:51 AM

ncsu121978 - FYI, there are static native compilers that generate 100% machine code for a target machine at compile-time, JRE''s with JIT compilers that generate a good deal of local machine code at load-time, and Sun''s HotSpot which generates machine code dynamically in response to bytecode execution frequency during run-time.
This ain''t your pappy''s bytecode interpreted language anymore.

Personally, I think if your posting in the Java Development section you think one of three things:
A) Good games can be written in Java.
B) Statement A is impossible, so you''re just trolling. If reading this one pissed you off, why are you still here? Didn''t your momma tell you to stay away from those strange Java programmers? Get out of here before I open up a can of Shaq-Fu on your pesemistic rear-end.
C) Neither. I hope it''s because your really cautious about adopting new technologies and not because your emotionally disturbed and unable to commit. Maybe your really the guy from statement B, come back for another butt whoopin''. That''s fine, I got the rest of the Shaq-Fu six-pack right here.(click,pkkksssss....)

Seriously, Shouldn''t everyone here should agree with felonius on some level? It''s not about the language, it''s about the final product. I''ve coded games in ASM, C++, Java, COBOL, Pascal,Basic, and the only language I thought sucked for games was COBOL, but damn it, no language should be excluded without a personal attempt!

ManaSink

### #17revolver  Members

Posted 20 June 2000 - 10:56 AM

Check out what I found in the EULA for the platform SDK:

quote:
8. NOTE ON JAVA SUPPORT. THE SOFTWARE PRODUCT CONTAINS SUPPORT FOR PROGRAMS WRITTEN IN JAVA. JAVA TECHNOLOGY IS NOT FAULT TOLERANT AND IS NOT DESIGNED, MANUFACTURED OR INTENDED FOR USE OR RESALE AS ONLINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATIONS SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF JAVA TECHNOLOGY COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE. Sun Microsystems, Inc. has contractually obligated Microsoft to make this disclaimer.

### #18ImmaGNUman  Members

Posted 20 June 2000 - 11:16 AM

Its agreement #12 in my EULA.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

### #19Captain Goatse  Banned

Posted 20 June 2000 - 11:24 PM

I found something like that in one example althought it said you can''t use it in navigation systems or nuclear power plant.

I knew that hippies weren''t useless. They created JAVA!

Time comes, time goes and I only am.

### #20Icculus  Members

Posted 21 June 2000 - 12:45 AM

I got a kick out of that warning too. But come on, if your language is only 5 years old with updates coming all the time, it can''t be trusted with people''s lives. Obviously code that entrusts millions of peoples lives(like nukes) needs much more extenstsive testing then a game applet on the web.

Yeah felonius what''s with the resistance towards Java? I think C++ programmers would be happy that the progressive language would have C++ syntax. I sure was. For blue lightning''s pointer problem, I used to do freaky things like this in C++ too, but now in Java see no need to do this, and I am doing much crazier stuff. It''s just once you get used to the object oriented process of designing a java program and the useful features of the language you don''t need to get so complicated to do simple things. Anything''s possible with java. Higher level programming is where it''s at. In a couple of years when machines can handle anything who wants to be stuck coding low level stuff thats been done a million times before? And with so many OS''s and platforms you don''t want to limit yourself to just one OS. Think about this, in a couple years when the average computer can do millions of polys per sec in Java. C++ might do more but once you get to a certain point you have the power to do a awesome game if you have a good idea.

Personally I can''t wait since I hate optimization. I''d rather spend my time writing readable cross-platform code that has more features.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.