www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/25/01:31:50

From: "Dan Goodman" <dog AT fcbob DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Frame rate
Date: Sat, 25 Jul 1998 06:29:39 +0100
Message-ID: <901344523.17805.0.nnrp-03.9e989aee@news.demon.co.uk>
NNTP-Posting-Host: fcbob.demon.co.uk
Lines: 34
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I don't know if this question would be better directed to
rec.games.programmer, but that seems to have degenerated into DirectX and 3D
recently.

Anyway,

Does anyone know of a neat way to make sure the game runs at the right speed
regardless of the speed of the computer. Currently, my game runs at 1000fps
if I use dirty rectangles, but 30fps with double buffering, so it is
currently on double buffering so I can actually see what happens, otherwise
the players just disappear of the screen the moment I touch a button.
Currently my game loop looks like this:

do{
Get player input
Move players etc..
Draw frame
}

I was thinking that maybe you could store two copies of all the parameters
that drawing the frame needs. Then you could have the draw frame bit as the
main loop, and call the get player input and move players on a timer 50
times per second (for instance) and use one set of parameters for the
input/move players bits, then copy that set into the other set before
drawing each frame. But I think this would only work if your frame rate was
higher than necessary, any ideas for a method which would work whatever the
speed of the computer (i.e. too slow OR too fast)? The Allegro demo seems to
have something like this in it, but without any specific documentation for
it, I can't work it out.

Thanks in advance,
Dan


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019