Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (582)
Games in Android Showcase (163)
games submitted by our members
Games in WIP (632)
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 986 times)
0 Members and 1 Guest are viewing this topic.
Offline aNt

Senior Devvie


« Posted 2004-06-14 06: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 Devvie

Medals: 1
Exp: 14 years

Lazy Middle Class Intellectual

« Reply #1 - Posted 2004-06-16 07: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 Spiffy Duke »

Medals: 269
Projects: 25
Exp: 18 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #2 - Posted 2004-06-16 08: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.


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

Senior Devvie

Medals: 1
Exp: 14 years

Lazy Middle Class Intellectual

« Reply #3 - Posted 2004-06-16 15: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 Devvie

Medals: 1
Exp: 14 years

Lazy Middle Class Intellectual

« Reply #4 - Posted 2004-06-17 16: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:

Sacramento Volleyball
"Whitty phrase goes here."
Offline aNt

Senior Devvie


« Reply #5 - Posted 2004-06-17 16: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.

theagentd (25 views)
2015-05-27 22:21:17

theagentd (33 views)
2015-05-27 22:21:08

CopyableCougar4 (22 views)
2015-05-27 19:24:50

MrMapcom (24 views)
2015-05-23 20:26:16

MrMapcom (32 views)
2015-05-23 20:23:34

Waterwolf (37 views)
2015-05-20 15:01:45

chrislo27 (44 views)
2015-05-20 03:42:21

BurntPizza (79 views)
2015-05-10 15:53:18

FrozenShade (64 views)
2015-05-07 09:11:21

TheLopais (227 views)
2015-05-06 13:36:48
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00 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‑
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!