From bb849cd026804ab2b85331b62333a1721463268b Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Tue, 8 Nov 2022 20:02:59 -0800 Subject: [PATCH] Clamp server processing time --- server.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server.c b/server.c index fd222d3..b43f0a9 100644 --- a/server.c +++ b/server.c @@ -249,6 +249,12 @@ void server(void* world_save_name) total_time += (float)stm_sec(stm_diff(stm_now(), last_processed_time)); last_processed_time = stm_now(); // @Robost @BeforeShip if can't process quick enough will be stuck being lagged behind, think of a solution for this... + const float max_time = 5.0f * TIMESTEP; + if (total_time > max_time) + { + Log("Abnormally large total time %f, clamping\n", total_time); + total_time = max_time; + } bool processed = false; while (total_time > TIMESTEP) {