Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Choppy rendering  (Read 334 times)
0 Members and 1 Guest are viewing this topic.
Offline VaPS

Junior Member


Medals: 1



« Posted 2013-09-01 04:25:04 »

I had some problems with choppy rendering where the game would look like it was rendering a frame behind every other frame, mildly straining my eyes.
After some minutes of fooling around I might have solved the problem. What I did differently was using more precision in my game loop (using time in nanoseconds and not milliseconds, exchanging floats for doubles).

My question is, is this all a coincidence and I did not solve the problem and if so, what may be causing the problem?

I'm utilizing JFrame, triple-buffering & basically the loop everyone else is using.
Here is the entire Game class: http://pastebin.com/G9zSb73L

For clarification, the game window is not flickering with black & white images. I just found there are a lot of people having problems with that so I want to make it clear I do not have that problem. Keeping it safe here.


---

Upon launching my game, the canvas in my JFrame is unrendered for one frame. It's basically a grey rectangle flashing before the game starts like every other game. Is there a way of avoiding that?

Here's the code:
http://pastebin.com/yqqZZGbu
Offline opiop65

JGO Kernel


Medals: 124
Projects: 7
Exp: 3 years


Team Alluminum


« Reply #1 - Posted 2013-09-01 04:31:22 »

I think, however I don't know, that you should be setting unprocessed back to 0 every frame as its the delta between two frames. Right now you're subtracting 1 from it and I honestly don't know why you are. Also, triple buffering may be a but much, double should be fine and it'll be less resource intensive. Going from double to triple causes around a 50fps drop on my decent setup.
Edit: any way you could post a video about whats actually happening? I don't really know what you mean by its rendering frames behind other frames.

Offline VaPS

Junior Member


Medals: 1



« Reply #2 - Posted 2013-09-01 15:20:04 »

I think, however I don't know, that you should be setting unprocessed back to 0 every frame as its the delta between two frames. Right now you're subtracting 1 from it and I honestly don't know why you are. Also, triple buffering may be a but much, double should be fine and it'll be less resource intensive. Going from double to triple causes around a 50fps drop on my decent setup.
Edit: any way you could post a video about whats actually happening? I don't really know what you mean by its rendering frames behind other frames.
It seems changing the buffering has solved it, independent of if I'm using nanoseconds or milliseconds!

To answer the delta thing let's say it takes 32 milliseconds to get to the next frame/update (let's imagine we have the world's slowest PC). That means we need to update the game twice in order to not affect the speed of the game. That's why I have a loop which keeps that in order.

And the edit question: I don't know if that would be possible since YouTube only allows for 30 FPS and not 60 which the game is locked at. The best explanation I can give really is this:
You're going to the right. However, every third or second frame or so it looks like the game throws an outdated frame of the game. So if we say we walk to right every now and then a frame would pop up showing the character some pixels behind.

Thanks for the reply!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline VaPS

Junior Member


Medals: 1



« Reply #3 - Posted 2013-09-03 20:56:43 »

Bumping because I added a question on top of my gathered answers.
Pages: [1]
  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.

xsi3rr4x (54 views)
2014-04-15 18:08:23

BurntPizza (52 views)
2014-04-15 03:46:01

UprightPath (66 views)
2014-04-14 17:39:50

UprightPath (49 views)
2014-04-14 17:35:47

Porlus (66 views)
2014-04-14 15:48:38

tom_mai78101 (90 views)
2014-04-10 04:04:31

BurntPizza (150 views)
2014-04-08 23:06:04

tom_mai78101 (246 views)
2014-04-05 13:34:39

trollwarrior1 (204 views)
2014-04-04 12:06:45

CJLetsGame (211 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!