Advertisement

[java] State of Java Game Development - Topic #3: Java and DirectX

Started by June 05, 2000 11:53 AM
18 comments, last by Jerry Lynn 24 years, 6 months ago
It seems to me that using dx through Java at all runs counter to the objectives of Java as a language. A reporter on CNN refered to Java as a grenade thrown at the heart of Microsoft. The whole idea of Java probably keeps Bill up at night. Also knowing that MS wants to add windows specific extension to thier Pure Java VM leads me to believe that MS want Java dead. I might use DX for sound or input until Java catches up but I wouldn''t use it for graphics when several implementations of ogl are available. If you are not going to atleast try to maintain platform independence why use Java? I doubt that Sun is going to put any effort into support for joysticks and the like. Their is a need for some Linux-like group of volunteer programmers that will add support for non-business equipment that are low on Sun''s priority list. Full screen support is a must, and should be implemented as soon as possible.
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
That is the crux of the problem that motivated this discussion to start with. Right now there is no group developing the tools we need (such as an SDK to give us full screen support and joystick input).

Let me play the other side for a minute (to keep the conversation interesting)...

Do we need DirectX?

At this point there does not seem to be an alternative for basic parts of game development like audio and joystick input.

Commercial developers might have the resources to build massive JNI interfaces to the libraries they need, but why would they? If they are bothering with Java to begin with its for the productivity enhancements offered by Java and its cross platform capabilities. If those cost savings get swallowed by the need to build JNI interfaces for everything they are not going to bother. DirectX is already used for a great deal of game development. Why would I bother with a development tool that required me to retrain all of my employees and renegotiate distribution licenses for some other multimedia API?

From my point of view as an amateur game developer, cross platform capabilities are almost irrelevant since as a hobbyist I am fine with being bound to one platform - I am interested in the productivity enhancements to be gained from developing in Java. However, if there were a way to handle joystick input, force feedback, 3D positional audio, etc... in a cross platform way that would be great, but I don''t seem to have that option.

Until an alternative comes along (such as JMF maturing to the point to be of use for game development or some group building a viable SDK) I can see a real need for DirectX.

Comments?

P.S. I like the idea of an open-source project aimed at developing a set of tools for Java game developers. I am part of such as project right now, but we are just a couple of amateurs and what we produce out of the project is just for the pursuit of our hobbies - it isn’t going to be robust enough to be useable outside of our project.
Advertisement
Do we need DirectX? No, but a comparable API (including reasonable benchmarks) would ease development, especially 3D. The Java3D API is promising, but slow. Java 1.1.0 was not too much fun either, and given the benches on 1.3, I''m not giving up hope.

Are AWT input and Java Sound sufficient? As javanerd mentioned, 1.3 should ease the sound, but input is not the most cheerful front. I don''t expect input to change quickly. Sound and imaging are API''s used in other fields, and will be advanced because of this. Input is probably OK for most applications, so I don''t think it will be overhauled anytime soon.

So far, I''m just echoing the above posts on the biggest holes(Sound,Input,Graphics, in that order), so I would like to add this:
Many great games were written on M$ boxes before DirectX. I would argue that DirectX exists *because* of the fact that these games made M$/OS a viable gaming platform. If every game put out on Win95 sucked, we would still be using DOS, and there would be no DirectX. You want solid gaming support in Java? Deal with the holes and put out innovative titles that *prove* Java can compete with Win32. You do that and the holes *will* get fixed promptly.

On another note, a game designed in Java without platform specific code (like DirectX) can reach a wider market without porting, including Win32, Linux, Solaris, and Apple. If JVM''s are designed for consoles or arcades, which may not be too far off, you may be able to add them to the list.
Solid games that reach nearly every gaming platform without major tweaking? I''d better start lobbying the Segas of the world...
quote: Original post by Anonymous Poster

Do we need DirectX? No, but a comparable API (including reasonable benchmarks) would ease development, especially 3D. The Java3D API is promising, but slow. Java 1.1.0 was not too much fun either, and given the benches on 1.3, I''m not giving up hope.

Are AWT input and Java Sound sufficient? As javanerd mentioned, 1.3 should ease the sound, but input is not the most cheerful front. I don''t expect input to change quickly. Sound and imaging are API''s used in other fields, and will be advanced because of this. Input is probably OK for most applications, so I don''t think it will be overhauled anytime soon.

So far, I''m just echoing the above posts on the biggest holes(Sound,Input,Graphics, in that order), so I would like to add this:
Many great games were written on M$ boxes before DirectX. I would argue that DirectX exists *because* of the fact that these games made M$/OS a viable gaming platform. If every game put out on Win95 sucked, we would still be using DOS, and there would be no DirectX. You want solid gaming support in Java? Deal with the holes and put out innovative titles that *prove* Java can compete with Win32. You do that and the holes *will* get fixed promptly.

On another note, a game designed in Java without platform specific code (like DirectX) can reach a wider market without porting, including Win32, Linux, Solaris, and Apple. If JVM''s are designed for consoles or arcades, which may not be too far off, you may be able to add them to the list.
Solid games that reach nearly every gaming platform without major tweaking? I''d better start lobbying the Segas of the world...


I should probably should have signed my soapbox rant, direct all flames to ManaSink@hotmail.com

I''m wondering why everyone is taking this "its either dirty Java with DirectX or pure Java" approach when they think about game programming? My GF4J library does allow the user to use DirectX extensions under Microsoft Java, but it runs as well under pure Java environments. A game programming library can handle these things internally quite elegantly.

Allthough my library is pretty limited just because I''ve promised to support everything also under pure Java and that makes many features (like semitransparency) too hard to implement. Also one big problem is the JDK 1.1/1.2/1.3 differences, somethings you can do with one but not the other. Some non-critical things (like playing MIDI music under JDK 1.1) I just ignore and give the user a dummy do nothing implementation to work with. The user doesn''t know if the feature he is using works or not, but if he wants to he is still capable to find out...

This is the main problem with DirectX and the reason I''m a bit against it. It doesn''t help you out like that, it requires you to specify and know everything about the features you try to use. If you don''t you propably get blue screens or other nasty stuff... When I start a game project I''d like to get started as fast as possible and worry about the nittypicky details later on.

One possibility that I''ve thought about is to take a ready made game library (there is at least one available under GNU license for Win32/Unix development, but I don''t recall its name) and just make JNI wrapper for it. But this might prove to be a no-good approach as at least under JDK 1.2 the JNI calls were quite heavy operations (performance taxing). So the wrapper should propably try to minimize JNI calls in various ways.

So this shouldn''t be a plain DirectX or pure Java debate, you can have both or use some another library.
-Pasi Keranen
Someone should start creating API for Java based on all kinds of native methods. Like put together pure OpenGL, Graphics/G2D, Java3D and own Sound system plus input system. If someone *could* create that kind of API library it would kick some hard ass. I mean pure Fullscreens powered by OpenGL, G2D and J3D could increase speed very much. Also if he could drop off all kinds of useless commands and replace them with faster/better ones from one of these APIs. If it would stay clear and well document it could have great affect on Java Game development. Something like PureJavaX, but that would be hella-hard to create, so all gurus, if you want fame and respect, do that shit, shoot that bitch. If I''d be more, more, more and more experienced I would even try to create one, but since I can only create window with OpenGL I can''t even bother.

Time comes, time goes and I only am.
Advertisement
Can browsers access extensions to the language?
joeG
I am not against using dx. I am against using dx to provide functionality that will only be seen on a windows machine. Java must maintain write once run everywhere or you should just use C++. I fear that if a dx wrapper api is introduced that fragmentation is inevitable. If someone wants to implement joystick support for Java, on all platforms, and going through dx is the easiest for windows, I have no problem with that. But you have to have identical support on all other platforms. How much of a penalty do you pay to use jni? I have never used it.
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
quote: Original post by Arch@on
I mean pure Fullscreens powered by OpenGL, G2D and J3D could increase speed very much. Also if he could drop off all kinds of useless commands and replace them with faster/better ones from one of these APIs.

You are ambitious! OGL, G2D and J3D all in the same package, phew... But dropping of any "useless" (and I don't think any of those API's has any useless methods, at least not OpenGL that has been maturing for years) is not a good idea. It would just create an API that no one is familiar with and would be "almost" everything. Much like Java code is almost C++, but not quite and it confuses a lot of people moving from C++ to Java. I'd propably also drop the J3D from the list as it is the least suited API for real time gaming.

quote: Original post by joeG
Can browsers access extensions to the language?

If you by extension mean a dynamically loaded native code library, then the answer is yes if the library is preinstalled by the user and no if it was to be downloaded from the server. Also this means that the actual loading of the native library must be done by Java code that resides in the users classpath (in his machine). If by extensions you mean e.g. the ActiveX/COM object mapping that is available in Microsoft JVM, then the answer is yes, you can use e.g. the DirectX classes from the com.microsoft package.

quote: Original post by GKW
But you have to have identical support on all other platforms. How much of a penalty do you pay to use jni?

Yes that would be the ideal situation, unfortunately it requires a lot of work and what would you include in "all other platforms"? Would it be sufficient to include only the 3 biggest players (Microsoft, Linux and Apple) or would it require also support for SparcOS, OS/2, BeOS etc.? The reason there is no fullscreen support or game device input support in the Java library is that it tries to include each and every platform imaginable. In order to have the kind of support you need for games, you must exclude some platforms from the equation. And besides if this would be a just a library, then I see no harm in excluding some less popular platforms... Especially if the library would be done under GNU license, which would leave it open for porting.

But as I said, my library tries to support all the operations also under plain Java and I think that is the right way to do things. It is just that the feature set is very limited due to that goal.

The real performance penalty for JNI calls is unknown, it isn't specified anywhere. My mention about JDK 1.2's JNI being slow is based on observations from a program that uses JNI calls to communicate with native code library quite heavily. Of course there are other attributes that affect the performance, but moving from JDK 1.2 to JDK 1.3 really boosted the speed of the application and it seems that the JNI side got a good boost also (e.g. some multithreading problems started to appear due to the fact that JNI calls were processed faster than before).

Edited by - JavaNerd on June 10, 2000 5:04:41 PM
I would say that support for Windows, Linux, and apple are a solid foundation. OS/2 should be dead. The management at IBM sure wishes it was and with the anouncement of the final servies pack I think it''s day is done. What is the percentage of the market is the big three? Ninty something? That''s good enough. I doubt that many people are going to be buying a game for their sparc anyhow. Maybe you could even dump apple. They don''t feel the need to support gamers with zeal so maybe they get left behind too. Maybe it will be left up to a few hackers to support the minor platforms for their enjoyment. Someone needs to form a plan and get the ball rolling. The sooner the better. I was wondering about the penalty for jni because I run 1.3 and magician and I get some good framerates so atleast in that situation it isn''t too bad.
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson

This topic is closed to new replies.

Advertisement