delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/12/02:03:49

From: mrln AT flex DOT net (Marcus Brenneman)
Newsgroups: comp.os.msdos.djgpp
Subject: Making a virtual framerate system with Allegro
Date: Tue, 05 Aug 1997 00:58:25 GMT
Organization: Flexnet Inc. (Houston, Tx)
Lines: 23
Message-ID: <5s5mpk$53l$1@cub.flex.net>
NNTP-Posting-Host: host77.flex.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Okay. I am using Allegro 2.2 and I am writing a game--like almost
everyone else. You know how you can have a 386 and a Pentium running,
say, DOOM, and on both machines it will take the same amount of time to
go across the same room (although it will look a lot smoother on a
Pentium)? I think this revolves around a concept I call virtual
framerate; the engine updates the positions of everything, etc. at the
same rate of the highest possible framerate but only draws the frames it
can. I want to do this with my game and I'm not sure how to approach it.
I thought of perhaps updating positions every iteration (synched to 60
Hz, FPS, whatever) and only drawing what would be frame 1 of x. The
problem with that method would be that the user would have to set x, and
if a whole bunch of entities were on the screen things could slow down
to the point of x having to be re-adjusted. I also thought of drawing a
frame but using a timer interrupt at 60 Hz that calls all the position
updating stuff (the entities' AIs, etc.; no drawing) so that
(theoretically) once the next frame were ready to be drawn, the correct
positions would be in place. That probably wouldn't work because the
Allegro documentation said that only simple things should be done within
a function linked to an interrupt. How can I accomplish that trick
that's seen in DOOM, Quake, etc.?


Merlin

- Raw text -


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