Raised This Month: $51 Target: $400
 12% 

Frame & Tick functions seem inaccurate


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
urban_ninja
Senior Member
Join Date: Feb 2009
Old 09-19-2014 , 10:53   Frame & Tick functions seem inaccurate
Reply With Quote #1

I have some questions about how SM works. I am trying to get an FPS monitor plugin working to where the FPS display in game is exact to what displayed in server console but no luck with any methods found. Server console says 110 FPS with fluctuations while sourcemod plugins read a static 60 FPS using any of the frame/Tick related functions.

Below is the method I'm used to as an amx mod x user. This method matches FPS display in server console through in amx mod x flawlessly. However, the equivalent method in sourcemod the frames execute separate from the engine. Why is this? Is actual engine frame hooking impossible with source engine?

Moreover, I underclocked the CPU to 20% factory speed to see if frames from source mod were any different but no change. OnGameFrame() was still executing 60 times per second under any condition while actual frames in server console were saying 10-15. Source mod is so wonky compared to what I'm used to.
PHP Code:
public OnGameFrame()
{
    
frames++
    new 
Float:gt GetGameTime()
    if(
gt wait)
    {
        
SetHudTextParams(1.01.00.90255025506.00.010.01);
        for(new 
id 1id 12;id++)
        {
            if(
IsClientConnected(id) && !IsFakeClient(id))
            {
                
ShowHudText(id4"FPS:%d"frames)
            }
        }
        
frames 0
        wait 
gt 1.0
    
}
}
  

urban_ninja is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-19-2014 , 11:02   Re: Frame & Tick functions seem inaccurate
Reply With Quote #2

It would help to know what game you're using to test this.

However, I'm going to point out that tickrate and fps_max aren't the same thing in Source games.

Edit: Here, I'll quote something I said in a previous post:

Quote:
Originally Posted by Powerlord View Post
Tick rates are locked for the following games (that I know of):

HL2:DM, DoD:S, CS:S, TF2: Locked to 66.
L4D, L4D2: Locked to 33 30.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 09-19-2014 at 14:26.
Powerlord is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 09-19-2014 , 11:53   Re: Frame & Tick functions seem inaccurate
Reply With Quote #3

It's called GetGameTime() for a reason. See documentation for more details.

Quote:
Originally Posted by Powerlord View Post
Tick rates are locked for the following games (that I know of):

HL2M, DoD:S, CS:S, TF2: Locked to 66.
L4D, L4D2: Locked to 33.[...]
I recall already correcting someone on this (maybe even you), but L4D(2) is locked to 30 ticks per second.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.

Last edited by Dr. Greg House; 09-19-2014 at 11:56.
Dr. Greg House is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 09-19-2014 , 12:28   Re: Frame & Tick functions seem inaccurate
Reply With Quote #4

Quote:
Originally Posted by Powerlord View Post
It would help to know what game you're using to test this.

However, I'm going to point out that tickrate and fps_max aren't the same thing in Source games.

Edit: Here, I'll quote something I said in a previous post:
Good to know. Does fps any vital role at all with a source servers since considering its separate?
urban_ninja is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-19-2014 , 14:05   Re: Frame & Tick functions seem inaccurate
Reply With Quote #5

Quote:
Originally Posted by urban_ninja View Post
Good to know. Does fps any vital role at all with a source servers since considering its separate?
To be honest, I'm not sure. I do know that the Valve Developer Wiki has a long article on Source Multiplayer Networking that doesn't actually mention FPS in it even once.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 09-19-2014 , 17:26   Re: Frame & Tick functions seem inaccurate
Reply With Quote #6

Sourcengine networking is... Wierd.
Each frame is stored, along with a bunch of information about every single entity... Lots of position/physics data, mostly for csp.
So like, when you shoot someone, it goes back in time, grabs the frame that should have happened on, and does the calculations from there.
It is kind of costly to store all of that stuff
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode