DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[Code] Adding a Frames per Second Counter - Darkone
Page 1 of 1
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Sat Mar 13, 2004 2:07 pm
   Subject: [Code] Adding a Frames per Second Counter - Darkone
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Bottom of Posts

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

    fps_frames++;
    fps_time+=tics;

    if(fps_time>35)
    {
          fps_time-=35;
          fps=fps_frames<<1;
          fps_frames=0;
    }
    SETFONTCOLOR(7,127);
    PrintX=8; PrintY=190;
    VWB_Bar(2,189,50,10,127);
    US_PrintSigned(fps);
    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!


------------------------
Enjoy...

Greg
BrotherTank
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [Code] Add Text to Screen at Skill Level select - Chris
Author: Chris
3 2748 Tue Sep 28, 2010 6:59 pm
Tricob View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2631 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2224 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 2982 Sun Oct 26, 2003 1:21 am
Guest View latest post
No new posts [Help] Different Enemy Dying Frames/Views
Author: Guest
7 609 Tue Jul 29, 2003 3:00 pm
Codetech84 View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group