Message-Id: <335DADA6.41A0@canvaslink.com> Date: Wed, 23 Apr 1997 02:35:18 -0400 From: Tom Grandgent Reply-To: tgrand AT canvaslink DOT com Organization: Canvas Link, Inc. Mime-Version: 1.0 To: djgpp AT delorie DOT com Subject: Measuring frame rate more often Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk I am working on a game in which I need to measure the frame rate so that I can compensate for it. It's an overhead view and you fly a ship around.. The idea is that I use the the measured frame rate to modify the ship's visible amount of movement per frame. This makes it end up moving at the same speed through the game world no matter what the frame rate is. This would work beatifully except that I have only been able to accurately measure the frame rate once per second. I currently have a frame counter which gets copied and reset once a second by a timer function (I'm using Allegro). I need some way to accurately measure the number of frames per second (or milliseconds per frame or something?) more often than once per second. If anyone knows how I might be able to do this, I would be very appreciative. BTW, the formula I am using to calculate the corrected player speed is: effective_speed = logical_speed * (1 / fps / TARGET_FPS); This works great, except that the frame rate can change a lot in less than a second, so the player might drastically slow down or speed up and then "snap" back to the right speed once the new fps is measured. And TARGET_FPS is just whatever fps I want the game to seem to run at. It is set to 40.0 at the moment. Thank you to those who will [hopefully] help me with this, Tom Grandgent tgrand AT canvaslink DOT com Canvas Link, Inc.