Sign in to follow this  

[java] Java2D or JOGL

This topic is 4194 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
You can always bundle a JRE of the specified version with your game, can't you?

Also, the folks at Three Rings require 1.5 for their "Bang! Howdy" game. If they can safely assume people will upgrade their JREs to play, can't the boy here do the same? :D

Don't want to disagree with you Cas, knowing that you work on this biz, I know that yours aren't groundless statements. But aren't we supposed to estimulate the updates in some sort of way?

Son Of Cain

Share this post


Link to post
Share on other sites
Turns out you can't expect people to upgrade their JREs to play. I won't even do it myself, I'm that lazy :) But also - you can't change the JRE on a Mac. So if you target 1.5 on Windows you're OK because you can bundle the JRE in the installer but on a Mac you're at the mercy of statistics.

There is some percentage that will upgrade just to play your game but the fact is, it's just a small percentage, meaning a rather larger percentage of lost opportunity. Especially given the extremely bouyant Mac market.

O'course the OP might actually not care about Mac development at all which would be a shame but there you go.

Cas :)

Share this post


Link to post
Share on other sites
Thanks guys for pointing out that not everyone can use 1.5. Had always assumed I can solve the problem by packaging the JRE in the game itself...guess not.

I will still go ahead with 1.5, because this game is more of a learning project to improve my Java then a game meant for wide distribution possibly played by myself and some friends (as testers).

Share this post


Link to post
Share on other sites

This topic is 4194 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this