Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Good job! Something similar to what I've been planning for quite some time, just never got around to it.
May I suggest a second feature? If a tick takes longer than a configurable threshold (let's say half a second), log that to the server console:
"INFO: Tick took too long: 985 ms instead of 50 ms. Last such overload: 5 ticks ago". That would be quite helpful for me as a developer.
Also, there's a small mistmatch between /tps and /lag commands in the description.
Posts: 1,469
Threads: 57
Joined: Jul 2012
Thanks: 66
Given 127 thank(s) in 108 post(s)
04-03-2013, 12:25 AM
(This post was last modified: 04-03-2013, 12:26 AM by bearbin.)
Ah, I'll clarify (/lag and /tps both work). The extra feature sounds great, I'll add it straight away.
Posts: 1,469
Threads: 57
Joined: Jul 2012
Thanks: 66
Given 127 thank(s) in 108 post(s)
04-03-2013, 12:45 AM
(This post was last modified: 04-03-2013, 12:53 AM by bearbin.)
I added a config switch, I'll add a configurable delay it will wait before it says it again.
Done!
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
Does that even work? I thought I clamped the delta time somewhere - high delta time values can make things overshoot - or are you using other methods for measuring the time between ticks?
Posts: 1,469
Threads: 57
Joined: Jul 2012
Thanks: 66
Given 127 thank(s) in 108 post(s)
I have no idea! If the delta is clamped to 20tps, then the plugin may not work. If it's higher it may work, just not properly. Maybe you can make a new hook for the full amount of time it takes. Or maybe HOOK_TICK_FINISHED which calls OnTickFinished(TimeTaken) where timetaken is the amount of time MCServer took to compute ontick events in ms?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
There is no cap; only if a tick takes less than 50 ms, the server sleeps for whatever milliseconds are left until a full tick (Server.cpp lines 367 - 394, function ServerTickThread() )