JOGL, Java3D, Xith3D or LWJGL? Complete n00b.

Hi there, I have a game on the drawing boards that was originally intended to be 2D using sprites. However, I think that perhaps it would be better if it was 3D OpenGL because then it would probably run faster (through graphics card and not CPU right?), as well as allow for cool special effects and allow me to make the models in 3D modeler applications, right?

Now, I’m a complete newby when it comes to OpenGL, and I’m also currently still learning Java. However, once I finish with the basics, I’d like to choose a library to base my work on. So what would you recommend to me and why? Which library is better? Which has more promise? And which is easier to learn, yet powerful?

The game will not really use the 3-dimensions, as it will be a top-down view, and all players will be on the same z-axis, but I think that OpenGL would give me advantages over Java 2D (right?).

Thanks for any help.

Sounds like LWJGL is the library for you: Small, easy, reliable and fast :slight_smile:
An alternative is JOGL/JOAL/JINPUT, which is basically the same thing (a few differences aside) but much larger.
Java3D is not the most suitable tool if you basically are going for 2D games. Xith3D is a java3D alternative geared towards gaming, and uses jogl or lwjgl for rendering.

You could still go for java2D, but you should be prepared for some things:

  • You can’t depend on that it works fast on any machine (although on windows it can be pretty quick if you get everything to be accellerated).
  • You have a lot less bells and wistles to play with compared to openGL for creating eye candy.
  • You are tied to 2 dimensions. If you want 3D stuff (even though the gameplay is 2D), you need openGL.

[quote]Sounds like LWJGL is the library for you: Small, easy, reliable and fast :slight_smile:
An alternative is JOGL/JOAL/JINPUT, which is basically the same thing (a few differences aside) but much larger.
Java3D is not the most suitable tool if you basically are going for 2D games. Xith3D is a java3D alternative geared towards gaming, and uses jogl or lwjgl for rendering.

You could still go for java2D, but you should be prepared for some things:

  • You can’t depend on that it works fast on any machine (although on windows it can be pretty quick if you get everything to be accellerated).
  • You have a lot less bells and wistles to play with compared to openGL for creating eye candy.
  • You are tied to 2 dimensions. If you want 3D stuff (even though the gameplay is 2D), you need openGL.
    [/quote]
    Thank you for the really informative reply. A couple last questions:

I have Strata 3D Pro and would like to use it to create the player models for the game, can LWJGL import models? I noticed that Xith3D can import them, and if it uses LWJGL what’s the reason that you didn’t recommend it?

[quote]I noticed that Xith3D can import them, and if it uses LWJGL what’s the reason that you didn’t recommend it?
[/quote]
No reason at all; I should have recommended taking a look at it :).
I never used Xith3D myself, but it seems like a really great API and I’ve seen it produce very good results.

LWJGL is just one level above driver level - it’s very bare metal. If you need higher functionality, you’ll be wanting to either write your own or use someone else’s stuff like Xith or jMe.

Cas :slight_smile:

Hey, this is the Java3D forum! So could someone please suggest to use Java3D?

[quote]Hey, this is the Java3D forum! So could someone please suggest to use Java3D?
[/quote]
Actually, after reviewing my choices, I’m now down to either Java3D or Xith3D and need help deciding. I like Java3D because it is very well supported and documented and has a lot of utilities and such for it to import models. Xith3D on the other hand lacks documentation but seems geared specifically towards games.

Also, in order to use Java3D do I need to know OpenGL well? Because currently I have very little knowledge of it.

Are there any spcific problems/disadvantages to using Java3D? And finally, does Java3D use OpenGL under-the-hood for all its graphics work (it is hardware accelerated right)?

Using Java3D doesn’t require any OpenGL knowledge. It CAN render to OpenGL, but theres also a DirectX binding. But on the Java3D API level, you cannot tell the difference.

The problem/disadvantage of Java3D is that is wasn’t made for games. It is highly multithreaded and a bit unpredictable. Hard to get stable framerates. (See FlyingGuns to know what I mean).

So for fast paced shooters like AlienFlux that rely on a constant 60FPS, Java3D might not be a good choice.

Also, Java3Ds focus is on scalability. The downside is that it performs bad on small problems.

I’d watch at some samples and classify your game.

  • many 2D games run very well with Java2D
  • for games like AlienFlux, head for JOGL/LWJGL
  • for games like FlyingGuns, you need more infrastructure, head for Xith3D/Java3D

Xith3D is based on Java3D, which means that if you learn to use Java3D with all the documentation and tutorials available for that you should be able to pretty much translate it directly to Xith3D.

I think that Java3D is a really good learning environment for exactly the reasons you mentioned. Once you have the skills they are pretty much transferrable.

I personally found openGL to be far easier to learn than java3D’s scenegraph stuff. Given that the author is a newbie who intends to do a 2D game, I still would suggest learning some openGL first, using LWJGL (or JOGL if you like). Maybe put the use of models on hold for later when your game progresses and choose a library for that or write your own then. By the time you get there, these things have become easier to accomplish for you will have learned a lot.

If you havn’t check out www.mojomonkeycoding.com Try some of the demos see how they run and look at the source code for them. It’s pretty simple to use.

Ok guys, thank you so much for all this help. After playing Alien Flux I’m convinced, because my game will be somewhat similar.

Alien Flux uses LWJGL, which I would love to use but sadly it doesn’t work well on a Mac (somehow they got it working though…). So it seems like JoGL is the way to go for me.

But, I also understand that JoGL is somewhat “lowlevel” stuff. Does using it mean I’ll have to do more work (writing my own collision detection schemes etc). If this is true, then another potential route is to learn the Java3D tutorials and then migrate to Xith3D which has built in collision detection, model loaders, and uses JoGL…

edit: the game I’m going to be making is going to be very difficult to write, and very complicated. I’m going to have to worry about a lot more stuff than just the graphics, so the more a library can do for me the better.

[quote]edit: the game I’m going to be making is going to be very difficult to write, and very complicated. I’m going to have to worry about a lot more stuff than just the graphics, so the more a library can do for me the better.
[/quote]
Take care that you don’t set your targets too high for your first game. You might just get frustrated. Why not start with something simple?

[quote]Take care that you don’t set your targets too high for your first game. You might just get frustrated. Why not start with something simple?
[/quote]
Yeah, I plan on making a very watered-down version of it and just move objects around on the screen.