[java] Reasons to make games in java?

Started by
20 comments, last by ARCHIGAMER 23 years, 11 months ago
Java is good for web applications, however because it is cross-platform it lacks the speed necessary for a real time or even 3d game. I have taken 3 semesters of college dealing only with Java and when you compare the ability to have predesigned classes with slow speed to the fast, low-level programming of C or C++ but having to write most of the code yourself, C and C++ beat Java way out. Java3D isn''t all its cracked up to be simply because of the independence it has over C or C++, Java3D in its current state can only run about 1 frame per 15 sec on a simple block on a pentium 100 with 16 meg of ram. granted it has no 3D accelerator but i enjoy some of the old top dowm games that still run on my old boxes.

So if you ask me, I feel, weighing all the pros and cons, C or C++ works better than the current Java version. Now thats not to say it won''t get better but for the time being Java just doesn''t cut the speed needed for descent games.
Advertisement
In my own opinion, nothing beats C++ if you want to create "state of the art" games. I used JAVA for a whole year and all these pre-implemented classes where very useful but in fact, writing such classes ("list" or "hashtable" for example) don''t take you so much time, compared to a 2-3 years project. Moreover, you''ll just have to write once if you code it well.

If I had to make a "little" game with network support, i would use JAVA, because you can make little apps very quickly. But if i had to create a huge game, JAVA wouldn''t be so useful.

Even with new librairies, JAVA is REALLY REALLY SLOW!

So, what could you do with JAVA ? For now, i''d say "little game" (not professional) or games which needn''t great power (turn based strategy).



Prosper / LOADED corporation
Java is slow on graphics, other than that it''s almost as/equally fast as C++. I''ve heard some people say that some of their apps have been faster in Java (due to aggressive inlining at runtime etc.) but I haven''t seen any examples of that.

The great thing about Java for me is that it reduces the development time. Sure, you can write small apps in C++ that speed up the graphics in Java etc. but I think it would
be painful to write a whole big app in C++. I used to do C/Asm programming and some C++ but for the last 4 years I''ve been doing Java exclusively and I really don''t feel like ''going back'' to the earlier languages. The project I''m working on right now is really big and it would have taken A LOT longer in C++.

Java3D does seem slow but Sun also says that it wasn''t designed for gaming and recommends using other lower-level API''s for that purpose. Anyone tried the packages that adds OpenGL bindings to Java? They are supposed to be a lot faster.

About decompiling Java. Just run your program through an obfuscator and no one will have fun trying to decompile your code. Many optimizers will also replace your variable strings with numbers or shorter strings that take up less space, that will make reading decompiled code harder.

Henry

Cuss I can....
Yeah, I''ve seen Java that was run through one of those "obfuscators". I still could figure out the code with a little work. The one I saw used the same name over and over ("p" normally) and relied on overloading to keep the functions appart (some classes had "void p()", "double p()", "double p(double p, double d)", etc.)

The code I was looking at was the only sample of IK I could find. After a couple days of renaming variables and functions, I had the entire thing figured out.

E:cb woof!
E:cb woof!
"Heh if you think you can escape pointers in Java you are dead wrong"

- A pointer is NOT the same thing as a reference. The practical implication is that you cannot cause subtle and hard-to-find bugs through improper memory allocations and deallocations with a reference.

"Java is good for web applications, however because it is cross-platform it lacks the speed necessary for a real time or even 3d game"

- If you are referring to writing a 3D engine in Java then I would have to agree. But if you write a game in C++ you’re probably going to use some graphics API like DirectX or OpenGL. If you were writing a game in Java you would do the same thing. With DirectX or OpenGL handling your graphics you should be able to easily muster enough performance for a real-time game. 3D games like FPS''s might still be out of reach simply because of the amount of calculations required for collision detection and the like. I am just starting my OpenGL based game in Java, so I don''t have a lot of results on performance yet.

I wrote a Java 3D game and even with simple scenes the memory requirements were horrible. I also could not resolve the periodic ''freezing'' that I think was being caused by garbage collection. Of course, I am fairly new to Java 3D, so it may have just been my lack of experience with it. At this point I am writing Java 3D off as a solution until a few more revisions have come out.
If you don''t think Java''s fast enough to do a simple 3D game, check this out:

http://members.aol.com/edhobbs/applets/index.html

They''re not FPS''s but they''re well written 3D programs.

E:cb woof!
E:cb woof!
Bah, I beg to differ a on the pointer vs reference.
It IS a pointer. You can say String x = new String("FOO");
and String y = x;
y is now a pointer to x essentially and x is a pointer to
a memory location containing sting object FOO.
You cannot get the actual memory location it is pointing to directly, but that is what it is =)
Ugh i mean x and y both point to memory location holding string "FOO" =P
Eventually, Java(or something else, whatever) will replace C/C++. (probably VB on Windows though, thanks to its new OO structure) because of the gradual evolution (ASM,Cobal,Fortran,C/Pascal,C++,VB/java) many said that C would never replace Assembly(at least according to books ive read) because of its speed at the time. Eventuall, genuine full fledged applications will probably be programmed in some derived language (such as HTML), with lower level languages such as C/C++ replacing the ASM optimizations currently used when programming C or C++.
Whatever,
Etnu

What is a man without goals? A dead man.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

This topic is closed to new replies.

Advertisement