Some Help Needed, on a game project!!

Hei!

im a hobby game programmer and currently making my old visualc++ cavegame game to my homepage as a Java WebStart project…

you can find my visualc++ game here at address following, please check it to know how to help me, thanks…

www.5mingames.eurojari.net/CaveGame99.zip

my plan, and things i know how to are following…

my plan to use a Java WebStart with BufferStrategy (2) and FullScreen 640x480x16…
my plan to make a tilemap 480x480 to fullscreen to make a scroller…

my problems are following…

if i do a FullScreen BufferStrategy (2) 640x480x16 with webstart then how should i handle particles flying around on my game…
all i can do for particles with Java is to do a somekind of a BufferedImage with multiple setRGB (x,y,rgb) but this seems to be too slow for my game,please help…
i have 1.733Ghz machine is my computer too slow for a fullscreen Java particle game, i made my visualc++ version of my game with a 500Mhz Athlon and it rolled just fine…

JariTapio / Helsinki


sorry about my could be better English and thank you for helping…

The game should run fast enough in Java, even on a 500Mhz Athlon (not to mention the computer you have now).

I know practically nothing about particle effects, but I know some tidbits about Java that might help.

I guess you have a BufferedImage for the whole screen that you draw to and then draw the whole thing at once.

To enable hardware acceleration of the image, you have to do something like the following:

/**Creates a blank BufferedImage.
 * @param width the width of the Image
 * @param height the height of the Image
 * @param shouldTransparencyBeAllowed whether to allow transparency in the BufferedImage
 * created.  In most implementations of Java, allowing transparency is slower.
 * @return the BufferedImage created
 */
public static BufferedImage createImage(final int width, final int height,
	final boolean shouldTransparencyBeAllowed)
{
	//get the GraphicsConfiguration
	GraphicsConfiguration graphicsConfiguration = GraphicsEnvironment.
		getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();

	//this enables/disables transparency and makes the Image more likely to be managed
	return graphicsConfiguration.createCompatibleImage(width, height,
		shouldTransparencyBeAllowed ? Transparency.BITMASK : Transparency.OPAQUE);
} //end createImage

BITMASK transparency allows a pixel to be either transparent or opaque with no alpha channel blending. OPAQUE transparency is for an image that has no transparency, and I believe this is what you want for the BufferedImage that everything gets drawn to.

That createCompatibleImage method is one of the only ways to get an image that will be hardware accelerated. It’s annoying that images aren’t hardware accelerated by default.

I don’t know how long setRgb calls take, but you may want to use the other getRgb and setRgb methods to modify the whole pixel array at one time if you’re changing every pixel in the BufferedImage using setRgb calls.

If there’s only a small number of particle effects, you might want to precompute them.

There’s a list of flags for the Java Virtual Machine, and it’s possible that one of them may apply. By shutting off Direct3D, I got a huge performance boost for one 2d game I made.

hardware acceleration won’t matter since he’s modifying pixels on image, when you access data of image then image isn’t accelerated. So if you modify your image every frame it’s a problem.
Next thing, setRGB is very slow, it’s recommended you get your image data into array and modify that array. I asked same thing couple months ago here. Read it.

Hei!

Well, this raster thing was totally new to me and it helped me a lot, i dont have to worry about particles anymore, thanks people…

JariTapio / Helsinki


Game developing is a way of fun…