Notes on the 18Hz framerate #161
davidjoffe
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background: This is related to the choice of 18Hz as artificial framerate cap:
https://retrocomputing.stackexchange.com/questions/1428/why-is-the-8254s-default-rate-18-2-hz
I recall this ~18Hz time on early days programming back in 90s but I've never attempted to measure Duke Nukem 1's frame rate but it always felt 'subjectively' to me like around ~18Hz ... and I suspected they maybe used this timer but not sure.
See also: https://www.xtof.info/Timing-on-PC-familly-under-DOS.html
In our source code we can theoretically uncap the frame rate or make it much higher:
float g_fFrameRate = 18.f;/// 18.0f;
But the old way this game's coded, everything just runs super-fast.
(I suppose it should be 18.2Hz then not 18Hz but probably shouldn't change that now)
For the "official" "Dave Gnukem 1" game, I think it should probably stay as is, to mimic or parody DN1's 'look and feel' of gameplay but always felt it might be nice to use the 'engine' to possibly make games that run faster and smoother and at higher resolutions etc. .. but then it just needs further refactoring to e.g. make the Dave Gnukem 1 specific stuff more modular and the system more extendible.
For example perhaps the viewport scrolling could have something like an abstract base class:
djViewportScroller
and the Dave Gnukem could inherit from that and implement the 'nostalgia-specific' retro behavior of blocky scrolling (that's what the slightly ugly "g_Viewport.xo" stuff is related to, that viewport scrolling) and 18Hz etc. but e.g. some other game might more easily then use smoother viewport scrolling. We want to keep that retro vibe for "version 1" and the specific set of levels and so on that constitute version 1. (If we add extra levels could be add-on 'bonus levels' or an extra 'level pack' or something)
Similar for things like jumping or character movement e.g. maybe a base like "djPlayer" or "djHero" or whatever, the DN1 specific stuff in its own derived class .. or something along those lines ..
And um, more parts of the code could or should then move to a more gamedev-standard thing like having a delta-time that's passed along to the 'CThing' Tick function .. or something like that .. so e.g. if one has smooth-scrolling movement it's more (and more correctly) based on actual time that (in milliseconds) has passed rather than num frames that have passed (float or maybe double but double probalby overkill). But for Dave Gnukem 1 using delta-time might subtly change or affect gameplay - not sure I want to do that, unless it's for a new game maybe with same character (or higher-res sprites .. more like Duke Nukem 2, a lesser-known sequel to DN1)
But not important, just thinking out loud.
Beta Was this translation helpful? Give feedback.
All reactions