Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3
  ignore  |  Print  
  The Gloves Are Off  (Read 10240 times)
0 Members and 1 Guest are viewing this topic.
Offline princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Posted 2004-02-10 22:23:51 »

The Big Graphics Performance Challenge

Your goals:

60fps
800x600x16
A full screen of scrolling tiles of any size
32 bouncing sprites of 32x32 pixels. Alpha blended.
Must work on Win32, Linux, OSX.

You can have the fastest computer you like to achieve this.

Post your demos as a JNLP link reply to this thread... even if you can't manage it, let's see the best you can do.

Cas Smiley

Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #1 - Posted 2004-02-10 23:51:00 »

isn't there abit of sample code in jbanes' GAGE lib, that does pretty much exactly that?

It doesn't have the bouncing Alpha blended sprites.... but that isn't such a problem.... um... actually it is LOL

To get the needed render speed on the tiles, you will want the tiles to be managed Images, and be drawn onto a vram surface (BufferStrategy).

Alpha blending being unsupported in hardware, will need to read back from the BufferStrategies vram surface, do the blend, and then copy back.
This will absolutely *kill* performance.

3 solutions :-

1) Render everything using software loops, i.e. keep the tiles, the backbuffer, and the sprites in main memory.

This way, the readback from vram will be avoided, so the alpha blending wont kill the speed.

However, software blitting the tiles will be quite slow, and may prevent you reaching 60fps. (esp. @ 800x600)

2) Relax the requirements, and allow just bitmask transparency on the sprites.

3) Use the experimental D3D full alpha acceleration flags.

Specific to Windows, and even then it won't work on older gfx cards.

I agree though, Java2D is a mess atm :-/

It is impossible to write an app. that will run at optimal speed on all 3 platforms, with the same code
The hoops you have to jump through to get acceptable performance is crazy IMO.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #2 - Posted 2004-02-11 00:51:11 »

Hardee Har Har, - talk about stacking the deck in your favor; Fullscreen on Linux?  Well, I'll just pretend its 800x600 windowed  Roll Eyes

EDIT; Yeah, its tough, unless you use lwjgl wich is what he's getting at.

EDIT 2:  Here's my entry; arrows to walk around:

http://www.geocities.com/nonnus29/javademo2/demo.htm

I couldn't get the jar file to be executable, played with the manifest a couple of ways but no go. Don't think I can do webstart from geocities, really don't want to try.  

This is really odd; running from the jar its 10 fps slower on my comp; max fps is about 30.  There's no timing, it runs flat out.  800x600 windowed using BufferedImage (its not even a compatible BufferedImage, I had to have int rgb to do the blending Tongue)and BufferStrategy - probably some wasted effort there.  I've only tried it on windows, although there is nothing esoteric about the code.

Next?

Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline pepe

Junior Member




Nothing unreal exists


« Reply #3 - Posted 2004-02-11 05:33:27 »

works at 70-75fps on a p4 2.2ghz/radeon9000 on XP jre1.5.0beta1.
55fps under linux, same jre, same machine. unfortunatly, the opengl flag did not change anything.. (note to self... will have to rant about that) Saw some flashes, there.

Not fullscreen, but has nothing to do for the test and the jar is runnable.
I see this post as related to Cas's rant about awt, thus  fullscreen is there imho to help plugging LWJGL, and not to be related to any perf improvement. Let's take fullscreen out of that...

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline JasonB

Junior Member





« Reply #4 - Posted 2004-02-11 06:21:35 »

38fps on Gentoo Linux running on a 1.4Ghz laptop
Offline Bombadil

Senior Member





« Reply #5 - Posted 2004-02-11 07:40:56 »

Nonnus' Jar is double-clickable.

AMD with 1.8 GHz & Ati 9600pro:
Win2000:
° Java 1.42 client: ~110 fps.
° Java 1.42 server: ~120 fps.
(Using -Dsun.java2d.ddoffscreen=false or -Dsun.java2d.noddraw=true halves the framerate.)

Linux:
° Java 1.41 Blackdown: ~50 fps.
(Knoppix without HW accelerated graphics driver - so software rendering I suppose)
Offline princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #6 - Posted 2004-02-11 08:47:45 »

An impressive demo, marred only by using all of my CPU (2Ghz and 60fps, GeForce4) Smiley Those squares... are they actually sprites with alpha channels? Or just blitted rectangles?

Cas Smiley

ps. By full screen I didn't mean fullscreen mode, I just meant that the entire background had to be drawn each frame (ie. a tile on every square).

Offline overnhet

Junior Member




Java games rock!


« Reply #7 - Posted 2004-02-11 09:16:49 »

Win98, P4 2.8, GF4 Ti4200 => 150 FPS

There is just one little bug : when maximizing the window I only get a white screen.
Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #8 - Posted 2004-02-11 10:25:27 »

They are filled rectangles, I don't have a good particle image that isn't already blended with the backround, so my particles looked like crap Embarrassed  but they did give the same fps.

Hmm, now I wonder if it works on Mac osX?  
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #9 - Posted 2004-02-11 10:30:58 »

WinXP, 2.2 GHz M-Pentium, GeForce4 4200 Go - ~50 fps
using JDK 1.5 ßeta

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #10 - Posted 2004-02-11 11:02:33 »

And what about with 300 sprites?

Cas Smiley

Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #11 - Posted 2004-02-11 11:34:11 »

What exactly are you trying to prove cas?

We all know atm the Java2D pipeline doesn't hardware accelerate all that is necessary for a workable 2d game engine.
Until it does, Java2D will always be crap.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #12 - Posted 2004-02-11 11:39:46 »

Well, there was a chance I was wrong and I wanted to be shown how to do it Smiley But it looks like I might be right in thinking that it's not going to get any faster until someone rips out the DDraw code in Windows and replaces it with modern D3D code.

In the meantime I might continue with Lunar Lander and use bitmask transparency instead.

Cas Smiley

Offline pepe

Junior Member




Nothing unreal exists


« Reply #13 - Posted 2004-02-11 11:45:32 »

mhhh.
anyway, i'd be curious to see the GL pipeline working. if it does as correctly as it should this thread and all hidden meanings will be pointless.

About java2D. i don't agree it is crap. java2d is a wonderfully designed 2d API. It's just too slow for some of you.. (while by the way is not really what i thought when i tried the jar nonnus posted)
Anyway, it's still the problematic of the right tool for the right job.
By the way, there is a gl implementation of java2D that you might plug in. anyone tried it?
http://www.cs.umd.edu/hcil/agile2d/

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #14 - Posted 2004-02-11 12:13:17 »

IMO What we *realy* *realy* need (after the D3D acceleration has been fully implemented) is some kind of way to query the capabilities of a given GraphicsDevice.

1  
graphicsDevice.isAccelerated(operation, source, destination);


If a required part of the pipeline isn't hardware accelerated (a particuler AlphaComposite/AffineTransform op for instance), we can detect it, and either use a different op (precalc. rotations, bitmask instead of full alpha etc), or fall back entirely to software rendering.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #15 - Posted 2004-02-11 13:05:11 »

Ah, now, there's been many a heated debate on this in the OpenGL world. You have noticed that OpenGL does not give you any caps bits to say what is and isn't HW accelerated - and with good reason; it makes programming a total nightmare. GL only advertises capability, not performance.

I'd like Java2D to work like this. After all, it's meant to be easy to program, like GL. What's obvious here is that what Java2D is being used for is being seriously affected by its performance. You can't go writing tons of different renderers for all different permutations of hardware acceleration or you'd just lose all the advantage of an abstract toolkit in the first place, so you instead have to rely on the underlying technology to run the capabilities it has at the maximum performance achievable on common hardware. This means D3D on Windows. Or even OpenGL. I'd prefer GL, even on Windows.

So when I ask for 32 bit RGBA sprites, I get them no matter what; and most of the time they will be in a hardware accelerated pipeline because most computers have hardware accelerated 3D accelerators these days. But if not, then at least it could fall back to software. This is very similar to how GL is implemented. Successfully, I might add.

Cas Smiley

Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #16 - Posted 2004-02-11 14:01:28 »

hmm, I see the truth in GLs philosophy.

However, J2D doesn't seem to have decided which path they want to follow.
Consequently, we have an API that offers some performance querying functionality, but not enough for it to be of any use (+ive or -ive :/)

1  
2  
3  
4  
5  
ImageCapabilities class
BufferCapabilities class
VolatileImage.getCapabilities();
BufferStrategy.getBufferCapabilities();
BufferCapabilities.getBackBufferCapabilities();


tbh, the J2D seems to have lost its way :-/

On Windows :-

At the moment, new BufferedImage(.....) will get you an image stored in main memory only; (unmanaged)
graphicsConfiguration.createCompatibleImage(....) on the other hand will get you a BufferedImage stored in main memory, and eligable for caching in vram. (managed)

But, once created, there is no way(accessable to a user of the API) to distinguish between a managed and unmanaged image.
The 2 can behave very differently(from a performance perspective), under many circumstances.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #17 - Posted 2004-02-11 15:14:01 »

Under 1.5, all images will be placed in accelerated memory if possible. But unfortunately it's the "if possible" bit that's the sticking point; as soon as you're using alpha channels, it's no longer possible (by default, at any rate). Bah.

Cas Smiley

Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #18 - Posted 2004-02-11 16:18:49 »

Hmm, im gonna have to take a look at the 1.5 beta....

I wonder how it will handle calls to bufferedImage.getData() though, as it makes an image unmanagable... which in turn raises the old issue of how to determine if a bufferedImage is managed or not :-/

is a runnable jar too much work zparticle?
\/ \/ \/ \/ (or am i just lazy Tongue)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline zparticle

Senior Member




Thick As A Brick


« Reply #19 - Posted 2004-02-11 18:16:21 »

MY entry:

http://www.scottshaver2000.com/files/scroller.zip

Unzip it and use the run.bat file under Windows. Cursor keys to move, q to quit.

Copy the com\sas\planetation\examples\resources\maps\non_alpha_tile_29.png file to com\sas\planetation\examples\resources\maps\tile_29.png

to run it without alpha blending. The alpha blending costs me 30 FPS on my work machine and makes the CPU go from 7% to 56% usage.

I have a few issues in that code that make it not able to  run in a jar.

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #20 - Posted 2004-02-11 20:05:24 »

Quote
 Here's my entry; arrows to walk around:

http://www.geocities.com/nonnus29/javademo2/demo.htm


On Mac OS X 10.3.2  JRE 1.4.2_03  on a Powerbook 1GHz PPC G4
you ready?

FPS maxed out at eleven (11).  There was an issue with the screen flashing all white, I think when hitting an obstacle.  low FPS was all teh way down to 3 or 4.


Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #21 - Posted 2004-02-11 20:46:36 »

35fps with nonnus29's thingie Smiley

k7 500/128mb/gf2mx/1.4.2_03

win98se
Installed for 215wks 4days 9hrs 22mins 56secs (25/12/99)
Uptime: 1day 4hrs 39mins 41secs

So... imo it's ok. Doing the same thing in any other language won't be faster... blitting in VRAM... read back... transparent software blitting... and back to Vram - that is Tongue

弾幕 ☆ @mahonnaiseblog
Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #22 - Posted 2004-02-11 21:41:25 »

zparticle:  nice tiles!

alpha 24 fps - 866 p3, on board gfx

non alpha; max was 60 dipped to 35 when scrolling.  I'm going to check your code to see what you did differently...

Thats very worrisome about the mac osX performance!  

Note: in my code I use the BufferedImage....getData method to get an int[] for the backbuffer BufferedImage which I drawImage onto the BufferStrategy gc every loop, but I only get the int [] once at the beginning then keep modifying the array.  Just wanted to point that out from Abuse post.  Probably a unmanaged, nonvram image is  good in this case.

Still waiting for hardware accelerated smack down princec!
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #23 - Posted 2004-02-11 21:46:55 »

Quote
MY entry:

http://www.scottshaver2000.com/files/scroller.zip

Unzip it and use the run.bat file under Windows...


A whopping six and a half (6.5) FPS on Mac OS X 10.3.2  JRE 1.4.2_03  Powerbook 1GHz...  using 800x600 16 bit

The peak was 10, the low 2... not very impressive, and not playable really.  And I'm deducting points for your code "issues".  I like executable jars Smiley.
Although this one did run in fullscreen mode (the previous example only ran in a window).

Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #24 - Posted 2004-02-12 03:46:37 »

Heres your 300 blended sprites:

http://www.geocities.com/nonnus29/javademo2/demo300.htm

Runs ~20 fps on my old comp.

Changed the rectangles to actual snowflakes and fixed it so the objects only update positions at a max of 50x a second, but rendering runs full speed.  I put in rotation for the sprites but that reduced my fps to <10 for 300 sprites, non alpha blended.  You couldn't see the rotation anyway with all those sprites, heh, its a real blizzard.
Sad .

Still waiting for the guy who issued the challenge to come up with something....
Huh
Offline pepe

Junior Member




Nothing unreal exists


« Reply #25 - Posted 2004-02-12 06:16:27 »

nonnus: please read the board messager.

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline crouilla

Senior Newbie




Me fail English?  That's unpossible!


« Reply #26 - Posted 2004-02-12 06:28:39 »

The snowflake demo ran at 51 FPS on my PC (2.2 Athlon with a nice video card that obviously doesn't come into play very much with such a light program).  The original demo came in at 92 FPS.

I guess my question is -- what's with all the griping?  Seriously -- what are you guys trying to create that requires you to blit more than 1000 or so images to the screen simultaneously?  Obviously, you aren't going to get as good frame rates as native code, but I'm sure at least some of you were programming games for more than the past 5 years or so, when it became common to throw hardware at poorly-designed code than, ahem, OPTIMIZE it, and design the code for the system you were programming on.

Java2D is an easy-to-use library that gets decent results.  It's not Direct3D, but, then again, Direct3D is a pain in the butt to program (not as horrible as it once was, but it still isn't too much fun).  Discussing problems with an API is good, but complaining about it ad nauseum really doesn't help.  Wait for 1.5, and see what they've added to it.  If you think J2D sucks, there are other libraries out there... saying "see, it still sucks" really accomplishes nothing.
Offline princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #27 - Posted 2004-02-12 07:50:23 »

No, you are missing the point. The API is good, the implementation is poor. What's the difference between throwing a 2.4GHz processor at a problem or a useless ancient TNT? A TNT is capable of twice this performance in hardware using D3D (or GL) - but the Sun implementation does not use high performance APIs underneath. I'm saying, it's 2004, we've had the technology and the APIs in the real world to be able to achieve this reliably since the last millenium - why is the Java implementation still so slow?

(25-30fps with snowflakes. Yuk! And btw - I am running 1.5)

Cas Smiley

Offline pepe

Junior Member




Nothing unreal exists


« Reply #28 - Posted 2004-02-12 08:16:35 »

Sun's current  implementation 'sucks' to you? Then, why not using an other implementation?
There is the agile2D that  uses gl4java . it is reported as a great boost when using alpha compositing, and a boost in general.  there are others....
I guess than simply ranting is faster than testing an API and asking for debate about intelligent subjects, like 'how to make sun integrate that other XXX pipeline as a default one', or 'what are the best alternate java2D implementations for gaming?'
Or, even better,  starting a new thread like ' why don't we make a fast lightweight java gaming java2d library based on a GL pipeline that will please us' and implementing one...... this is something that could have been done.... mmhhhh.... three years ago, i think...
man, all that energy lost for nothing....

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #29 - Posted 2004-02-12 09:20:58 »

You're missing the point, too Smiley
Here, I'm talking about the standard implementation, the one that ships, the one everyone's stuck with, the API everyone knows. I'm talking about out-of-the-box, It Just Works. I'm talking about suddenly accelerating all those existing apps.

What I'm not talking about is using LWJGL or JOGL. I could whip up a sprite demo using LWJGL and shame every demo in here but that's not the point of what I'm saying. I'm asking: why is Java 2D still so slow after nearly a decade?

Cas Smiley

Pages: [1] 2 3
  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.

pw (8 views)
2014-07-24 01:59:36

Riven (9 views)
2014-07-23 21:16:32

Riven (11 views)
2014-07-23 21:07:15

Riven (11 views)
2014-07-23 20:56:16

ctomni231 (42 views)
2014-07-18 06:55:21

Zero Volt (38 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (34 views)
2014-07-16 23:30:00

Cero (49 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!