Archived

This topic is now archived and is closed to further replies.

felonius

[java] I am sick and tired of prejudism!

Recommended Posts

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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
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 *-

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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)
I say: Use Java for those parts and you get the best of both worlds.

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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I just read the article and everyone''s comments and I think I need to say something. Seeing as how this is a Java forum, I''m probably wasting my time, but here it goes.

The article mentions several "advantages" java has over C++:

>> No need to remember to deallocate data - so there are no memory leaks.<<

Garbage collection can be done in C++. Write garbage collection routines once and then forget about it. However, a good programmer should be able to remember to deallocate memory.

>>A library of easy-to-use objects, such as strings, lists, and queues. C++ has STL but STL is not integrated well with most libraries so C-style strings are still needed a lot.<<

C++ is now standardized. The STL implementations will only continue to get better and faster and more programmers will use it. C-style strings are hardly needed unless you''re doing a lot of string manipulation at speed critical times... but how often is that?

>>Forget all about pointers. Java does not support them. In fact, Java uses protected references so you cannot make references to illegal data<<

Why would you want to forget about pointers? Sure, they can be dangerous if you don''t know how to use them, but they are very powerful and very useful.

>>Java is a much simpler language. C++ is getting bigger and bigger and strange details keeps popping up that I never cared about. Java has a very clean syntax and no strange details. <<

This argument holds absolutely *no* weight because you failed to mention what "strange" details you are referring to. Please tell us.

>>I have read articles boasting about productivity gains of about 40% by using Java over C++. I am not sure about these numbers, but it true that Java increases your productiveness both by increasing code writing speed but also by reducing the number of bugs.<<

Bugs occur in every language. So far, the only thing Java has going for it is its cross platform compatibility, and garbage collection. Both can be done in C++ easily (and you get the speed that comes with C++).

Real speed in development comes with code reuse. This is something that the game industry needs to realize... Stop remaking the graphics engine for every game you make!


Java is still in its infancy. Perhaps in years to come Java will become more suited for game development than other languages and I will make the transfer. However, C++ has so much going for it, so that day is far off in the distance.

Share this post


Link to post
Share on other sites
I thought that article was pretty good. I heard something about Java 2. I was wondering if anyone knew what it is, and how it is different from regular Java?

t2sherm ô¿ô

Share this post


Link to post
Share on other sites
What r u guys arguing about? Everything is good for its purpose. Java, C and C++ have completely different purposes. Even C and C++ are completely different in a sense that the architecture of your applications is nowhere near the same. Java is mostly good for web-based application, server side web application, or truly protable GUI applications. There are other uses, but writing games is not one of them. C++ on the other hand sucks at some things where Java kicks ass, but C++ surves its purpose for games way better then Java.

I am not prejudiced. The game I''m working on now, I wrote part of the server on Java, because it seemed to be a good solution. But writing games on Java just because "Java is superior", or because u''re a fanatic is simply stupid.

Share this post


Link to post
Share on other sites
I like DOS batch files and Quick BASIC. I use it all the time.
Script files are also great, but nothing''s better than the FTP prompt. At the moment I''m using this for pentium optimizing my initialization procs.
I''m planning on using Perl for supporting multiple 3D gfx accellerators, when using my SQL optimized pahtfinding.
I used to do animations with Cobol, but framerate was too high...



Share this post


Link to post
Share on other sites
quote:
Original post by t2sherm

I thought that article was pretty good. I heard something about Java 2. I was wondering if anyone knew what it is, and how it is different from regular Java?

t2sherm ô¿ô



Java2 is Sun''s brand name for their current implementation of java. It started with version 1.2.2 and includes the newest version of java, 1.3. Yes, 1.3 *is* Java2. It confused the hell out of me until I thought about what my company''s marketing dept. does on a daily basis (shudder).

So, as far as I know:
Java2 == Sun''s JDK/JRE v. 1.2 through JDK/JRE v. 1.3

ManaSink

Share this post


Link to post
Share on other sites