Advertisement

FPS?

Started by April 22, 2002 08:10 PM
86 comments, last by Wachar 22 years, 7 months ago
quote: Original post by GlaZZ
Hey you shouldn't be so precis with this, and by the way the framespeed-independent timing is the most common way to do this thing. And next, that was a totally simplified example, 'cause we're talking about newbies here...


Shouldn't be so precise? Pardon me, but why [EDITED] are you telling me to be less precise? The best way to help newbies is to use precise language, and it also teaches them the proper terminology. If it makes your head hurt, ignore it. Of course framespeed-independent is the most common way, because it works. Point again: if it teaches newbies the wrong way, it's not a simplified example - it's a rotten example.

Later,
ZE.



//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[if you have a link proposal, email me.]

EDITED for language and a typo.

[edited by - zealouselixir on April 30, 2002 5:00:35 PM]

[twitter]warrenm[/twitter]

Kwizatz, that was just a misunderstanding cleared up by sending an e-mail to Andre.

To everyone else, I think I get fps, but then what does this line of code do?

while((GetTickCount() - start_time) < 33);

Take it to the Xtreme!

Wachar's Eternity <-<-<-<-<- Me own site!
Advertisement
Assuming the common context of that line, it locks the framerate to about 30 FPS, assuming the game CAN run that fast. Basically it says, "As long as 33 milliseconds have not passed since the beginning of this frame, wait until they have."

Peace,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[if you have a link proposal, email me.]

[twitter]warrenm[/twitter]

Ok, so it does "set" it to 30 FPS(if it can do it!). But doesn''t a while loop execute again and again? Not wait?

Take it to the Xtreme!

Wachar's Eternity <-<-<-<-<- Me own site!
... Hmm
You don''t use FPS for anything but measurment so you know what parts of your game is going slower ( you could use "Seconds per Frame" or "Frames Per hour" but "Frames per second" is better suited for our cases.) and you use FPS to tell what part of your game is going slower( For Example, if your programs render a certain type of object slower, you couldn''t really tell withought a FPS measurment, besides that the only thing you can do is Cap the FPS (putting a MAXIMUM FPS note: you cannot put a Minimum FPS) but if you do all your caculations based on time, you shouldn''t have to do that(Also sience everyone else is using car examples I will too for instiance Car Companys can(And Do sometims) but a little device in your car to make sure you cannot go past a certain speed but they cannot put a device that Makes sure you CANNOT go below a certain speed, so the only thing you use FPS for is seing how fast parts of your game are Going so you can improve it, and well you could do an FPS Cap, but remember Computers have no posted speed limit, just a maximum speed, so don''t put a limit into your Car.... i mean game
quote: Original post by Wachar
Ok, so it does "set" it to 30 FPS(if it can do it!). But doesn''t a while loop execute again and again? Not wait?


NO. It doesn''t SET it. It LIMITS it. If the game is running at MORE than 30 FPS, that line will LIMIT it down to 30 FPS, because it''s wasting cycles until the alotted frame time is up.

That''s my last post on the matter.

Peace,
ZE.



//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[if you have a link proposal, email me.]

[twitter]warrenm[/twitter]

Advertisement
Warchar

i think that line of code is something you would put inside your main game loop to slow it down:

while (1) {    //the loop will pause here until the below evaluates to true    while((GetTickCount() - start_time) < 33);    do the rest of the code;} 


that''s just limiting the loop to not running any faster than every 33miliseconds (~30FPS). if the game would normally run at faster than 30FPS you''ll just sit at the pause loop for a little while.

you only do that if you aren''t using framerate independant movement. which you shouldn''t do.

if you''ve got questions on what framerate independant movement is search the forums. there was a thread running today or yesterday about it and why it''s bad practice in most, if not all, cases.

-me
OIC! It sets a maximum time the frames can pass. And, the while loop consists of the GetTickCount, and the main game loop. I didn''t know that the drawing was before the while loop. I didn''t think about that while starts from there. Not like a do..while. Thanks! I think I get it now! Ciao!

Take it to the Xtreme!

Wachar's Eternity <-<-<-<-<- Me own site!
(You guys, please correct me if I''m wrong!)

Take it to the Xtreme!

Wachar's Eternity <-<-<-<-<- Me own site!
Please tell me if I''m right or wrong. Please?


Ciao!


Wachar's Eternity <-<-<-<-<- Me own site!

This topic is closed to new replies.

Advertisement