🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1504

Re: Controlling Game Speed

#1504
From: Stokes Kevin
Date: Fri, 11 Dec 1992 17:58
39 lines
2752 bytes
>I use something like that in my game. At the start of the game I set the
>timer to interrupt at 768 times/second (that particular number for various
>reasons, all of which have nothing to do with the problem in question).
>Then I calculate how many ticks it took to go thru the whole game loop
>after every frame. Then I use this value to calibrate all the movement
>of the objects during the next frame.

  I do this in my Corncob Aircombat game also.  It works beautifully when
it works.
  There are some difficulties I've had because of this though. 
  Since many user's TSR's depend on the timer interrupt, you must still
call the old interrupt routine when yours is finished.  Obviously you
want to call the old interrupt only every once and a while, so that the
BIOS and TSR's still see the timer ints coming at 18 ticks/sec.  ( IE if
you call the old timer int routine 768 times per second, you will find
that your BIOS system clock runs rather fast while you play your game!).
  However, some TSR's do alot of stuff in their timer interrupt routines
and you may miss interrupts if another 1/768th of a second goes by before
you get control back from the called old interrupt.  On my system, this will
simply crash the computer.
  So you have to set the timer int rate back to 18/sec before you call the
old timer int routine.  This also keeps the task switchers happy.

  Now comes the bad part... I have found that on a small percentage of
customer's machines, the timer doesn't reset to different speeds reliably.
I found that increasing the delay between accesses to the timer chip
helped, but there are many machines where this simply fails.  I was forced
to put an option in for manual-fixed time scaling where the timer is not
messed with.  Mostly I get complaints from PS/2 and Packard Bell owners.

                                                  -Kevin



-- 
------------------------------------------------------------------------------
|  Kevin Stokes                        |     Please direct all pointless     |
|  Pie in the Sky Software             |   flames to my mailbox, it's much   |
|                                      |          more irritating.           |
Technical Details
Message-ID: <7871@news.duke.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!concert!duke!news.duke.edu!phy.duke.edu!kds
References: <1992Dec8.195131.28125@ncsu.edu> <1g6cdrINNb8a@tamsun.tamu.edu> <1992Dec10.072004.7897@jyu.fi>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!concert!duke!news.duke.edu!phy.duke.edu!kds
From: kds@phy.duke.edu (Stokes Kevin)
Newsgroups: rec.games.programmer
Subject: Re: Controlling Game Speed
Keywords: speed timer
Message-ID: <7871@news.duke.edu>
Date: 11 Dec 92 17:58:42 GMT
References: <1992Dec8.195131.28125@ncsu.edu> <1g6cdrINNb8a@tamsun.tamu.edu> <1992Dec10.072004.7897@jyu.fi>
Sender: news@news.duke.edu
Organization: Duke University Physics Dept.; Durham, N.C.
Lines: 39
Nntp-Posting-Host: physics.phy.duke.edu