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

Does GetTickInterval's return value ever change?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 07-23-2017 , 12:29   Does GetTickInterval's return value ever change?
Reply With Quote #1

I was wondering if the return value can ever change.

As far as I know, GetTickInterval returns (1.0 / tickrate).
Does that value change if the server's FPS worsens due to CPU spikes? How safe is it to increment a variable by a cached value of GetTickInterval from within OnPlayerRunCmd?
__________________
retired

Last edited by shavit; 07-23-2017 at 12:30.
shavit is offline
StrikeR14
AlliedModders Donor
Join Date: Apr 2016
Location: Behind my PC
Old 07-23-2017 , 13:38   Re: Does GetTickInterval's return value ever change?
Reply With Quote #2

Quote:
Originally Posted by shavit View Post
Does that value change if the server's FPS worsens due to CPU spikes?
Yep.
__________________
Currently taking TF2/CSGO paid private requests!

My Plugins | My Discord Account
StrikeR14 is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 07-23-2017 , 13:43   Re: Does GetTickInterval's return value ever change?
Reply With Quote #3

Quote:
Originally Posted by StrikeR14 View Post
I've read the API, it still doesn't answer my questions.
__________________
retired
shavit is offline
StrikeR14
AlliedModders Donor
Join Date: Apr 2016
Location: Behind my PC
Old 07-23-2017 , 13:48   Re: Does GetTickInterval's return value ever change?
Reply With Quote #4

Quote:
Originally Posted by shavit View Post
I've read the API, it still doesn't answer my questions.
Note: A tick, in this context, is a frame.
__________________
Currently taking TF2/CSGO paid private requests!

My Plugins | My Discord Account
StrikeR14 is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 07-23-2017 , 15:41   Re: Does GetTickInterval's return value ever change?
Reply With Quote #5

Quote:
Originally Posted by StrikeR14 View Post
Note: A tick, in this context, is a frame.
I assume that this is the *fixed* interval between frames, as plugins like Tickrate Enabler make it like so:
Code:
float GetTickInterval()
{
	float tickinterval = DEFAULT_TICK_INTERVAL;

	if ( CommandLine()->CheckParm( "-tickrate" ) )
	{
		float tickrate = CommandLine()->ParmValue( "-tickrate", 0 );
		if ( tickrate > 10 )
			tickinterval = 1.0f / tickrate;
	}

	RETURN_META_VALUE(MRES_SUPERCEDE, tickinterval );
}
However I can't find any documentation that answers my question.
__________________
retired
shavit is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-23-2017 , 16:27   Re: Does GetTickInterval's return value ever change?
Reply With Quote #6

GetTickInterval is always the desired tickrate and will never change after map start. GetGameFrameTime was recently added to master, which returns the actual delta from the last frame.
__________________
asherkin is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 07-23-2017 , 17:28   Re: Does GetTickInterval's return value ever change?
Reply With Quote #7

Quote:
Originally Posted by asherkin View Post
GetTickInterval is always the desired tickrate and will never change after map start. GetGameFrameTime was recently added to master, which returns the actual delta from the last frame.
Thank you very much, this is what I was looking for!

Also, do you have any clue if OnPlayerRunCmd will be called once per player and once per tick, even if the player fails to send a new usercmd (because of lag, or having FPS lower than the server's tickrate)?
__________________
retired
shavit is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-24-2017 , 12:11   Re: Does GetTickInterval's return value ever change?
Reply With Quote #8

Quote:
Originally Posted by shavit View Post
Also, do you have any clue if OnPlayerRunCmd will be called once per player and once per tick, even if the player fails to send a new usercmd (because of lag, or having FPS lower than the server's tickrate)?
Only in CS:GO.
__________________
asherkin 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 11:37.


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