faster graphics implementation?

Hello everyone. I’ve been following these boards for a long time now, but this is my first post. I’m working on a side-scroller ala Double Dragon / Bad Dudes type and I owe a lot of my solutions to searching the great advice on this board.

Currently, I’m using a method to update graphics and having each class drawing it’s own graphics (i.e. map class, character class, resources class), which works pretty well…but not great. I was wondering if it’s faster to do it this way or to have one class grab the images from the other classes and perform all the rendering itself?

Another problem I’m having is the frame rate is fine walking around a level, jumping etc…but comes to a crashing hault when I fire a projectile. The projectiles are stored in a linked list and a location check is done on each update to remove them from the list once they’ve left the screen. Is a location check too much on each update, or is a linked list slow on drawing?

Any advice would be greatly appreciated. Thanks for the help.

Devon.

[quote]Is a location check too much on each update, or is a linked list slow on drawing?
[/quote]
easiest way to find out: comment out the location check :stuck_out_tongue:

My games have tons of objects whizzing around the screen, all checking for collisions with each other every frame, 60fps. No troubles on anything faster than 500MHz.

Cas :slight_smile:

Well, I suppose I need to re-work my resource manager and do some profiling tests. Does anyone know about performance issues between having the main class grab the graphics from the other classes and doing all the drawing as opposed to passing the Graphics2D to each class to perform it’s own drawing? I guess I could try both and profile that as well, but I wanted to get some feedback to see what you guys have had the most luck with. I’m using straight Java2D…sorry Cas, no LWJGL, even though I probably should be using it.

Devon.

Another problem I’m having is the frame rate is fine walking around a level, jumping etc…but comes to a crashing hault when I fire a projectile…

Assuming you are using 1.4 JDK I’d verify that you are not using RGBA image format for your projectiles; IE try BufferedImage.TYPE_INT_RGB in the BufferedImage constructor if you are using BufferedImages instead of BufferedImage.TYPE_INT_RGBA.

This is kind of a stab in the dark, but could lead to the massive performance drop you are mentioning.

You might also try looking into the Volatile Image API. When I was doing some Java2D work things were greatly accelerated going this route. Find your problem 1st before switching to the Volatile Image API though…

Best of luck…