Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
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  
  Resolution Timers  (Read 1533 times)
0 Members and 1 Guest are viewing this topic.
Offline elias4444

Junior Member





« Posted 2004-02-10 23:11:05 »

Well, the only bad question is one that doesn't get asked, right?

I've been reading a lot on high-resolution timers and such, and how they're supposed to add a professional feel to games. Question though: Most games try to achieve as many  frames per second as possible. So why limit them? Wouldn't it just be better to create two threads, one to perform the redraw, and another to calculate object positioning - then let them fly as necessary?

Honestly, I'm quite new at this, so any information would be incredibly helpful.

Offline Kommi

Junior Member




All opinions will be lined up and shot!


« Reply #1 - Posted 2004-02-11 01:09:08 »

Yes but if you have two threads going only one instruction at a time can still be executed on a single processor computer. So it  You cant really multithread a game like that and then expect good performace from it.
A game loop does not limit the frame rate if written properly. A real game loop does the following:

while (running)
{
render()
if (specific amount of time passed)
gameUpdate()
}
So you do a specific amount of game updates and then render as often as possible. The faster the machine the more renders you get. You can have 2 renders between gamticks or 5 renders between gameticks. The more reneders the more fps and the smoother the animation.


Kommi
Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


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

Actually you don't even render as often as possible - you render as often as necessary. Typically anything over 25fps looks ok, and 50fps looks excellent. Because the lowest most monitors go to is 60Hz then 60fps is a great target to look for to make your game look ultra-slick.

Cas Smiley

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

JGO Coder


Medals: 1


pixels! :x


« Reply #3 - Posted 2004-02-11 09:54:27 »

Well, let's say you have a sprite with a walking animation, wich was ment to run at 25fps. If the time between the frames is exactly 40msecs it looks perfectly smooth.

But what will you do if it runs at 34fps? You'll have to show some animations twice (if you want to maintain the speed), wich will look jerky.

Generally spoken - it depends on the game if frame capping makes sense. A pinball/arcanoid/3d game for example can run as fast (fps) as possible.

However, in both cases you'll need an accurate timer... for calculating the *exact* time, wich elapsed in the meantime.

弾幕 ☆ @mahonnaiseblog
Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2004-02-11 12:58:58 »

Where's the merit in running the game faster than the monitor is refreshing? The updates never reach the screen...

Cas Smiley

Offline elias4444

Junior Member





« Reply #5 - Posted 2004-02-11 13:17:49 »

Wow guys! Thanks! I hope you know that a community has a tendency to make or break a project, and that you are all doing an excellent job at establishing Java as a serious gaming language.

Thank you again!

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #6 - Posted 2004-02-11 16:00:02 »

Quote
Where's the merit in running the game faster than the monitor is refreshing? The updates never reach the screen...


Well, if it's vsynced it's basically capped... that's true Smiley

Turning vsync off is just for benchmarking purposes.

The Q3 engine for example can spit out up to 500fps (lag occures - crash @ 1000fps) and it allows the user to use either fps capping (with com_maxfps), enabling of vsync (with r_swapinterval) or disabling of the limiters alltogether (both 0).

That's pretty cool imo. It even allows 60(vsynced) fps @ 120hz (r_swapinterval 2) - that makes sense if your comp is slow and your monitor is kinda nice Smiley

However, it allows everyone to run the game as smooth as possible. For me it's 85fps@85hz, for others maybe 60/60 and for others even 120/120.

Oh and if vsync is off the frames reach the screen... well not completly hence you'll get tearing.

弾幕 ☆ @mahonnaiseblog
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #7 - Posted 2004-02-11 19:57:27 »

Quote
Where's the merit in running the game faster than the monitor is refreshing? The updates never reach the screen...

Cas Smiley


If you are vsynced the one issue is that if you are just able to render in one refresh period, occasionally you will go over.. when that happens with vsync on your frame rate suddenly drops to half.. this is disturbing, often more than tearing in the display would be.

But as for running the game faster than you can draw.. well yeah, not much point, except if it makes things like collision detection more accurate if you run your physics more often..  but that depends on the algorithm you use.  You certainly don't want to paint more often than you have to.

Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2004-02-13 08:44:52 »

If only triple buffering were in OpenGL Embarrassed  

Cas Smiley

Offline Matzon

JGO Knight


Medals: 19
Projects: 2


I'm gonna wring your pants!


« Reply #9 - Posted 2004-02-13 09:53:12 »

Huh it IS - at least using ATI drivers...

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 (15 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (185 views)
2014-04-01 02:16:10
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

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