Archived

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

Iwod

Java 1.5 Game programming

Recommended Posts

I am a non pro programmer compare to a lot of you in here. I do a bit of C / C++ / Java. And i am wondering what are your thoughts generaly on Java 1.5 with its new ablity and features. And its potential using it as game programming. ( i am not saying it currently can''t be done. it is just the fact that Sun doesn''t seems to care much about using java to program games )

Share this post


Link to post
Share on other sites
Time for my Java advocacy

I''m not actually using Java for games atm, but I know others who are. The only thing 1.5 adds that is really needed (that I''ve seen so far) is access to a high res timer. Other than that, 1.4 is suitable for games right now without the parameterized types and whatever else is in the pipe for 1.5 (although I''m sure there will be even more improvements in the HotSpot compiler by then).

The thing that''s stopping me from going Java right now is distribution. I want to get shareware titles distributed on the net, and the currently there are issues with making sure the customer has the JRE. There are various solutions (including compiling to a native executable format, but that raises even more issues). Several folks are forging ahead already.

Check out:
YoHoHo! Puzzle Pirates (a really neat game!) - they have chosen to include the JRE in the client download.
Alien Flux - Puppy Games has experimented with different method of distribution for this game (native exe, WebStart)

Other games to check out through Google would be Wurm Online, Magicosm, and Tribal Trouble.

I think all of these games show that Java is viable for game dev, and 1.5 can only make it moreso. As far as Sun not caring, that''s not true anymore. They got on the ball a while back with the Java Gaming Initiative. As a result we today have javagaming.org, which has been folded into Sun''s new www.java.net site. There you''ll find 3 Open Source APIs designed for realtime multimedia(JOGL - OpenGL interface; JInput; JOAL - OpenAl interface), you''ll find forums for LWJGL (another OpenGL/OpenAL/system input interface - but specifically for games, with no dependencies on AWT/Swing - from Puppy Games) and Xith3D, a SceneGraph that can set on top of JOGL or LWJGL, designed to be a replacement for Sun''s Java3D.

If we can get the distribution issue solved, get the kinks worked out of OpenAL on Mac & Linux, and get that JRE installed on most of my target market''s machines (something that Sun is actually making headway with), then I''ll definitely make the switch (providing it all happens before D reaches maturity ).

Share this post


Link to post
Share on other sites
quote:
Original post by Iwod
I am a non pro programmer compare to a lot of you in here. I do a bit of C / C++ / Java.

And i am wondering what are your thoughts generaly on Java 1.5 with its new ablity and features.
And its potential using it as game programming. ( i am not saying it currently can''t be done. it is just the fact that Sun doesn''t seems to care much about using java to program games )


Java? ah ah ah! Nope. Do you want graphics in your game?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''v heard that Sun is writing OpenGL support to Java. True?

Share this post


Link to post
Share on other sites
quote:
Original post by OrangyTang
Already exists in both LWJGL and Jogl, both of which work great and are very fast indeed


This is relative... you can achieve with java NOW the some performance as in 1997... about 20 times slower.

Share this post


Link to post
Share on other sites
quote:
Original post by Lorenzo
This is relative... you can achieve with java NOW the some performance as in 1997... about 20 times slower.


You never tried the direct3d-driver did you? In fact, you haven''t tried java at all, have you?

Share this post


Link to post
Share on other sites
Lorenzo, wake up Go out and download some of the latest 3D Java games. The language has come a long way since 1997. It isn''t slow anymore and is more than suitable for games.

Share this post


Link to post
Share on other sites
quote:
Original post by Lorenzo
This is relative... you can achieve with java NOW the some performance as in 1997... about 20 times slower.


I''d recommend that you learn to respect others and their choices.




[Cyberdrek | the last true sorcerer | Spirit Mage - mutedfaith.com][ Administrator & WebMaster GuLSE]

Share this post


Link to post
Share on other sites
quote:
Original post by Iwod
I am a non pro programmer compare to a lot of you in here. I do a bit of C / C++ / Java.

And i am wondering what are your thoughts generaly on Java 1.5 with its new ablity and features.
And its potential using it as game programming. ( i am not saying it currently can''t be done. it is just the fact that Sun doesn''t seems to care much about using java to program games )


It is more than possible to code games in Java. It supports the same APIs as other languages heck, even SDL exists for Java. And it''s even simpler to use than it''s C/C++ counter-part. I''m not involved in game programming at the moment but I did have a chance to try out the java version of SDL for a graphical interface I was building for an internal projet.


[Cyberdrek | the last true sorcerer | Spirit Mage - mutedfaith.com][ Administrator & WebMaster GuLSE]

Share this post


Link to post
Share on other sites
I''m about to start a project in Java to do a remake of the 2D Gauntlet for my final year project, i''ve been doing a lot of research on Java''s viabiltiy, 1.4 is more than viable especially with the NIO packages for low - level high preformance block & stream I/O really sugest you check it out and ImageIO packages for advanced imaging. I''ve been doing some messing around with JOGL i done a little test with applets. I checked how much CPU was being used first with Java3D and then with JOGL. Java3D used about 70 - 80% of the CPU was used but when i used JOGL only 5-10 % was being used! it was to 3D Object repeatedly spinning around, i couldn''t even believe i got it to work in an applet.

So i thinking of ways to do this game using JOGL, JOAL, etc and applets cos i have some ideas i wanna try out the only problem is trying to get the jar and .dll files on to the client.

Share this post


Link to post
Share on other sites
quote:
Original post by OrangyTang
Bleah, no one writes applets anymore - Webstart is a more flexible and powerful alternative (and runs direct from a webpage as well ).


I know that, but like i said above, i have some ideas i wanted to try out. I''ll most probably be using webstart so you can switch into fullscreen mode

Share this post


Link to post
Share on other sites
Java will probably never match native C/C++, but if you can write something in Java then do so, altho the step from Java to C/C++ isnt THAT big. Yeah we have JIT so what? JIT still requires more CPU then native C code trust me.

- Damage Incorporated.

Share this post


Link to post
Share on other sites
Step from C to Java is big. Just dont forget all that code that would be much easier to transform to v3 of your program after few years when you''d like to do sequel.
JIT need just more computer power on start and it''s in just millisecond range. Possibility to get rid of windoze at any time is nice thing, you know.
I have seen program in Java that was considerably faster than C one. It did something with a graphic... Just don''t forget if you''d like to be really fast you should try hand optimised IA64 assembler.

I think that major advantages of Java were getting rid of: h files, preprocessor, and ugly syntax.

Share this post


Link to post
Share on other sites
The problem with many of these discussion is that most folks forget optimisation lessons they should know.

In C/C++ or any other lowish level language.

Algorithmic optimisations can get you running order of magnitudes faster (linear vs binary search). Unless you''re doing something seriously stupid in your code it is highly unlikely that you can get this much from a assembly optimisation.

This carries forward with languages such as Java. In Java chances are you can develop your program much faster and have it up and running and tested well before the C/C++ equivlent and I mean EQUIVALENT! That means cross platform compatibility and so on.

The thing is that you could spend a lot of that extra time optimising if you have issues, rather than hunting bugs down and so on. IN the SAME amount of time you could likely make many gains that would either come close, on par or much further than your lower level language counter part.

Share this post


Link to post
Share on other sites
quote:
Original post by __fold
quote:
Original post by Lorenzo
This is relative... you can achieve with java NOW the some performance as in 1997... about 20 times slower.


You never tried the direct3d-driver did you? In fact, you haven''t tried java at all, have you?


I have tried java, and I have tried C# and c++ too. C# is decent, due to its support from microsoft with managed DirectX. java... well, maybe for cell-phones

Share this post


Link to post
Share on other sites
quote:
Original post by Aldacron
Lorenzo, wake up Go out and download some of the latest 3D Java games. The language has come a long way since 1997. It isn''t slow anymore and is more than suitable for games.


Give me a link, then, please...

Share this post


Link to post
Share on other sites
I already posted 2 earlier in the thread, but I''ll recreate them here along with some more:
YoHoHo! Puzzle Pirates
Alien Flux
Wurm Online
Magicosm
Tribal Trouble
RuneScape

You can find more at the java gaming forums

Several commercial games have been released over the years that use Java in one capacity or another - from scripting, ''dirty java'' engines, and 100% Java games. Law & Order falls into the 100% Java category.

SO please, check these out, try them out, and whether you use Java or not - stop spreading that tired, old, Java is too slow myth!

Share this post


Link to post
Share on other sites
quote:
Original post by Lorenzo
quote:
Original post by Aldacron
Lorenzo, wake up Go out and download some of the latest 3D Java games. The language has come a long way since 1997. It isn''t slow anymore and is more than suitable for games.


Give me a link, then, please...



Well, my terrain engine pushes only around 15 fps slowe in Java(C++ from 170, java 155), so it is not that bad.

Thats actually pretty good when taking into amount that I''m pushing the max triangles with my graphics card.

Share this post


Link to post
Share on other sites
quote:
Original post by Aldacron
I already posted 2 earlier in the thread, but I'll recreate them here along with some more:
YoHoHo! Puzzle Pirates
Alien Flux
Wurm Online
Magicosm
Tribal Trouble
RuneScape

You can find more at the java gaming forums

Several commercial games have been released over the years that use Java in one capacity or another - from scripting, 'dirty java' engines, and 100% Java games. Law & Order falls into the 100% Java category.

SO please, check these out, try them out, and whether you use Java or not - stop spreading that tired, old, Java is too slow myth!




Ok, I tried them.
YoHoHo! Puzzle Pirates, and Wurm Online impressed me quite much. Java is not as slow as I believed (or maybe as slow as it was when I tried it some years ago).

However, there are two facts that support my opinion that Java is too slow for today games.
1) Wurm Online 3D engine is OK, but Quake III engine (a 1997 engine) looks better: more polygons, more effects
2) are pixel/vertex shader available in java?
3) are you able in java to render a 48 million (yes, million) polygon scene?

if most commercial games use, for 3D engines, c/c++, maybe there's a reason... 3D programming is such a real-time critical application that some programmers rewrite the STL library by themselves to gain some performance. Can you do this in java? I don't think so... maybe using JNI, but then is C programming...

I have a question: how do you deal with the GC?

And, just to clarify: I'm not against Java in every part of the game: for AI, scripting, net it would be great (I prefer C++, even for scripting, but this is my personal preference), I just state that for high level 3D games (i.e. the 90% of today games) java is too slow.




[edited by - Lorenzo on October 17, 2003 3:57:04 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Lorenzo
This is relative... you can achieve with java NOW the some performance as in 1997... about 20 times slower.
Even if this was true, it wouldn''t matter. The original poster is a non-pro game programmer. He probably wants to make games as a hobby and he''s not going to make a Doom3-killer. So even if he could ònly archieve 1997 graphics (as in Quake 2, released 1997), that would be brilliant for a hobby project. If Java makes him work faster, spend less time finding bugs, he may even finish his hobby project some day. On these boards there are lots of newbies who want to optimize (crappily) everything in C, and then they create a featureless tetris or worm-game that would run on a 386/12 MHz. What''s the point of that, huh?

Share this post


Link to post
Share on other sites

OpenGL has vertex/polygon things so look at it OpenGL is avilable in Java, after downloading LWJGL or JOGL.

one polygon could be 64 bytes 64*1200*1050 is over 64 MB my graphic card has 32MB so it''s kinda pointless to create as much especially if you monitor could display it only with transparency.

cite from design more than mill stars with up to 20 planets around them on that planet 1000 armies with over 10000000 warriors in each army trying to kick other''s butt.

I do it in Java and don''t consider it too slow.

I must admit that I designed it to be top even after several years. As single person development it will take more than 2 years.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
quote:
Original post by Lorenzo
This is relative... you can achieve with java NOW the some performance as in 1997... about 20 times slower.
Even if this was true, it wouldn't matter. The original poster is a non-pro game programmer. He probably wants to make games as a hobby and he's not going to make a Doom3-killer. So even if he could ònly archieve 1997 graphics (as in Quake 2, released 1997), that would be brilliant for a hobby project. If Java makes him work faster, spend less time finding bugs, he may even finish his hobby project some day. On these boards there are lots of newbies who want to optimize (crappily) everything in C, and then they create a featureless tetris or worm-game that would run on a 386/12 MHz. What's the point of that, huh?


I agree it would be silly to do unnecessary things as that. Speed micro optimising is effective AFTER you have your game partially runing, or after you are sure that simple alorithm would be runned often and could be hindrance.

BTW 386 --- 25 ,33, 40.
486 -55 66 80 and higher

[edited by - Raghar on October 17, 2003 3:42:59 PM]

Share this post


Link to post
Share on other sites