Another n00b inquiring about libraries

I’m coming to the end of the development of my game, and I’m wanting to push up the performance. I made it for a mobile phone, then decided I could keep the concept the same and improve the graphics and it’d make a pretty good pc game. So I made it work great as an Applet, but when I want to go high-res and full screen, it doesn’t quite cut it.

Almost the only time I ever do anything with Graphics2D in real time is drawImage(Image image, int x, int y, ImageObserver io); and drawImage(Image image, AffineTransform trans, ImageObserver io);

I’m thinking if I use something like LWJGL or JOGL or something I could improve on my draw speeds and keep my frame rate high and constant, but I really don’t know what I should do. I’d like to make it pluggable… so I could say… create my own class that determines where drawImage gets redirected to, or something like that. The point being I could switch between software or hardware rendering modes easily.

The game is practically done, I don’t need any real logic support from a library. I just want it to manipulate images fast. Oh, and something with good audio support would be nice. I’d love to have a background track along with a heck of a lot of sounds playing at once. Like I’d really be pushing the limit of the number of sounds that could play at one time.

So what library would I need and what resources do I need to look up to learn how to use it? Also, how fast could I implement the graphics portion? The audio portion I’d be putting in from scratch as it doesn’t exist in my game yet, but I do have the sounds I want to use (is there a particular audio file format that would be best?). I’d like to think that within a week of daily hard work I could be able to switch between software and hardware rendering modes at the touch of a button and all be well. Is that realistic?

Thanks for any answers :slight_smile: Oh, and to see the current stage of the game, go here (800x600 Applet):
http://www.gamelizard.com/test/rimscape.html

did you try the game using java 5.0’s opengl pipeline?

no, I’ve never heard of that before… and a google search didn’t help. Can you explain a bit more what that is?

[quote]no, I’ve never heard of that before…
[/quote]
:o hem… broum… well. you should pass time in the java2D forum, instead…
well. coming version of sun’s jvm had an opengl implementation of java2D. by using a flag on windows, you can switch from the normal rendering engine to an opengl one. On linux, there is also a gl pipeline.
my own tests show a huge speed increase.
I suggest you download latest beta jre and test it.
the flag is sun.java2d.opengl = True
(note the ‘T’. it says to report if the gl pipeline is used or not in standard output (console))

hmmm I’m running:
System.setProperty(“sun.java2d.opengl”, “True”);
under JRE 1.5.0 and nothing gets printed out. What does that mean?

EDIT: OK I placed it earlier and got: Could not enable OpenGL pipeline for default config on screen 0

argh.
too bad it does not say a bit more explicitly why it was not enabled.
maybe Hercules should move that thread to java2D, so the guys from the java2D team can get an eye on it.

what are you graphics adapter and os? do you have latest drivers?

maybe GL acceleration does not work in applets due to security exceptions… who knows.

[edit] by the way, your applet works at 60 fps on my machine. why trying to make it faster? is it that slow on yours?

It runs at 60fps on mine (but 50 using 1.5, go figure. GAGE Timer weirdness I guess. jbanes said that setting it at 50 would work even with the poor Windows system timer, but it seems to always be at 60 now), however many other computers I’ve tested it on go slower. Mac’s can only pull off like 30fps.

I’m planning on selling the game with a version I have drawing the game on a Canvas using BufferStrategy. Using that I can’t get 60fps running fullscreen at 1024x768. I’d like the game to be able to go higher without worrying bout dropping frame rate.

I’m on Win XP Pro on a 2ghz Toshiba laptop, 512mb ram, using the latest Intel® Extreme Graphics2 for Mobile drivers for my Intel® 82852/82855 GM/GME Graphics Controller. 64mb of video memory, and full OpenGL support. When I run that System property before changing screen resolution I get the output I described. When I set it after, I get no output.

BTW what post are you referring to? I search all the forums and never find anyone else referring to using this setting

There are many pages reffering to that flag in the j2D forum, maybe you searched in a too little time frame. (i found 11 results)
Anyway, i’m mainly reffering to that page, which has been advertised here and there:
http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.html

reading that has shown that Java will be very picky about what it needs to enable OpenGL support, so I don’t think this will be a good enough option for my game.