Simply cool

while surfing I found this fantastic little physic game

very cool

This is so much fun.

note that this is also a game, once you have set the player and some fighter you move the player with keyboard arrows, this is really an amazing and fun applet

Really cool, I wish it was open source. How did he squeeze so much optimization out of Java2D, I wonder?

Small window size & direct pixel rendering, bypassing the accelerated pipeline entirely.
It’s all about memory bandwidth.

Fun physics demo!

I don’t get it. What am i supposed to do?

I’d classify it as a toy rather than a game.
Very interessting never-the-less. Thanks for sharing :slight_smile:

How is “bypassing the accelerated pipeline” going to improve performance?
I was under the impression that direct pixel rendering was incredible slow…
I may have misunderstud something though…

  • Scarzzurs

Sorry, I didn’t mean to imply doing this improves performance.
Going back to DemonPants original question:

The Applet achieves what it does in spite of Java2D, not because of it.
The perceived performance is high because the speed limitations have been well understood & factored into the overall design.

You’d be surprised what you can achieve when your rendering is just manipulating values in a ~120000 element array. (400x300)

How do you do that? All I know of is drawing to the raster in a BufferedImage, which obviously isn’t what you’re talking about.

Essencially yes, the fastest way to do pixel rendering in 1.2+ is to write to the array exposed through the Rasters underlying DataBuffer.
Obviously by doing this you have to tailor your per-pixel rasterizing code to a particular pixel format, so be sure you pick one that won’t require conversion when the Image’s raster is blitted to the screen.

I wrote a benchmark that draws 100 000 fractal generated pixels (varying positions) at 60 fps (400 000 with q6600 using all cores).
There is a 800x600 image drawn pixel per pixel per frame.

You can easily loop through an 800x600 int[] array several times at 60 fps and alter all pixels.