fix(game-server): survive bad-packet exceptions in tick loop
Build Game Server / build (push) Successful in 17s

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 19:30:12 +02:00
co-authored by Claude Opus 4.8
parent 4d2280f8ab
commit 71aca5e3d0
+9
View File
@@ -63,9 +63,18 @@ internal static class Program
Logger.Information("Server listening on :{Port}. Waiting for players…", port);
while (await Tick.WaitForNextTickAsync())
{
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");
}
}
}
Logger.Information("Shutting down");