Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
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 385 times)
0 Members and 1 Guest are viewing this topic.
Offline VaPS
« Posted 2013-09-01 02: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: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #1 - Posted 2013-09-01 02: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
« Reply #2 - Posted 2013-09-01 13: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
« Reply #3 - Posted 2013-09-03 18: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.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

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

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

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

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

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

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

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

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

Norakomi (41 views)
2014-08-06 19:49:38
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!