Show Posts
|
Pages: [1]
|
1
|
Java Game APIs & Engines / Java 2D / Gage Timer
|
on: 2003-08-08 03:09:05
|
Hellow, I am using Gage Timer for my game loop, here is what i mean : 1 2 3 4 5 6
| gameManager.update(); render(); sleep = gt.getTicksPerSecond()/60; ticks = gt.getClockTicks(); gt.sleepUntil(sleep+ticks); ticks = ticks+sleep; |
The code shows i have a class "gameManager". Now if i wanted to create a new Timer (gmt) which is created "gameManager" for its indepedent events, will that timer be affected by the "gt" shown above ?? Basically, will the new timer run in a new Thread independent of gt or not ? Thx
|
|
|
2
|
Java Game APIs & Engines / Java 2D / Primitives and Blits
|
on: 2003-08-08 03:02:48
|
When i am drawing a lot of primitives, say 100 ovals, i get a lot of 8085 calls to sun.java2d.loops.Blit$GeneralMaskBlit and 8085 calls to sun.java2d.loops.MaskBlit and 992 calls to sun.awt.windows.D3DBlitLoops
When i disable them 72 calls to sun.java2d.loops.MaskBlit and 72 calls to sun.java2d.loops.Blit$GeneralMaskBlit and 1783 calls to sun.awt.windows.D3DBlitLoops::Blit
Arent primitives drawn with hardware acceleration ?
|
|
|
4
|
Java Game APIs & Engines / Java 2D / Re: Volatile or not ?
|
on: 2003-08-06 08:58:35
|
I hope you aren't using System.currentMillis() for your bench. It's slow and has a very low resolution. So it cannot describe you the exact behavior of your program...  Yes, i am afraid i am. I will change it to Gage or other high rez timer and post the results.
|
|
|
5
|
Java Game APIs & Engines / Java 2D / Re: Volatile or not ?
|
on: 2003-08-06 02:47:31
|
106415 calls to sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw") 106415 calls to sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)
These are the things that kill your performance. This is a software blit of a translucent buffered image to an accelerated image (backbuffer).
I see a couple of possibilites: - you have some sprites as bufferedImages for some reason (so they are not being accelerated) - you create more sprites that can fit in vram, some of them get accelerated, but most - don't - you render to your sprites more often than you copy from them
Hey, i think the first possibility can be ruled out. Because on my every Image creation i am checking out whether they are accelerated after creation or not, and they all are. The second one might be true, since i am creating about 20 images to start with and create others on the fly (exlosions only). But apart from image i am creating other geometrical stuff all the time, about 100 geometrical things. Lets say i am creating about MAX 250 sprites. I dont think that is too much !! I have 32 Meg gfx card. One thing i think might be a problem is ur third possibility. I have put up a simple time bench on my updateEverything method and rendering method. This is what my console shows : Time Paint() - 15 Time Paint() - 15 Time Paint() - 31 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Update() - 16 Time Paint() - 16 Time Paint() - 16 Time Update() - 16 Time Paint() - 16 Time Update() - 15 Time Paint() - 15 Time Paint() - 16 Time Update() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Update() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Update() - 15 Time Paint() - 16 Time Update() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Update() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Update() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Update() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 15 Time Update() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 16 Time Paint() - 16 Time Paint() - 16 Time Paint() - 15 Time Paint() - 15 And my threaded loop is like : gameManager.update(); gameManager.paint(bufferedGraphics); bufferedGraphics.show(); Thread.currentThread().yield(); ual.sleep(gameManager.REFRESH_RATE); What i am trying to show here is in my code i am trying to call my update() and paint() ONCE every refresh. But from my console i gather that my update method doesnt get called as often as my render(). Maybe because my sleep time is too short - like 10 millisecond.  PS - Sorry for the long stupid looking post 
|
|
|
7
|
Java Game APIs & Engines / Java 2D / Re: Volatile or not ?
|
on: 2003-08-05 06:41:15
|
This is what i get sometimes when i try to enable trace=count ----------------------------------- Welcome to AlienAttaX 0.7b Init - System Trying to enable Alpha Hardware Acceleration - true Forcing DirectDraw to Use VRAM - true DirectDraw surfaces constrained to use vram New Acceleration Threshold: 1 Acceleration for translucent images is enabled. Loading Errors ? false Time constructing GM - 16 java.lang.InternalError: not implemented yet at sun.awt.windows.Win32OffScreenSurfaceData.getRaster(Win32OffScreenSurfaceData.java:338) at sun.java2d.loops.OpaqueCopyAnyToArgb.Blit(CustomComponent.java:73) at sun.java2d.loops.Blit$TraceBlit.Blit(Blit.java:301) at sun.java2d.loops.GraphicsPrimitive.convertFrom(GraphicsPrimitive.java:525) at sun.java2d.loops.MaskBlit$General.MaskBlit(MaskBlit.java:186) at sun.java2d.loops.MaskBlit$TraceMaskBlit.MaskBlit(MaskBlit.java:229) at sun.java2d.loops.MaskFill$General.MaskFill(MaskFill.java:155) at sun.java2d.loops.MaskFill$TraceMaskFill.MaskFill(MaskFill.java:185) at sun.java2d.loops.DrawGlyphList$General.DrawGlyphList(DrawGlyphList.java:109) at sun.java2d.loops.DrawGlyphList$TraceDrawGlyphList.DrawGlyphList(DrawGlyphList.java:139) at sun.java2d.pipe.SolidTextRenderer.drawGlyphList(SolidTextRenderer.java:38) at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:47) at sun.java2d.pipe.ValidatePipe.drawString(ValidatePipe.java:123) at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2534) at GameManager.paint(GameManager.java:535) at AlienAttaX.render(AlienAttaX.java:69) at AlienAttaX.run(AlienAttaX.java:79) at java.lang.Thread.run(Thread.java:534)
Apart from that, when the trace works, i get : RUNNING IN A WINDOW :: with bufferstrat
6639 calls to sun.java2d.loops.Blit::Blit(IntArgb, Xor, IntRgb) 8912 calls to sun.awt.windows.D3DBlitLoops::Blit("Integer ARGB D3D with translucency", SrcOver, "Int eger RGB DirectDraw") 191 calls to sun.java2d.loops.Blit::Blit(ByteIndexedBm, SrcOverNoEa, IntArgb) 3264 calls to sun.java2d.loops.DrawGlyphList::DrawGlyphList(OpaqueColor, SrcNoEa, AnyInt) 506 calls to sun.java2d.loops.MaskFill::MaskFill(AnyColor, SrcOver, IntRgb) 1088 calls to sun.awt.windows.Win32BlitLoops::Blit("Integer RGB DirectDraw", SrcNoEa, "Integer RGB D irectDraw") 15 calls to sun.java2d.loops.Blit::Blit(ByteIndexedBm, SrcOverNoEa, IntRgb) 5 calls to sun.java2d.loops.Blit::Blit(IntRgb, SrcNoEa, IntRgb) 54257 calls to GDIFillShape 107336 calls to sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB Direc tDraw") 5 calls to sun.awt.windows.Win32BlitLoops$DelegateBlitBgLoop::BlitBg(Any, SrcNoEa, "Integer RGB Dire ctDraw with 1 bit transp") 639 calls to sun.awt.windows.Win32BlitLoops::Blit("Integer RGB DirectDraw with 1 bit transp", SrcOve rNoEa, "Integer RGB DirectDraw") 888 calls to sun.java2d.loops.MaskFill::MaskFill(AnyColor, Src, IntRgb) 107336 calls to sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb) 5 calls to sun.java2d.loops.SetFillRectANY::FillRect(AnyColor, SrcNoEa, Any) 982 calls to DDFillRect 1093 calls to sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, Xor, AnyInt) 1 call to sun.java2d.loops.ScaledBlit::ScaledBlit(ByteIndexedBm, SrcOverNoEa, IntRgb) 99 calls to sun.java2d.loops.Blit::Blit(IntArgb, SrcNoEa, IntArgb) 981 calls to GDIDrawShape 294251 total calls to 20 different primitives
Running in FullScreen also bufferstrat
5 calls to sun.awt.windows.Win32BlitLoops$DelegateBlitBgLoop::BlitBg(Any, SrcNoEa, "Integer RGB Dire ctDraw with 1 bit transp") 36 calls to sun.java2d.loops.Blit::Blit(IntArgb, SrcNoEa, IntArgb) 5 calls to sun.java2d.loops.Blit::Blit(IntRgb, SrcNoEa, IntRgb) 993 calls to sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, Xor, AnyInt) 150 calls to sun.java2d.loops.Blit::Blit(ByteIndexedBm, SrcOverNoEa, IntArgb) 5643 calls to sun.java2d.loops.Blit::Blit(IntArgb, Xor, IntRgb) 1680 calls to sun.java2d.loops.MaskFill::MaskFill(AnyColor, Src, IntRgb) 15 calls to sun.java2d.loops.Blit::Blit(ByteIndexedBm, SrcOverNoEa, IntRgb) 106415 calls to sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB Direc tDraw") 106415 calls to sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb) 5 calls to sun.java2d.loops.SetFillRectANY::FillRect(AnyColor, SrcNoEa, Any) 44375 calls to GDIFillShape 6172 calls to sun.awt.windows.D3DBlitLoops::Blit("Integer ARGB D3D with translucency", SrcOver, "Int eger RGB DirectDraw") 2988 calls to sun.java2d.loops.DrawGlyphList::DrawGlyphList(OpaqueColor, SrcNoEa, AnyInt) 785 calls to DDFillRect 1 call to sun.java2d.loops.ScaledBlit::ScaledBlit(ByteIndexedBm, SrcOverNoEa, IntRgb) 784 calls to GDIDrawShape 675 calls to sun.awt.windows.Win32BlitLoops::Blit("Integer RGB DirectDraw with 1 bit transp", SrcOve rNoEa, "Integer RGB DirectDraw") 277142 total calls to 18 different primitives
MeThinks that all the trouble is because of GDI - Which i think doesnt use using real directdraw acceleration !!! Since i am a "newless clubie" to the game scene, i dont know much.
|
|
|
8
|
Java Game APIs & Engines / Java 2D / Re: Volatile or not ?
|
on: 2003-08-04 11:02:06
|
Okae, my Images are Volatile and Accelerated !!! And i do see
sun.awt.windows.D3DBlitLoops::Blit("Integer ARGB D3D with translucency", SrcOver, "Integer RGB DirectDraw")
i was wondering that what effect does the Acceleration Threshold have on Rendering ?? And Thanks Abuse, for telling me that i have to set the properties before i init anything Graphical. No wonder my java -Dsun.java2d.trace=count wasnt working before.
If java2D uses DirectDraw under the hood, why is it still so slow ? I heard that i can see a lot of performance difference if i switch to Lwjgl / jogl etc etc. ?
|
|
|
9
|
Java Game APIs & Engines / Java 2D / Volatile or not ?
|
on: 2003-08-04 04:21:44
|
Hello ppl, I am using this method and hoping i am getting Accelerated Images. Before using this method my images were automatic. I went from 30-40 Fps to 30-40Fps !! Yes, no change ! So i was wondering if my images are accelerated and if i am really supposed to see noticible difference in performance. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public static BufferedImage getAcceleratedImage(Image source) { MediaTracker md = new MediaTracker(new Frame()); md.addImage(source,0); try { md.waitForID(0); } catch(InterruptedException iex) { iex.printStackTrace(); } int height = source.getHeight(null); int width = source.getWidth(null);
GraphicsDevice systemGfx = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); GraphicsConfiguration gc = systemGfx.getDefaultConfiguration(); BufferedImage acceleratedImage = gc.createCompatibleImage(width,height,Transparency.TRANSLUCENT); Graphics2D associatedGraphics = acceleratedImage.createGraphics(); associatedGraphics.drawImage(source,0,0,null); return acceleratedImage; } |
I have enabled System Properties for Aplha Acceleration and forcing vram (which i suppose is to force images to be stored in vid ram). And also using Buffered Strategy.
|
|
|
11
|
Java Game APIs & Engines / Java 2D / Re: FullScreen Woes
|
on: 2003-05-25 15:13:49
|
Here is the Code from the method that sets the Display Mode. Umm. I also noticed that when i set Resolution higher than 1024 , say 1280 and 1600 ; My Frame Width query returns proper values. So its basically for resolutions below 1024x768 !! Oh Btw Abuse, i am using Windows XP , 1.4.2 beta. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| public static void main(String [] args) { myFrame = new Game(); myFrame.setIconImage(Toolkit.getDefaultToolkit().getImage("./data/images/emg.gif")); myFrame.setUndecorated(true); myFrame.setVisible(true);
GraphicsDevice systemGfx = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); DisplayMode resolution = new DisplayMode(640,480,systemGfx.getDisplayMode().getBitDepth(),60); systemGfx.setFullScreenWindow(AlienAttaXFrame);
try { systemGfx.setDisplayMode(resolution); } catch(UnsupportedOperationException ue) { System.out.println("Fullscreen Mode Failed"); myFrame.setSize(640,480); myFrame.setLocation(350,90); }
myFrame.createBufferStrategy(3); bufferedGraphics = myFrame.getBufferStrategy();
if(ual != null) { ual.setPriority(Thread.MAX_PRIORITY); ual.start(); } } |
|
|
|
12
|
Java Game APIs & Engines / Java 2D / FullScreen Woes
|
on: 2003-05-25 09:16:30
|
Hi, I have a stupid trouble with FullScreen mode. I am setting the Display Mode to 640x480xdesktopDepth. Now this just gives me an area of 640x480 while the rest of the area is left off as if i just wanted a 640x480 out of the 1024x768 (my Desk res). If i change to 800x600 then still it gives me a block of 800x600 from 1024x768 Rather than giving me larger pixel size.
Lemme try making it a visual
1024 -> xxxxxxxxxxxxxxxBBBBBBBB| xxxxxxxxxxxxxxxBBBBBBBB| xxxxxxxxxxxxxxxBBBBBBBB| xxxxxxxxxxxxxxxBBBBBBBB| xxxxxxxxxxxxxxxBBBBBBBB| xxxxxxxxxxxxxxxBBBBBBBB| BBBBBBBBBBBBBBBBBBBBB| BBBBBBBBBBBBBBBBBBBBB| BBBBBBBBBBBBBBBBBBBBB|
x = Area delivered to me B = Background Color of my Frame
Also when i query the Frame for height, it gives me 768 !!
I am currently using 1.4.2 beta. Any clues ?
|
|
|
|
|
nelsongames
(17 views)
2018-04-24 18:15:36
nelsongames
(13 views)
2018-04-24 18:14:32
ivj94
(587 views)
2018-03-24 14:47:39
ivj94
(50 views)
2018-03-24 14:46:31
ivj94
(400 views)
2018-03-24 14:43:53
Solater
(64 views)
2018-03-17 05:04:08
nelsongames
(110 views)
2018-03-05 17:56:34
Gornova
(175 views)
2018-03-02 22:15:33
buddyBro
(728 views)
2018-02-28 16:59:18
buddyBro
(93 views)
2018-02-28 16:45:17
|
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
|
|