kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
on:
2004-04-25 13:21:24 » |
|
I've just complete the source for the next space invaders tutorial. The JNLP is here: http://www.cokeandcode.com/spaceinvaders102/si102.jnlpthe source code for those interested can be found here: http://www.cokeandcode.com/spaceinvaders102/spaceinvaders102.zipThere should be very little difference in the demo to the original version. I've not got the ability at the moment to test on Linux and MacOS, so any problems let me know. The tutorial is going to cover: a) Seperating rendering from logic b) Refactoring and using package (aimed at C++ folks who seem to be afraid of using namespaces  ) c) OpenGL initialisation (JOGL) d) Using OpenGL for 2D games e) Discussion of abstracting Java2D/OpenGL, the benefits of rendering with OpenGL f) Anything else that comes to mind as its written  Kev
|
|
|
|
blahblahblahh
JGO Kernel      Posts: 4575
http://t-machine.org
|
 |
«
Reply #1 on:
2004-04-25 13:27:12 » |
|
Works fine on linux. It is also just as jerky in OGL as the original was (especially the player's ship is jerky, and the invaders less so - nb they also appear to flicker a lot (the invaders) in OGL mode? [windowed, of course]). So, that would seem to confirm it's your timer code or else input-event-handling that is causing the jerkiness? PS that's one FAT ASS invaders clone!  lol
|
malloc will be first against the wall when the revolution comes...
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #2 on:
2004-04-25 13:29:41 » |
|
Arse, you mean the old one didn't sort out the problems on your machine? I thought it had gone away? I'm really starting to worry about your linux box in particular  I've tested the original version on my couple (which are currently dead), smooth a silk. Most confusing. Could you mail me the hardware spec or something? Kev PS. Fat ass! Damn right, thats one of the things I want to mention in the tutorial, how much you have to ship to get OpenGL in Java.
|
|
|
|
Games published by our own members! Go get 'em!
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #3 on:
2004-04-25 15:21:03 » |
|
If you get a chance, could you try it again. I was seeing a similar sort of lack of control under linux which seems to have been cleaned up now. Seemed to be related to the keypressed/keyreleased issues again.
Kev
|
|
|
|
nonnus29
JGO Ninja    Posts: 687
Giving Java a second chance after ludumdare fiasco
|
 |
«
Reply #4 on:
2004-04-25 15:23:25 » |
|
Runs fine for me, I'd still like to see that fps counter 
|
|
|
|
|
blahblahblahh
JGO Kernel      Posts: 4575
http://t-machine.org
|
 |
«
Reply #5 on:
2004-04-25 17:48:54 » |
|
If you get a chance, could you try it again. I was seeing a similar sort of lack of control under linux which seems to have been cleaned up now. Seemed to be related to the keypressed/keyreleased issues again.
Kev 1. JWS didn't seem to download any new data (tried twice - maybe it went by REALLY fast?) 2. No appreciable difference (could have been a very slight improvement, not sure?)
|
malloc will be first against the wall when the revolution comes...
|
|
|
swpalmer
JGO Kernel      Posts: 3438 Medals: 4
Where's the Kaboom?
|
 |
«
Reply #6 on:
2004-04-25 19:52:28 » |
|
Broken on Mac:
java.lang.UnsatisfiedLinkError: /Users/scottpalmer/Library/Caches/Java Web Start/cache/http/Dwww.cokeandcode.com/P80/DMspaceinvaders102/DMlib/RNjogl-macos-native.jar/libjogl.jnilib: at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1469) at java.lang.Runtime.loadLibrary0(Runtime.java:788) at java.lang.System.loadLibrary(System.java:834) at net.java.games.jogl.impl.NativeLibLoader.<clinit>(NativeLibLoader.java:48) at net.java.games.jogl.impl.GLContext.<clinit>(GLContext.java:51) at net.java.games.jogl.impl.macosx.MacOSXGLContextFactory.createGLContext(MacOSXGLContextFactory.java:49) at net.java.games.jogl.GLCanvas.<init>(GLCanvas.java:70) at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:94) at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:80) at org.newdawn.spaceinvaders.jogl.JoglGameWindow.startRendering(JoglGameWindow.java:101) at org.newdawn.spaceinvaders.Game.<init>(Game.java:75) at org.newdawn.spaceinvaders.Game.main(Game.java:324) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sun.javaws.Launcher.executeApplication(Launcher.java:844) at com.sun.javaws.Launcher.executeMainClass(Launcher.java:804) at com.sun.javaws.Launcher.continueLaunch(Launcher.java:682) at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:397) at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:199) at com.sun.javaws.Launcher.run(Launcher.java:167) at java.lang.Thread.run(Thread.java:552)
|
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #7 on:
2004-04-26 00:27:56 » |
|
Just uploading new bits: * A version number of the title bar so we can be sure we've got the same version * JNLP with "Mac OS" changed to "MacOS", could you tell me what the os.name System property is set to on MacOS? * Different JOGL libs for macos. Could you let me know if this makes any difference, I've had trouble with webstart on MacOS as long as I've been using it. Might be nice to sort them out One success, cheers Nonous, frame counter is even more annoying now since to add it for jogl I'd have to go into the details of using text in OpenGL (which might be a bit much). Kev
|
|
|
|
blahblahblahh
JGO Kernel      Posts: 4575
http://t-machine.org
|
 |
«
Reply #8 on:
2004-04-26 01:38:04 » |
|
1 2 3 4 5 6 7
| Runtime rt = Runtime.getRuntime(); add( new JLabel( "<html>The latest version of Java is available from<p><a href=\"http: add( new JLabel( "<html>Java Vendor: "+System.getProperty( "java.vendor" )+"<P>"+"Java Version: "+System.getProperty( "java.version" )+"<P>"+"Free Memory: "+rt.freeMemory()+"<P>"+"Max Memory: "+rt.maxMemory() ) ); add( new JLabel( "<html>OS name: "+System.getProperty( "os.name" )+"<P>"+"OS version: "+System.getProperty( "os.version" )+"<P>"+"OS architecture: "+System.getProperty( "os.arch" )+"<P>"+"Num Processors: "+rt.availableProcessors() ) ); |
...is copy/pasted code with removal of local lib-specific calls, that *should* give you all the pertinent info (taken directly from the code that auto-generates the "About Java Version" dialog for our GUI tools; very useful when doing support!). IIRC, if inserted in a JComponent of some sort, those labels will all work as required. On a related note, perhaps Kev you could do a followup to your JWS article, one which *specifically* concentrates on the OS-specific sections, given how many there are to cover, and e.g. lists which JVM (vendor + OS) reports each? (assuming you can get some help from users of esoteric VM's  )
|
malloc will be first against the wall when the revolution comes...
|
|
|
blahblahblahh
JGO Kernel      Posts: 4575
http://t-machine.org
|
 |
«
Reply #9 on:
2004-04-26 01:40:12 » |
|
PS I have v0.1 now, and nothing else has changed.
|
malloc will be first against the wall when the revolution comes...
|
|
|
Games published by our own members! Go get 'em!
|
|
princec
« League of Dukes » JGO Kernel      Posts: 8089 Medals: 96
Eh? Who? What? ... Me?
|
 |
«
Reply #10 on:
2004-04-26 02:44:07 » |
|
Ewww, jerk-o-matic! Both versions jerk equally nasty. Are you using some dodgy timing code in there? Sure looks like it! Cas 
|
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #11 on:
2004-04-26 02:49:46 » |
|
What platform you using Cas? If its old Windows, then the timing doesn't use a highres timer which might cause the jerkyness.
The code for movement is just standard,
* Calculate delta since last render * Move entities/sprites based on movement-speed * delta * Redraw
Kev
|
|
|
|
Orangy Tang
JGO Kernel      Posts: 2960 Medals: 37
Monkey for a head
|
 |
«
Reply #12 on:
2004-04-26 03:03:25 » |
|
Nice and smooth here in OpenGL, mostly smooth in Java2D (very slight juddering). WinXP, GeForce4 Ti. 
|
|
|
|
princec
« League of Dukes » JGO Kernel      Posts: 8089 Medals: 96
Eh? Who? What? ... Me?
|
 |
«
Reply #13 on:
2004-04-26 05:10:04 » |
|
WinXP Pro, Dual 1Ghz, Radeon 8500, 700Mb RAM. Should be smooth as a baby's bum, methinks. Cas 
|
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #14 on:
2004-04-26 05:26:13 » |
|
Erk, I'd agree, it should be as alike to a baby's bum as the bum of a baby...
Wonder what the flip is going on, I'll try letting it run as fast as, tonight and hopefully that'll tidy things up.. OOI Cas, have you tried Mini Adventure? If so, is that as jerky as Tony Blair too?
Kev
|
|
|
|
swpalmer
JGO Kernel      Posts: 3438 Medals: 4
Where's the Kaboom?
|
 |
«
Reply #15 on:
2004-04-26 09:49:50 » |
|
* JNLP with "Mac OS" changed to "MacOS", could you tell me what the os.name System property is set to on MacOS? * Different JOGL libs for macos. Could you let me know if this makes any difference, I've had trouble with webstart on MacOS as long as I've been using it. Might be nice to sort them out You had the os.name correct... it did download JNI libs. os.name = "Mac OS X" Maybe the new Mac JNI libs will fix it. (But you will have to change back the os name  )
|
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #16 on:
2004-04-26 10:49:18 » |
|
Updated the JNLP for "Mac OS" (I actually ripped the MacOS tag from AlienFlux jnlp?) I've also changed the timing so instead of attempting to wait for 10 milliseconds between frames, we only wait for 1. Maybe this will smooth things out a bit.. Added a FPS counter to the title of window  Kev
|
|
|
|
swpalmer
JGO Kernel      Posts: 3438 Medals: 4
Where's the Kaboom?
|
 |
«
Reply #17 on:
2004-04-26 13:39:58 » |
|
Works great now. OpenGL 360fps Java2D 39 fps Yeah, OpenGL is a bit better 
|
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #18 on:
2004-04-26 13:44:23 » |
|
Fantastic news, thanks for the retest!
Any news on when Apple are going to sort out their graphics pipeline and make Java2D accelerated? Its the only thing stopping me buying a PowerBook.
Kev
|
|
|
|
oNyx
JGO Kernel      Posts: 2943 Medals: 5
pixels! :x
|
 |
«
Reply #19 on:
2004-04-26 15:06:43 » |
|
Java2D 290-340 fps OpenGL 78-80 fps  /me turns vsync off OpenGL 250-270 fps Odd 
|
|
|
|
erikd
JGO Kernel      Posts: 2561 Medals: 7
Maximumisness
|
 |
«
Reply #20 on:
2004-04-26 15:38:45 » |
|
At 'Press space to start':
J2D: 430-440 FPS OGL: 475-480 FPS
|
|
|
|
blahblahblahh
JGO Kernel      Posts: 4575
http://t-machine.org
|
 |
«
Reply #21 on:
2004-04-26 16:25:26 » |
|
OGL and j2d both at 50 FPS almost all the time, occasionally rise to 51 for a few moments, or drop to 49 for a few moments (less than a second). This is on an LCD monitor running I believe at 60 Hz - certainly, the XF86 config allows X to choose a range of anything in "60 - 60" which is pretty unambigious  .
|
malloc will be first against the wall when the revolution comes...
|
|
|
Abuse
JGO Kernel      Posts: 1866 Medals: 5
falling into the abyss of reality
|
 |
«
Reply #22 on:
2004-04-26 17:19:16 » |
|
J2D starts off at 90-91, once I kill a few enemies the fps goes crazy 300-400-500fps. It stop around 500-600 ish, though its very erratic and the game is *very* jerky.
the ogl version runs at a constants 60fps, vsync'ed i guess.
|
|
|
|
|
princec
« League of Dukes » JGO Kernel      Posts: 8089 Medals: 96
Eh? Who? What? ... Me?
|
 |
«
Reply #23 on:
2004-04-26 17:55:08 » |
|
blah^3 - LCD monitors claim to refresh at 60Hz but in fact sync at 50-52Hz. Don't know why. One of the reasons AF was so hard to begin with was because my Inspiron synced at 52Hz when I thought it was 60Hz - so everyone else got a game that ran 20% faster! Cas 
|
|
|
|
swpalmer
JGO Kernel      Posts: 3438 Medals: 4
Where's the Kaboom?
|
 |
«
Reply #24 on:
2004-04-26 20:54:14 » |
|
Fantastic news, thanks for the retest!
Any news on when Apple are going to sort out their graphics pipeline and make Java2D accelerated? Its the only thing stopping me buying a PowerBook. Apple NEVER tells what they are doing.. they only announce it when it is done... but there have been strong hints that they want to get the openGL pipeline from 1.5 and use it. I think that if their Java team is a bit small that is probably the best use of their resources. They are well aware of the graphics performance issues so I really think they will have a great 1.5 implementation. They have been addressing performance to some degree in their 1.4 updates. I forgot to mention that the OpenGL version played much smoother in general on the Mac.. but that is to be expected.
|
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #25 on:
2004-04-27 00:34:11 » |
|
Looks like I either have to bring in a high res timer or just give it up... I didn't really want to bring in a high res timer as it adds complexity when writing the assocaited tutorial.
I supposes I could do the 4k contest thing and go fullscreen and rely on vsync to slow the world down..
Ok, one more test, replace the sleep all together with Thread.yield(). I guess currentTimeMillis() is still not going to be good enough on some systems.
Kev
PS: Source is updated also.
|
|
|
|
oNyx
JGO Kernel      Posts: 2943 Medals: 5
pixels! :x
|
 |
«
Reply #26 on:
2004-04-27 01:37:13 » |
|
1 2 3 4 5 6 7 8 9 10 11 12 13
| private int get2Fold(int fold) { int ret = 2; while (ret < fold) { ret *= 2; } return ret; }
|
The smallest power of two value is 1(2^0) and not 2(2^1) 
|
|
|
|
kevglass
« League of Dukes » JGO Kernel      Posts: 5214 Medals: 49
Mentally unstable, best avoided.
|
 |
«
Reply #27 on:
2004-04-27 02:24:12 » |
|
Yeah, fair point  A 1 pixel height or width texture would be scary, but I spose you pixel twiddlers do that sort of thing.. I'll update it, and the german->english documentation at the same time (grabbed this code from an old project) Kev
|
|
|
|
oNyx
JGO Kernel      Posts: 2943 Medals: 5
pixels! :x
|
 |
«
Reply #28 on:
2004-04-27 04:46:11 » |
|
> A 1 pixel height or width texture would be scary, but I > spose you pixel twiddlers do that sort of thing Well, there was a weird way doing cel shading with a 1D texture (without doubling the poly count) and something else, I've forgotten. But, y'know, with one 1x4096 (extreme unlikely) texture you would waste as much space as a big fat ultra huge 64x64 texture 
|
|
|
|
oNyx
JGO Kernel      Posts: 2943 Medals: 5
pixels! :x
|
 |
«
Reply #29 on:
2004-04-27 23:03:39 » |
|
Hmm... in the texture loader there is a comment at the very beginning, stating that it's from the wiki, but I coudn't find it there.
Oh great I have to login in order to be allowed using the search function ._.
Oh and the search on the left side doesn't do anything. Awesome! Now I have 3 ways to reload the page :-/
|
|
|
|
|