Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (481)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
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] 4
  ignore  |  Print  
  World Rally Driver 4K  (Read 22756 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #60 - Posted 2009-01-11 00:31:45 »

Edit:  I have now removed the use of VolatileImages.  I have also put in a check to see if the CPU is struggling, if it is, it turns off anti-aliasing and quality rendering.  Moogie, did this solve the problem?  Thanks.

yep, works perfectly now Smiley no performance issues here but this lap top is not exactly low spec either.
Offline timfoden

Junior Member


Projects: 2



« Reply #61 - Posted 2009-01-11 09:36:06 »

Just tried it on my system, and it didn't lock up.  However, I'm running Vista and Firefox 3.  Do any other Applets lock up when you do this?

No, other applets are fine.  This was something that began happening fairly recently.  However, your latest version (that doesn't use VolatileImage anymore?) is now fine again.

The only minor gripe I have is the 100% cpu thing... so I'd vote for changing the the yield() to a sleep(1).

Cheers, Tim.

Try Pipe Extreme -- can you get to the end of the pipe?
Offline Ranger
« Reply #62 - Posted 2009-01-11 22:07:27 »

No, other applets are fine.  This was something that began happening fairly recently.  However, your latest version (that doesn't use VolatileImage anymore?) is now fine again.
Yay!  I'm quickly realising VolatileImages suck.   Smiley

The only minor gripe I have is the 100% cpu thing... so I'd vote for changing the the yield() to a sleep(1).
Done.   Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ranger
« Reply #63 - Posted 2009-01-11 22:11:16 »

Thanks for having a look.
Browser:  Opera 9.63 Build 10476

Edit:  Submitting works with Firefox.   3rd place (for some time)  Cool

Hi Toasten,

I've changed the input box to a textarea.  When you get a chance, can you see if you can now enter replay data using Opera?  Also, are you able to load replay data using Opera?

Thanks!
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #64 - Posted 2009-01-11 22:12:49 »

> Yay!  I'm quickly realising VolatileImages suck.

Have you tried using BufferStrategy instead of VI for your back-buffer?

Dmitri
Offline toasten

Junior Member





« Reply #65 - Posted 2009-01-11 23:02:43 »

Retested with Opera.
When saving, it says i made it to Top100 but it didn't show up in the List  Sad   Used Name: "OperaTest"
Using the same data in Firefox, also didn't work. Seems like the Highscore is broken.

But i think it's working in general. As now the correct end of the String shows in the input-box.

Loading works without problems.  Smiley
Offline Ranger
« Reply #66 - Posted 2009-01-12 13:01:04 »

Retested with Opera.
When saving, it says i made it to Top100 but it didn't show up in the List  Sad   Used Name: "OperaTest"
Using the same data in Firefox, also didn't work. Seems like the Highscore is broken.

But i think it's working in general. As now the correct end of the String shows in the input-box.

Loading works without problems.  Smiley
I have some duplicate testing on my server.  If the IP Address or the Players Name matches, then it treats it as a duplicate and only keeps the best score.  Thanks for testing, looks like it now works for Opera!   Smiley  ...not the first time I've had to jump through hoops for Mac s/w.   Wink
Offline Ranger
« Reply #67 - Posted 2009-01-12 13:05:54 »

Thanks to javap and now an unhealthy knowledge of Java byte code  Shocked  I've managed to squeeze more bytes out and put back most of the features I had to take out for the replay data.  Now the game is done!  ...I think  persecutioncomplex  Huge thanks to everyone for helping me out!  Java Gamers Rock!!!  Cool
Offline Ranger
« Reply #68 - Posted 2009-01-14 09:41:48 »

Dear Mr Foden,

Sorry, I could no longer stand being second.

Kind regards,
Craigo.

 Smiley
Offline irreversible_kev

Junior Member





« Reply #69 - Posted 2009-01-14 10:01:23 »

Are you going to extend the game with more tracks, more cars and online play?

Also it would be really cool if you could watch replays as well as race against them. I need to see your 1072 in Sweden !
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ranger
« Reply #70 - Posted 2009-01-14 11:37:54 »

Are you going to extend the game with more tracks, more cars and online play?
Yes....but not for the 4k competition.  It's right on 4096 bytes right now and that's after looking at the byte code to optimise it.

Also it would be really cool if you could watch replays as well as race against them. I need to see your 1072 in Sweden !
You can!  Just click on the replay link, then copy the data and paste it into the game (after pressing R in the game).
Offline timfoden

Junior Member


Projects: 2



« Reply #71 - Posted 2009-01-14 13:37:21 »

Sorry, I could no longer stand being second.
Craigo.
 Smiley

  ... but as all can see (if they watch the replay anyway), you cheated!  Tongue

So now the question is... are you going to fix the bug, or should I try and beat you by cheating too?  Wink

Cheers, Tim.

Try Pipe Extreme -- can you get to the end of the pipe?
Offline Ranger
« Reply #72 - Posted 2009-01-14 13:51:44 »

  ... but as all can see (if they watch the replay anyway), you cheated!  Tongue
I know...  the shame... the shame !!!

I'm going to try to fix it.  Just not sure where I'm going to find the bytes right now.   Undecided

Edit:  Bug fixed.  Also improved performance (I hope).
Offline cylab

JGO Ninja


Medals: 43



« Reply #73 - Posted 2009-01-16 14:35:00 »

Also improved performance (I hope).

Did you change rendering hints? doesn't look as nice as before :/

Mathias - I Know What [you] Did Last Summer!
Offline Ranger
« Reply #74 - Posted 2009-01-17 12:19:25 »

Did you change rendering hints? doesn't look as nice as before :/

Yes, I did.  Well spotted!  But now they're back.  However, if the game can't keep the frame rate at 30 fps, then they will get switched off automatically.

My boss bought a MacBook Air, and I tried my game out on it.  It ran terribly (it ran a little better when I turned off the rendering hints).  However, when we booted the MacBook Air up on WinXP, it ran fine, so I guess the Mac JVM is just poorly implemented?  Anyone have the same experience with the Mac JVM?
Offline Mr. Gol

Senior Member


Medals: 1



« Reply #75 - Posted 2009-01-17 13:12:23 »

Anyone have the same experience with the Mac JVM?

Yes, the animation is very jerky now. But in previous versions everything was fine, did you change some fundamental things in how the animation works?
Offline Ranger
« Reply #76 - Posted 2009-01-17 16:41:23 »

Yes, the animation is very jerky now. But in previous versions everything was fine, did you change some fundamental things in how the animation works?

Hi Mr Gol,

Yes, I changed my game loop and removed the use of VolatileImages.  I've now modified the game loop again.  Can you please see if this has fixed the problem?

Thanks!
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #77 - Posted 2009-01-18 06:37:59 »

The problem with mac jvm is that it's 1.5. On XP you're likely to have 1.6 of some sorts. 1.5 had really bad performance in some cases (XP or MacOS)..

Dmitri
Offline Ranger
« Reply #78 - Posted 2009-01-18 07:04:00 »

The problem with mac jvm is that it's 1.5. On XP you're likely to have 1.6 of some sorts. 1.5 had really bad performance in some cases (XP or MacOS)..
Dmitri

Ah!  Yes!  Thanks Dmitri.  I switched back to 1.5 on my PC, and I now see the slow performance.  ...now to fix it.  Tongue

Edit1:  And my game is much easier when it runs really slowly!  Just set a new record on USA.......I wonder if Mr Foden has been playing on a 1.5 JVM?   Roll Eyes
Edit2:  The problem is gfx.rotate(...) seems to be inefficient in 1.5 (I am rotating a somewhat large 2000x2000 image  Roll Eyes).  Not sure how I can fix this as rotating the image is a core part of my game.   Sad
Offline timfoden

Junior Member


Projects: 2



« Reply #79 - Posted 2009-01-18 17:35:08 »

I wonder if Mr Foden has been playing on a 1.5 JVM?   Roll Eyes

Nope.  As you can see with my bug report earlier, I'm running with 1.6.0_07... Tongue

But now that I know it's slower on 1.5... Wink  (no, just kidding)

Cheers, Tim.

Try Pipe Extreme -- can you get to the end of the pipe?
Offline Mr. Gol

Senior Member


Medals: 1



« Reply #80 - Posted 2009-01-18 18:52:01 »

Hi Mr Gol,

Yes, I changed my game loop and removed the use of VolatileImages.  I've now modified the game loop again.  Can you please see if this has fixed the problem?

Thanks!

The speed is still nowhere near to what it was before I'm afraid Sad
Offline Ranger
« Reply #81 - Posted 2009-01-19 13:38:08 »

Just added some checking to stop people from uploading fast times if the game runs too slow.  Fear not Java 1.5 people, there is now a low detail version that doesn't use the large BufferedImage, so it should run silky smooth (but not look as pretty).  There is a link on the main page that points here.

TimFoden:  To save some more much needed space, I modified some more stuff that modified the car speed a little, so you'll notice that your top time replay actually drives a little slower then the new car.  Sorry!  ...not that anyone has come close the beating that time anyway!  Roll Eyes

Mr Gol:  If it did run quickly before, I'm at a loss as to why.  All my testing points to my large BufferedImage being the cause of the slow down, and that has been there since day 1.  Undecided

Oh, and the old replay data cannot be submitted to the server, so make sure you close and reopen your browser to get the latest version if you would like to submit your replays.

Thanks all!  Smiley
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #82 - Posted 2009-01-19 19:46:01 »

Ah!  Yes!  Thanks Dmitri.  I switched back to 1.5 on my PC, and I now see the slow performance.  ...now to fix it.  Tongue

Edit2:  The problem is gfx.rotate(...) seems to be inefficient in 1.5 (I am rotating a somewhat large 2000x2000 image  Roll Eyes).  Not sure how I can fix this as rotating the image is a core part of my game.   Sad

Yeah,  transforming a 2000x2000 image would indeed suck on 1.5. Do you set bilinear filtering hint?
I would suggest to disable bilinear filtering on 1.5 jvms.

What's the image type of that BufferedImage?

Also, could you run your applet with -Dsun.java2d.trace=count and post the output on 1.5 vm?

Dmitri
Offline Ranger
« Reply #83 - Posted 2009-01-20 08:40:32 »

Yeah,  transforming a 2000x2000 image would indeed suck on 1.5. Do you set bilinear filtering hint?
I tried setting: g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);  It did help...but not that much.

What's the image type of that BufferedImage?
TYPE_INT_RGB

Also, could you run your applet with -Dsun.java2d.trace=count and post the output on 1.5 vm?
67 calls to sun.java2d.loops.ScaledBlit::ScaledBlit(IntRgb, SrcNoEa, IntRgb)
12062 calls to sun.java2d.loops.MaskFill::MaskFill(AnyColor, SrcOver, IntRgb)
696 calls to sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)
26 calls to GDIFillRect
7218 calls to sun.java2d.loops.FillSpans::FillSpans(OpaqueColor, SrcNoEa, AnyInt)
2876 calls to sun.awt.windows.Win32GdiBlitLoops::Blit(IntRgb, SrcNoEa, "GDI")
696 calls to sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, IntRgb)
30546 calls to sun.java2d.loops.MaskFill::MaskFill(AnyColor, Src, IntRgb)
1 call to sun.java2d.loops.DrawGlyphList::DrawGlyphList(OpaqueColor, SrcNoEa, AnyInt)
316 calls to sun.java2d.loops.FillRect::FillRect(OpaqueColor, SrcNoEa, AnyInt)
54504 total calls to 10 different primitives


Any help much appreciated!!!

Thanks!
Offline cylab

JGO Ninja


Medals: 43



« Reply #84 - Posted 2009-01-20 12:24:33 »

The problem is gfx.rotate(...) seems to be inefficient in 1.5 (I am rotating a somewhat large 2000x2000 image  Roll Eyes).  Not sure how I can fix this as rotating the image is a core part of my game.   Sad

You could only rotate the visible part on screen.

Mathias - I Know What [you] Did Last Summer!
Offline Ranger
« Reply #85 - Posted 2009-01-20 13:19:45 »

You could only rotate the visible part on screen.

Not quite sure how to do that.   Huh  Currently I have my 500x500 screen buffered image that I do the rotate (and translate + scale) on.  The I say paint the 2000x2000 background buffered image (the slow bit).  If the Java 2D Graphics code was smart, it would work out what part of the 2000x2000 buffered image was in the 500x500 screen buffered image, and only rotate that bit.....no clue if it does this or not.  Maybe that's the difference between Java 1.5 and 1.6?   Undecided
Offline cylab

JGO Ninja


Medals: 43



« Reply #86 - Posted 2009-01-20 13:38:22 »

Hmm, try it out: copy a 710x710 image around your car position from the 2000x2000 image to another BufferedImage and draw that one to the screen buffer.

Edit - In case you wonder: 710 because it's slightly greater than the diagonal of your 500x500 screen. This way you make sure that the image is big enough to fill the entire viewport when rotated.

Mathias - I Know What [you] Did Last Summer!
Offline Ranger
« Reply #87 - Posted 2009-01-21 12:21:40 »

Hmm, try it out: copy a 710x710 image around your car position from the 2000x2000 image to another BufferedImage and draw that one to the screen buffer.

Edit - In case you wonder: 710 because it's slightly greater than the diagonal of your 500x500 screen. This way you make sure that the image is big enough to fill the entire viewport when rotated.

I read your comment and slapped my self in the head.  Can't believe I didn't think of doing this!  Brilliant idea!  Smiley

I had to make the image 1012x1012, as while the screen is 500x500, it gets rotated around the point of the car which sits at the position (250,440).  1012x1012 is still almost 4 times smaller then the original image, and it has made all the difference when running on Java 1.5.  Woohoo!   Grin

Thank you Cylab!  You are a legend!!!   Cool

If anyone notices it still runs slowly.  Please let me know.

Cheers.
Offline cylab

JGO Ninja


Medals: 43



« Reply #88 - Posted 2009-01-21 12:42:58 »

I had to make the image 1012x1012, as while the screen is 500x500, it gets rotated around the point of the car which sits at the position (250,440).  1012x1012 is still almost 4 times smaller

Am I missing something here?

If you have a viewport of 500x500, I think you need a rect of the viewport-diagonale to safely rotate the rect while filling the whole viewport. The diagonale is sqrt(500^2*500^2) ~ 708, so when (x,y) is the car position, you would need a subimage from (x-354, y-354) to (x+354, y+354).

Edit: And in case you aren't already doing it, use BufferedImage.getSubimage() for this.

Mathias - I Know What [you] Did Last Summer!
Offline Ranger
« Reply #89 - Posted 2009-01-21 12:58:02 »

Am I missing something here?

If you have a viewport of 500x500, I think you need a rect of the viewport-diagonale to safely rotate the rect while filling the whole viewport. The diagonale is sqrt(500^2*500^2) ~ 708, so when (x,y) is the car position, you would need a rectagle from (x-354, y-354) to (x+354, y+354).

This is true if you rotate around the middle (250,250).  However, I need to rotate around the the point 250,440 (where the car is).  So that's sqrt(250^2 + 440^2) * 2 = 1012.  ....I think.   persecutioncomplex
Pages: 1 2 [3] 4
  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.

atombrot (26 views)
2014-08-19 09:29:53

Tekkerue (24 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (14 views)
2014-08-16 06:20:21

Tekkerue (20 views)
2014-08-16 06:12:11

Rayexar (59 views)
2014-08-11 02:49:23

BurntPizza (38 views)
2014-08-09 21:09:32

BurntPizza (30 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
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!