[Code] Adding a Frames per Second Counter - Darkone
Select messages from
# through # FAQ

DieHard Wolfers -> Code Tutorials

#1: [Code] Adding a Frames per Second Counter - Darkone Author: BrotherTankLocation: Ontario PostPosted: Sat Mar 13, 2004 2:07 pm
FPS Tutorial by Darkone - Edited for understanding

We are going to add fps (Frames Per Second) counter today. In case you don’t know it counts how fast engine renders frames (how many of them are drawn in one second).

First we’ll add some global variables:

Open WL_DRAW.C (at the beginning) add the following in Blue as shown in the code:

::: CODE :::

       long      lasttimecount
       long      frameon;

       //  Added line below for FPS Counter

       int         fps_frames=0, fps_time=0, fps=0;

And then we’ll write actual code in WL_DRAW.C (in the ThreeDRefresh function) at the end of the function, edit it so that it looks like this (new lines to add are in Blue):

::: CODE :::

    frameon++;  // From original code

// Darkone's FPS Counter code


    PrintX=8; PrintY=190;
    US_Print(" fps");

//  End of FPS Counter

    PM_NextFrame();  // Original Code

Voila! It would give you a nice fps counter in the lower left corner of the screen!

How to understand and use fps counter:

If fps is 65..70 all is OK!

If fps is 55..65 – if you have fast machine optimize your code, a less powerful machine will have problems with it

If fps is 25..55 – on lesser machines it wouldn’t be playable

If fps is 00..25 – (off the lights.., unless you have a 286)

Note: max fps value is 70 (by wolf engine design)

I hope this thing helped you on your way to create the best Wolf3D conversion ever made.
If so, just drop me a line on DarkOne@navigators.lv. I wish to see your work!



DieHard Wolfers -> Code Tutorials

output generated using printer-friendly topic mod. All times are GMT

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group