From e7812902a1e3bbc1e80aa9781def8d572c80a8ff Mon Sep 17 00:00:00 2001 From: esefxdz Date: Thu, 15 Oct 2026 14:49:50 +0300 Subject: [PATCH] lgbot: friction boost 1.2 (1.3 overshot to 353 u/s when the AI didn't push back) Co-Authored-By: Claude Opus 5.5 --- docs/HOW-IT-WORKS.md | 2 +- home/minqlx-plugins/lgbot.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/HOW-IT-WORKS.md b/docs/HOW-IT-WORKS.md index b0d8332..3aaa8d8 100644 --- a/docs/HOW-IT-WORKS.md +++ b/docs/HOW-IT-WORKS.md @@ -23,7 +23,7 @@ In warmup the client draws "The match will begin when more players join" / "Pres Quake 3 bots take their personality from a character file. `home/baseq3/botfiles/bots/lgbot_c.c` (registered by `scripts/lgbot.bot`) sets aim accuracy, aim skill, reaction time and view speed per skill level, sets jumping, crouching and rocket jumping to 0, and weights the LG above everything else. QL reads skill blocks 1, 4 and 5 and interpolates 2 and 3 between 1 and 4, which is why the file has only three. The server loads these loose files from `fs_homepath` alongside the ones in `pak00.pk3`, so no pk3 is needed (bots run on the server only, so clients don't need the files). -The stock bot AI moves like a bot: it runs at you, hops around and goes for items. So the movement is overridden. The `lgbot` minqlx plugin sets the bot's horizontal velocity on every server frame: sideways to its target in the current strafe direction, plus an in/out part that holds the wanted distance (capped at 70% of the speed so it still strafes while closing in). The strafe direction comes from a small pattern generator: hold one side for a random time between the min and max, then switch. Sometimes it fakes instead: a 60–120 ms tap the other way, then a new hold on the same side. Strafing sideways to someone moves you around them, and fakes keep you going the same way, so the bot would slowly circle you. The pattern therefore tracks its net sideways drift and turns back once it is `lane` units off centre. Ground friction removes about a quarter of the set speed before the move happens, so on the ground it sets 1.3× (measured: the bot then really moves at the set speed). An upward speed of 200–320 (a jump; QL jumps at ~275) is cancelled. Falling, slopes and jump pads are left alone. The AI still aims and shoots, so aim and movement don't interfere. Measured on a test server, the plugin costs no extra CPU you could measure. +The stock bot AI moves like a bot: it runs at you, hops around and goes for items. So the movement is overridden. The `lgbot` minqlx plugin sets the bot's horizontal velocity on every server frame: sideways to its target in the current strafe direction, plus an in/out part that holds the wanted distance (capped at 70% of the speed so it still strafes while closing in). The strafe direction comes from a small pattern generator: hold one side for a random time between the min and max, then switch. Sometimes it fakes instead: a 60–120 ms tap the other way, then a new hold on the same side. Strafing sideways to someone moves you around them, and fakes keep you going the same way, so the bot would slowly circle you. The pattern therefore tracks its net sideways drift and turns back once it is `lane` units off centre. Ground friction removes 15–25% of the set speed before the move happens, so on the ground it sets 1.2× (measured at sv_fps 40: the bot then moves at about the set speed, never faster than a player can). An upward speed of 200–320 (a jump; QL jumps at ~275) is cancelled. Falling, slopes and jump pads are left alone. The AI still aims and shoots, so aim and movement don't interfere. Measured on a test server, the plugin costs no extra CPU you could measure. minqlx gives bots Steam IDs from 90071996842377216 up. The plugin uses that to pick human targets only. diff --git a/home/minqlx-plugins/lgbot.py b/home/minqlx-plugins/lgbot.py index 2b987c4..daf7754 100644 --- a/home/minqlx-plugins/lgbot.py +++ b/home/minqlx-plugins/lgbot.py @@ -9,10 +9,11 @@ import random import time RUN_SPEED = 320 # QL ground run speed, units/s -# Ground friction takes ~25% of the velocity we set before the frame's move happens (measured: -# 288 set -> ~220 actual), so on the ground we set this much more to end up at the wanted speed. +# Ground friction takes ~15% of the velocity we set before the frame's move happens at sv_fps 40 +# (measured: 416 set -> 353 actual; up to ~25% while the bot AI pushes the other way), so on the +# ground we set this much more to end up at about the wanted speed. # In the air there is no friction, so no boost (vertical speed 0 = on the ground, near enough). -FRICTION_COMP = 1.3 +FRICTION_COMP = 1.2 KEYS = ["strafe_min", "strafe_max", "fake", "range", "range_play", "speed", "lane"] LIMITS = {"strafe_min": (50, 2000), "strafe_max": (50, 2000), "fake": (0, 100),