[java] Java2D or JOGL

Started by
11 comments, last by Si Hao 17 years, 10 months ago
I am currently making a simple clone of Dungeon Siege. The difference being my game has a 2D top down view instead of full 3D and players only control one character at a time. What I am doing is to create a simple functional game as a learning process, before improving upon it gradually. For example changing from top down view to full 3D. Here is the question, should I use Java2D to do my rendering now as it is easier, but will need a code rewrite when I convert my game to 3D, or should I use JOGL for rendering while learning it in the process. Any advice is appreciated.
Advertisement
LWJGL, of course ;)

Cas :)
The point that really requires a thought is how are you going to model your game logic, having that switch of rendering technology in mind. You must concentrate first in a good set of interfaces and abstract classes to provide the functionality you require from your game objects, but keeping them uncoupled from a rendering interface. If you achieve that, you are free to adapt your code to whatever rendering interface you please: Java2D, JOGL, or.. LWJGL :p

So my advice to you is: before you even wonder if you should use 3D from the beginning or not, worry about building a consistent and flexible design for your game objects. A hint of a good work is the presence of interfaces such as Collideable, Localizable, Movable, Drawable, etc.. You can work with abstract terms in code, and switch only the concrete rendering layer when changing from 2D to 3D.

Son Of Cain
a.k.a javabeats at yahoo.ca
Thanks for the replies.

I have been trying to keep my code as flexible as possible, thanks for bringing up more things to consider :)

Guess I will stick with Java2D first and only go into a new API when I iron out all the bugs and design issues.
Java2D can run with hardware acceleration in Java5, so speed isn't an issue. I've used Java2D for a lot of things. It's definitely a good API to learn, I use it all the time at my current job. Additionally, you won't have to include any 3rd party dependencies in your app, the JRE comes with Java2D (not the case with JOGL, or JSR-231 as it's now called).

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

...MacOS... 1.4.2 mostly.... no h/w acceleration... ahem :)

Cas :)
Quote:Original post by princec
...MacOS... 1.4.2 mostly.... no h/w acceleration... ahem :)

Cas :)


Uh, Java5 is available for OSX.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

"Available" != "widely distributed"

Cas :)
Quote:Original post by princec
"Available" != "widely distributed"

Cas :)

Actually, it's distributed as an OS Update, pretty much everyone on OSX should have it. However, the same relationship can be made for OSX...

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

Sadly completely untrue :( For a start it only runs on 10.4+, and most of the OS X visitors I get are using 10.3 or even 10.2 still. In fact I've got some actual real stats here... let's see... here's the stats for the last 3 months:

1.4 18049 84%
1.5 3384 16%
1.6 1 0% (haha)

So there you have it. Will be a few years yet before it's sensible to target 1.5 for games dev.

Cas :)

This topic is closed to new replies.

Advertisement