Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [CODE]Server frame time checker (Thanks to jonwil!)
[CODE]Server frame time checker (Thanks to jonwil!) [message #492322] Sat, 29 April 2017 05:57 Go to previous message
iRANian is currently offline  iRANian
Messages: 4300
Registered: April 2011
Karma:
General (4 Stars)
Thanks to Jonwil for suggesting this method and the RealFrameSeconds variable to use.

This will display a Frame Time warning in the console if the frametime is higher or equal to 12 milliseconds. If the server is set to 100 sfps than the normal frame time is 10 ms. If the SFPS is 60 than its 16.6667ms etc.

If server suffers from frame time stutters a lot of really annoying lag occurs...when jumping your jumps are random interrupted and/or will warp you around. Movement will warp around, and enemy infantry unit movement will stutter so if you're aiming (for head shot) you will miss.

Servers like MPF and RenCorner suffer heavily from that. Both servers will drop to 99 sfps (from 100 sfps a bit). The ingame SFPS counter averages over one second (so if sfps is 100..it will be 100 frames), this makes it look like it's not that much of an issue as it's just one or two SFPS that are lower...but in actuality those server FPS drops come from one frame taking more than 40 milliseconds...causing very noticable stutter.

REF_DEF2(float, RealFrameSeconds, 0x00857294, 0x0085647C);
uint32 LastInterval = 0;
int FrameTimesIndex = 0;
float  WorstTime = 0;
uint32 CurrentUpdateTime = 0;

void Main_Hooks::Think() {
	CurrentUpdateTime = TIMEGETTIME();

	// check every second
	if ((CurrentUpdateTime - LastInterval) >= 1000)
	{
		LastInterval = CurrentUpdateTime;

		// output only if frame is more than or equal to 12 milliseconds
		if (WorstTime*1000 >= 12.f) {
			Console_Output("[FrameTime] Worst frametime last second: %3.3fms\n", WorstTime*1000);
		}
		WorstTime = 0;
	}
	WorstTime = max(WorstTime, RealFrameSeconds);
}


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases

[Updated on: Sat, 29 April 2017 06:01]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: RenList 1.0.9
Next Topic: [SSGM 4.0 Plugin] NoC4DefuseOnLeave
Goto Forum:
  


Current Time: Thu Jul 18 08:55:37 MST 2024

Total time taken to generate the page: 0.00821 seconds