From 71aca5e3d04a9300aa393874de6416c0e16f98e3 Mon Sep 17 00:00:00 2001 From: neckfire Date: Tue, 14 Jul 2026 19:30:12 +0200 Subject: [PATCH] fix(game-server): survive bad-packet exceptions in tick loop Wrap world.Tick in try/catch so an incompatible/misaligned client packet logs an error and the server keeps running (stable R&D bench). Co-Authored-By: Claude Opus 4.8 --- src/Prospect.Server.Game/Program.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Prospect.Server.Game/Program.cs b/src/Prospect.Server.Game/Program.cs index f69e584..d1a507c 100644 --- a/src/Prospect.Server.Game/Program.cs +++ b/src/Prospect.Server.Game/Program.cs @@ -64,7 +64,16 @@ internal static class Program while (await Tick.WaitForNextTickAsync()) { - world.Tick(TickRate); + try + { + world.Tick(TickRate); + } + catch (Exception ex) + { + // A misaligned/incompatible client packet must not kill the whole server + // (R&D: the client's exact net version isn't matched yet). Log and continue. + Logger.Error(ex, "Tick error (bad packet?) — continuing"); + } } }