Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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 935 times)
0 Members and 1 Guest are viewing this topic.
Offline NewOnJava

Junior Member




1970 born Java game hobbyer.


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

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

Senior Member





« Reply #1 - Posted 2006-11-28 00: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:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
/**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.

Offline Kova

Senior Member





« Reply #2 - Posted 2006-11-28 00: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 Member




1970 born Java game hobbyer.


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

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..
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (72 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (79 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (80 views)
2014-04-14 15:48:38

tom_mai78101 (104 views)
2014-04-10 04:04:31

BurntPizza (164 views)
2014-04-08 23:06:04

tom_mai78101 (260 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org 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‑gaming.org
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!