Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Some Help Needed, on a game project!!  (Read 1804 times)
0 Members and 1 Guest are viewing this topic.
Offline NewOnJava

Junior Devvie

1970 born Java game hobbyer.

« Posted 2006-11-27 18:01:03 »


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..

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..
Offline fletchergames

Senior Devvie

« Reply #1 - Posted 2006-11-27 23:30:33 »

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.

   //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.

Offline Kova

Senior Devvie

« Reply #2 - Posted 2006-11-27 23:44:17 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline NewOnJava

Junior Devvie

1970 born Java game hobbyer.

« Reply #3 - Posted 2006-11-28 13:13:33 »


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..
Pages: [1]
  ignore  |  Print  

EgonOlsen (76 views)
2018-06-10 19:43:48

EgonOlsen (56 views)
2018-06-10 19:43:44

EgonOlsen (76 views)
2018-06-10 19:43:20

DesertCoockie (256 views)
2018-05-13 18:23:11

nelsongames (156 views)
2018-04-24 18:15:36

nelsongames (155 views)
2018-04-24 18:14:32

ivj94 (896 views)
2018-03-24 14:47:39

ivj94 (157 views)
2018-03-24 14:46:31

ivj94 (809 views)
2018-03-24 14:43:53

Solater (173 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!