Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 2D / Re: Swing buffering / window switching bug on: 2004-07-22 14:04:40
I thought it was the transform, as I am setting it. However I am restoring it everywhere it gets changed and I still see the problem even if I comment out anything that even looks like a transform. It might be this bug, or a variation thereof:

Redraw problems when moving window over Swing component

I haven't seen it stop painting completely yet, but I look forward to it.  Tongue
2  Java Game APIs & Engines / Java 2D / Re: paintImmediately hates double buffering? on: 2004-07-21 21:13:21
Here's a somewhat better description of the problem. It only happens when using Swing componenets in the applet.

I select a window other than my applet and drag it across the applet. As I do this the plugin seems to be accumulating dirty rectangles of the obscured areas. Then I select the applet window and it comes to the front. After a short time (but often AFTER my next repaint) the plugin copies from the origin of the back buffer into the collected dirty area. Thus if I've dragged over the applet window origin it flashes, but is ok, otherwise it draws misaligned junk.

I've tried every method I can think of to validate or invalidate the stuff from the Java side AND I've tried invalidating the Windows window that contains the applet from a JNI call, but nothing seems to fix this. If anybody has a solution to this I'll be eternally grateful and/or bribe you in some way. It's driving me nuts.
3  Java Game APIs & Engines / Java 2D / Swing buffering / window switching bug on: 2004-07-19 15:33:40
Has anybody else noticed Swing restoring from the wrong portion of the backbuffer if it isn't the foreground application? This seems to be Windows only (OS X has a real back buffer now.) but if I drag a window in front of my applet I can see it restoring content from the origin of my window rather than the portion that needs to be repainted.

Anybody else run into this? I can't seem to catch it as it messes up. My partial hack has been to force a repaint on paintImmediately if I'm not in the foreground (also a hack since an applet can't check if it is in the foreground) but it still nails me with an incorrect redraw shortly after my window becomes frontmost again.

It would be a major pain to post all the code involved, just hoping maybe one of you had seen this and found a solution.

<edit> changed title to be slightly more descriptive </edit>
4  Java Game APIs & Engines / Java 2D / Re: top speed expected for loading many images on: 2003-12-04 20:51:55
Quote
I tried JMF but it was/is far too unfinished.   I was trying to stream audio and video over a 100Mbps LAN - synchronized. I could not.  I managed to get it streaming, but the video would play at half speed until the audio was lagged by about 1 minute!! Then the video could suddenly keep up and stay 1 minuted behind the audio.  I played with all sorts of buffering settings, tweaked everything I knew to tweak, asked on the JMF mailing list.. and got nowhere.
In less time than I spent trying to get JMF to work and coming to the conclusion that it simply doesn't,  I managed to code my own streaming of MJPEG and audio from scratch..


A bit off topic, but I'd recommend QuickTime Java for this stuff (unless you're running on a platform other than Mac/Windows.) It includes the QuickTime streaming stuff.

- eli
5  Game Development / Performance Tuning / Re: Incremental Garbage Collection on: 2003-10-30 13:28:38
Yeah if it was a property I could just set it - in fact although it does appear in javaplugin.jre.params, setting that to "-Xincgc" doesn't work (obviously no big surprise, but it was worth a shot.)

Is there any explanation from Sun about why we can't do this? I know, "their normal garbage collection is so good that I'll never see pauses unless I'm creating too many transitional objects and it's all my fault for bad coding practices." (My code ain't pausing for 2 tenths of a second to collect up 100k of RAM it doesn't need.)

It seems trivial to do, and it would improve the apparent performance of a whole range of programs.

What's the bug number? I haven't found it...

- eli
6  Game Development / Performance Tuning / Incremental Garbage Collection on: 2003-10-29 13:55:42
This seems to be one of those things everybody knows, but I can't find any real documentation on it.

Is there a way to turn on incremental garbage collection in my applet other than through the plugin control panel? It seems to me that the answer is "no." Why can't I do this? Or, if I can, how do I do it?

Thanks, I'm starting to get this stuff figured out,
- eli
7  Game Development / Performance Tuning / Re: Windows plugin versions on: 2003-10-21 21:11:52
Many apologies for disappearing on this thread, I had to get caught up on content coding before I could go back to engine tuning.

Here's some applet code which is a much simplified version of our current rendering scheme and shows better performance on 1.4.0 then on 1.4.2 (at least on Windows XP.)

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  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
/* 
 j2dTestApplet.java
*/


package forceandmotion;

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.applet.*;

public class j2dTestApplet extends java.applet.Applet {
      Canvas testCanvas = null;
      Image testImage = null;
      Image backImage = null;

      public j2dTestApplet() {
      }

      // Get applet information
     public String getAppletInfo() {
            return "Java 2D Test Applet";
      }

      // Initialize the applet
     public void init() {
        String javaVersion = System.getProperty("java.version");
       
        System.out.println("Java Version = " + javaVersion);
        System.out.println("Java Class Version = " + System.getProperty("java.class.version"));

        System.out.println("Java VM Specification Name = " + System.getProperty("java.vm.specification.name"));
        System.out.println("Java VM Specification Version = " + System.getProperty("java.vm.specification.version"));
        System.out.println("Java VM Version = " + System.getProperty("java.vm.version"));
        System.out.println("OS Name = " + System.getProperty("os.name"));
        System.out.println("OS Version = " + System.getProperty("os.version"));
        System.out.println("");

            setIgnoreRepaint(true);
           
            try {
                  initComponents();
            }
            catch (Exception e) {
                  e.printStackTrace();
            }
      }

      // Initialize the components
     public void initComponents() throws Exception {
            // the following code sets the frame's initial state
           setLayout(null);
            setLocation(new java.awt.Point(0, 0));

            setSize(new java.awt.Dimension(600, 600));
           
            testCanvas = new Canvas();
            this.add("Center", testCanvas);
            testCanvas.setSize(new java.awt.Dimension(600, 600));
            testCanvas.setIgnoreRepaint(true);
            testCanvas.show();
//            testCanvas.createBufferStrategy(2);
           this.show();

            java.net.URL codebase = getCodeBase();
            Image gifImage = getImage(codebase, "duke.gif");
           
        MediaTracker tracker = new MediaTracker(this);
        try {
            tracker.addImage(gifImage, 0);
            tracker.waitForID(0);
            if (tracker.isErrorAny())
                throw new Exception("Couldn't find duke.gif");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
       
        int width = gifImage.getWidth(this);
        int height = gifImage.getHeight(this);
        testImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        backImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        testImage.getGraphics().drawImage(gifImage, 0, 0, null);
      }

      // Run the applet
     public void start() {
            long startTime = System.currentTimeMillis();
            for (int frame = 0; frame < 5000; frame++)
            {
                  //BufferStrategy strategy = testCanvas.getBufferStrategy();
                 Graphics graphics = testCanvas.getGraphics();//strategy.getDrawGraphics();
                 graphics.fillRect(0,0,300,300);
                  backImage.getGraphics().drawImage(testImage, 0, 0, null);
                  graphics.drawImage(backImage, 0, 0, null);
                  graphics.dispose();
                  //strategy.show();
                 getToolkit().sync();
            }
            long stopTime = System.currentTimeMillis();
            System.out.println("elapsed time for 5,000 frames = " + (stopTime - startTime));
      }
     
      // Don't paint
     public void paint(Graphics g) {
      }
}


The problem appears to be copying OUT of the BufferedImage. If I don't add the extra step (which we use for compositing all our junk in our own offscreen image) then I see better performance under 1.4.2.

I hope I didn't lose everybody's interest. Any insight out there? It seems to resemble the issues that people were reporting with DDraw surfaces, but I have tried using the switch to turn that off...

Thanks in advance,
eli
8  Java Game APIs & Engines / Java 2D / Re: BufferStrategy.show() for a Canvas not synced? on: 2003-10-20 21:59:40
I wanted to use it to guarantee my frame rate was a division of the refresh rate. I have a high resolution timer (we're using QTJava) but it isn't as useful if I can't stay synchronized with the screen refresh. I assume that even if Windows couldn't report the correct refresh rate it would still deliver the interrupt (or whatever it is) at the correct time for page-flipping to occur.

Unfortunately I can't use a totally standard timestep as we are doing a suite of simulations which have widely varying complexity. i.e. on my machine they range from 15 fps to 150 fps or so without any limiter turned on. So that leaves me with a variable frame length which unfortunately is often approximately the same length as my vsync, which is bad because it causes visual stuttering for the user. (If you think about a clock versus somebody counting seconds you can see the problem, over a long time they are fairly close, but any given second is likely to contain two or zero counts by the person.)

- eli
9  Java Game APIs & Engines / Java 2D / Re: BufferStrategy.show() for a Canvas not synced? on: 2003-10-20 20:21:50
<sigh>

That's what I was afraid of. Thanks for the information. So unless my frame rate is much greater than (or much less than) my monitor refresh rate I'm going to get frames displaying on screen for uneven intervals...

- eli
10  Java Game APIs & Engines / Java 2D / BufferStrategy.show() for a Canvas not synced? on: 2003-10-20 19:08:59
BufferStrategy.show() doesn't seem to stall until the vblank when attached to a Canvas object. Is this by design? I don't see how to resolve my issues with inconsistent frame rates if I don't have any way of knowing when stuff gets put on the screen.

I'm basing the assumption that it isn't stalling on the fact that my frame rates still exceed the refresh rate of the monitor for simple drawing. Has anyone here successfully used a BufferStrategy to control their frame rate while not in fullscreen exclusive mode?

Thanks for any info,
eli curtz
11  Game Development / Performance Tuning / Re: Windows plugin versions on: 2003-09-16 21:51:31
I don't see any differeces in the traces for the different versions I'm trying. Neither 1.4.0, 1.4.0 with the -Dsun.java2d.noddraw=true flag, nor 1.4.2 shows any calls to Win32XXXX, although there are the calls to "Short 565 RGB DirectDraw". A typical result of the counts trace gives me:

1721 calls to sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, Ushort565Rgb)
972 calls to sun.java2d.loops.DrawGlyphList::DrawGlyphList(OpaqueColor, SrcNoEa, AnyInt)
1721 calls to sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Short 565 RGB DirectDraw")
2 calls to sun.java2d.loops.FillRect::FillRect(OpaqueColor, SrcNoEa, AnyShort)
3 calls to GDIFillRect
1917 calls to sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, IntArgb)
1917 calls to sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntArgb)
8253 total calls to 7 different primitives


I managed to get a 98 machine up and running today and it does NOT show this same difference between 1.4.0 and 1.4.2, so it's looking like an XP issue. We have XP on just about all the machines here, and it has been noticed on every PC I've tried, so a variety of video cards and settings.

Obviously I need to get together a test application as our full app is way too much to expect anyone to look at. I'll do that ASAP and post it somewhere for people to try.

Thanks for all the feedback, I'll let everyone know when my test app is ready.
eli
12  Game Development / Performance Tuning / Re: Windows plugin versions on: 2003-09-12 19:37:23
Neither of the plugin switches seems to make a difference. Neither does -Dsun.java2d.noddraw=true. Should it be reporting that DirectDraw has been disabled? (It doesn't)

I've just started profiling in the last few days, but the results aren't very informative. Most of my top calls are in java.awt.image.DirectColorModel, which hasn't changed at all between 1.4 and 1.4.2 according to the source with the sdks. I also tried turning on the logging for java2d and came up with a basically identical series of calls in both cases.

My best clue so far is that if I use -Dsun.java2d.noddraw=true on the 1.4.0 version the performance drops to that of 1.4.2. Is it possible the DirectDraw acceleration is off in 1.4.2? How can I tell?

thanks,
eli
13  Game Development / Performance Tuning / Windows plugin versions on: 2003-09-10 18:39:09
I've been having a lot of trouble with performance of my applet on Windows which seems to be largely related to the version of the plugin I'm running. Is this a known issue? Has anybody else noticed this and found a solution.

My framerate is substantially better using the 1.4.0 version of the plugin than with later versions. In fact my framerate is best using 1.4.0 of both the plugin and the jre, although I have odd stuttering at some points. With the 1.40 plugin and the latest jre both framerate and smoothness seem reasonable. With the 1.4.1 (or 1.4.2) plugin and the 1.4.2 jre everything is smooth but my framerate goes to Hell.

Thanks for any info (or rumors, or theories...)
eli curtz
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

Dwinin (23 views)
2014-09-12 09:08:26

Norakomi (56 views)
2014-09-10 13:57:51

TehJavaDev (69 views)
2014-09-10 06:39:09

Tekkerue (34 views)
2014-09-09 02:24:56

mitcheeb (56 views)
2014-09-08 06:06:29

BurntPizza (40 views)
2014-09-07 01:13:42

Longarmx (25 views)
2014-09-07 01:12:14

Longarmx (32 views)
2014-09-07 01:11:22

Longarmx (31 views)
2014-09-07 01:10:19

mitcheeb (39 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!