Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  locked framerate  (Read 802 times)
0 Members and 1 Guest are viewing this topic.
Offline aNt

Senior Member




AFK


« Posted 2004-06-14 08:10:15 »

anyone got any tricks on how to lock the frame rate to
a give rate - say 24fps and if u cant keep to that then
start missing frames.

i dont mind jerky frames- i need the scene to be
updating on time. is it a case of having a Thread that
updates the logic- then another that updates Xith
running best it can?

or is there a better way?

Offline SpuTTer

Senior Member


Medals: 1


Lazy Middle Class Intellectual


« Reply #1 - Posted 2004-06-16 09:03:02 »

I was thinking of adding frame limiting to my game soon, but I hadn't gotten around to it yet. I just implemented the GAGE timer, so I was going to work with that to see if I could set it up. I'll let you know if I get anything working.

Surely someone else must have done this?

Sacramento Volleyball
"Whitty phrase goes here."
Offline kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #2 - Posted 2004-06-16 10:07:00 »

Yep.. with GAGETimer its particularly easy.

1) Record the time before you start rendering
2) Render your frame
3) call SleepUntil(StartTime + FrameTime)

Where frame time is caculated :

FrameTime = 1.0 / FPS;

Might need to multiply up for milliseconds or something. I always wrap it all up so I deal with seconds.

Kev

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

Senior Member


Medals: 1


Lazy Middle Class Intellectual


« Reply #3 - Posted 2004-06-16 17:45:39 »

Thanks as always Kev. Maybe I'll add this sooner than I had originally planned while we're on the topic..

Sacramento Volleyball
"Whitty phrase goes here."
Offline SpuTTer

Senior Member


Medals: 1


Lazy Middle Class Intellectual


« Reply #4 - Posted 2004-06-17 18:20:06 »

Basically used Kev's SpaceInvaders example as my bible and went to town. Took maybe 15 minutes and I'm locked at ~33fps right now...

Ant, have a look see at this tutorial by Kev:

http://www.cokeandcode.com/info/tut2d-2.html

Sacramento Volleyball
"Whitty phrase goes here."
Offline aNt

Senior Member




AFK


« Reply #5 - Posted 2004-06-17 18:25:53 »

runs over to look Smiley *click point click*
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.

pw (26 views)
2014-07-24 01:59:36

Riven (25 views)
2014-07-23 21:16:32

Riven (19 views)
2014-07-23 21:07:15

Riven (22 views)
2014-07-23 20:56:16

ctomni231 (51 views)
2014-07-18 06:55:21

Zero Volt (46 views)
2014-07-17 23:47:54

danieldean (37 views)
2014-07-17 23:41:23

MustardPeter (40 views)
2014-07-16 23:30:00

Cero (56 views)
2014-07-16 00:42:17

Riven (55 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!