4K Shooter

oh… lol

I wasn’t expecting it to be unable to clear the screen 60times/second! (no wonder my ShooterSE runs slowly :/)

ok, try this Test

http://www.pkl.net/~rsc/downloads/Test2.class

It won’t render anything to the screen, it’ll just output the number of times bufferStrategy.show() returned per second, to the console.

If its vsynced, it should output around 60 (+/- 1)
if it isn’t vsynced, it will give a much higher number.

escape to quit.

Ok, something is severely wrong…

Test2 prints: (I’ve put it all on one line)

12, 26, 22, 25, 26, 22, 26, 26, 21, 26, 26, 22, 26, 26, 22, 26, 19, 16, 16, 19, 15, 25, 25, 21, 26, 25, 21, 26, 23, 21, 26, 26, 20, 26, 25, 21, 24, 25, 22, 24, 21

The screen shows the striped Aqua background.

What resolution is the screen? I wonder if other resolutions would have different speeds?

I’m quickly coming to the opinion that Apple simply doesn’t care about gaming on the Mac. They’ve gone through three major iterations of the 1.4 JVM (1.4.0, 1.4.1, 1.4.2) and to date have not even added proper support for VolatileImages. It seems like such a simple thing, and just about every Java developer is screaming for it. What’s the problem already?

Sorry, tried to get someone to test this on another thread, but this:

http://developer.apple.com/documentation/ReleaseNotes/Java/Java131Update1RN/NewFeatures/index.html

Seems to imply that accelerated mode is turned off by default but can be enabled using system properties and/or key controls… I realise this is for 1.3.1 but it might still work?

Kev

[quote]I’m quickly coming to the opinion that Apple simply doesn’t care about gaming on the Mac. They’ve gone through three major iterations of the 1.4 JVM (1.4.0, 1.4.1, 1.4.2) and to date have not even added proper support for VolatileImages. It seems like such a simple thing, and just about every Java developer is screaming for it. What’s the problem already?
[/quote]
It seems simple, but isn’t. Apple has done 1.3.1, 1.4.1, and 1.4.2.

1.3.1 used ‘Carbon’ APIs to implement AWT. But Carbon is an older API used to transition from OS 9. What they really like you to use is ‘Cocoa’ an object oriented (Objective-C) API. When they went from 1.3.1 to 1.4.1 they ported all of their AWT code to use the Cocoa APIs instead of Carbon. That was a lot of work… and they focused on getting done as opposed to making it fast. Then there is the impending release of 1.5 from Sun… they needed to remain competitive and so they did 1.4.2 to catch up to Sun and they DID improve performance some with that release. But yes the priority was not on optimizing for games… they just needed to get things working well for typical Java apps - which to date doesn’t really include action games.

I file bugs with Apple whenever I find things that suck - such as their fullscreen mouse issues and graphics performance. I know they are aware of it. At this point though I’m betting they are hoping to use the OpenGL pipeline in 1.5, since their entire windowing system (Quartz Extreme) is based on OpenGL. I think because they already have OpenGL under the hood that integrating the hardware acceleration might have been a little more challenging to make it play nice with the rest of their system… along the same lines as the initial Direct Draw problems that happened with Windows - where translucent windows and cursors would flicker like mad whenever a Java app painted.

I think it is mainly a case of limited resources. From the little communication I’ve seen from Apple I’m sure the Java guys there want a top notch implementation. But I also see that they don’t seem to be making progress for gaming in general - their OpenGL implementation is a bit behind the times now - and for my laptop I can’t update drivers myself, I must rely on Apple OS patches for that sort of thing.

As far as hardware acceleration being on or off. If you have 1.4 installed the hardware acceleration of 1.3.1 is disabled by default. In 1.4 they don’t have hardware acceleration at all. They just haven’t got around to doing it with the Cocoa AWT implementation.

Sorry, guess I’m being dense… does this mean you can’t even turn on the 1.3.1 hardware implementation in 1.4 ?

Kev

[quote]Ok, something is severely wrong…

Test2 prints: (I’ve put it all on one line)

12, 26, 22, 25, 26, 22, 26, 26, 21, 26, 26, 22, 26, 26, 22, 26, 19, 16, 16, 19, 15, 25, 25, 21, 26, 25, 21, 26, 23, 21, 26, 26, 20, 26, 25, 21, 24, 25, 22, 24, 21

The screen shows the striped Aqua background.

What resolution is the screen? I wonder if other resolutions would have different speeds?
[/quote]
hmm, from that I can conclude only 1 thing,
I have no idea what is going on :wink:

Heres the code


import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class Test2 extends Frame
{
   volatile boolean running = true;
   public Test2()
   {
      enableEvents(AWTEvent.KEY_EVENT_MASK);
      setUndecorated(true);
      GraphicsDevice gd = getGraphicsConfiguration().getDevice();      
      gd.setFullScreenWindow(this);
      gd.setDisplayMode(new DisplayMode(800,600,16,60));
      createBufferStrategy(2);
      int frameCount =0;
      long lastTime = System.currentTimeMillis();
      String frameRate = "N/A";
      while(running)
      {
         if(System.currentTimeMillis()-lastTime>1000)
         {
            lastTime = System.currentTimeMillis();
            System.out.println(String.valueOf(frameCount));
            frameCount=0;
         }
         BufferStrategy bs = getBufferStrategy();
         frameCount++;
         getBufferStrategy().show();
      }
      dispose();
   }
   
   public void processKeyEvent(KeyEvent ke)
   {
     if(ke.getKeyCode()==KeyEvent.VK_ESCAPE) running = false;
   }

   public static void main(String [] args)
   {
      new Test2();
   }
}

From those results, I would guess that :-

a) it isn’t using page flipping in fullscreen.
b) therefor, fullscreen won’t be vsynced.
c) it is backbuffering in main memory not vram.
d) it can’t even blit a single 800x600 rectangle from main memory to vram at 60fps :-/

This means to get hardware acceleration you have to run under 1.3.1 AND force it on by setting a property.

FYI… on Mac OS X 10.3.2 JRE 1.4.2_03

I got the BufferCapabilities adding a few lines to the above test…
isFullScreenRequired()=false
isMultiBufferAvailable()=false
isPageFlipping()=false

No page flipping is lame. But even so a blit even if it is just a software copy loop shouldn’t be so slow.
Still investigating…

thats a sweet game :D. it has some cool ways of doing things, like the event handling code i like it… im finally into physics in science (lol in grade 10, so science is a mix of bio, chem and physics) so i will be able to understand more of your physics code.

Addition >

I can only run the SE version… i take it i cant run the non SE version because of my graphics card? i think you told me why already, but i forget if it was my card or drivers…? (dont laugh :P) NVidia TNT 2 is that the problem?

[quote]thats a sweet game :D. it has some cool ways of doing things, like the event handling code i like it… im finally into physics in science (lol in grade 10, so science is a mix of bio, chem and physics) so i will be able to understand more of your physics code.

Addition >

I can only run the SE version… i take it i cant run the non SE version because of my graphics card? i think you told me why already, but i forget if it was my card or drivers…? (dont laugh :P) NVidia TNT 2 is that the problem?
[/quote]
I honestly don’t know, I was under the impression the experimental flags enabled hardware acceleration through D3D on all windows machines [if the hardware supported it].
(and to my knowledge, there is no reason why an nvidia TNT 2 wouldn’t be able to support hardware alpha compositing)

Perhaps 1 of the Sun folk can shed some light on exactly what hardware capabilities are required for the experimental acceleration to work?

hi

the game is really fun to play with great graphics, but after 30 seconds my computer reboots, i have tried it 5 times and it reboots every time, but not after the exact time each time i try it. Its between 10 and 30 seconds before it reboots.
if it helps, here is the spec:

p4 2.4
512mb ram
asus p4p 800 deluxe mainboard
radeon 9800 pro 128mb ram
windows xp enterprise
with 6.14.10.6404 display driver

Set your computer to not reboot when it gets a blue screen of death. There might be something interesting on the bluescreen that you aren’t seeing. (Likely the graphics drivers crashing)

The game runs so f***ing fast ito the point it’s unplayable >:(

[quote]The game runs so f***ing fast ito the point it’s unplayable >:(
[/quote]
Sounds like you arn’t getting a vsync’ed BufferStrategy :-/
(I use the vsync for framerate limiting)

What machine are you running it on Java Cool Dude?

As for your bluescreen zulo, that sounds like something is pretty screwed somewhere :confused:
Are you running the version with the blurry effects? (not the SE version)
If so, then try the SE version.
If the SE version doesn’t crash, its something to do with D3D. I would say you either have buggy or corrupt drivers/DirectX install.
If the SE version crashes as well… then direct draw is buggy and/or corrupt :wink:

Either way, you should probably reinstall your display drivers & direct X (and check for any newer versions :/)

Radeon 9700 Pro
Amd Athlon 2.1 Ghz
512 mb DDR
Nforce 2 mobo

[quote]Radeon 9700 Pro
Amd Athlon 2.1 Ghz
512 mb DDR
Nforce 2 mobo
[/quote]
Very weird :-/

I don’t see any reason why that configuration would return a non-sycn’ed strategy :S

This is on a Windows box isn’t it?

Yup

Never mind me, I had VSync set to always off

Coo, can you get a vsynced buffer strategy in windowed mode?

Kev