delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/04/21:49:27

From: "Marcus D. Brenneman" <mrln AT flex DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro --> virtual framerate
Date: Sun, 03 Aug 1997 14:50:31 -0500
Organization: Flexnet Inc. (Houston, Tx)
Lines: 24
Message-ID: <33E4E107.92461C57@flex.net>
Reply-To: mrln AT flex DOT net
NNTP-Posting-Host: host121.flex.net
Mime-Version: 1.0
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