From aea5c72f582bf0364874ed0284410be552b5ce09 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 22 Aug 2022 17:48:21 +0200 Subject: [PATCH] Bot AI: fix aim think rate lower than expected (7.5 instead of 10 fps) for high skill bots due to extremely small precision errors --- qcsrc/server/bot/default/havocbot/havocbot.qc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index af108f149..1ec1fde57 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -1508,9 +1508,13 @@ void havocbot_chooseweapon(entity this, .entity weaponentity) void havocbot_aim(entity this) { - if (time < this.nextaim) + // if aim rate is a multiple of think rate due to precision errors the sum of multiple think times + // can be slightly greater than aim time and cause a jump of a whole think time (bot_netxtthink) + // in that case this small tolerance time makes so that aim time snaps to think time + if (time < this.nextaim - 0.01) return; this.nextaim = time + 0.1; + vector myvel = this.velocity; if (!this.waterlevel) myvel.z = 0; -- 2.39.2