You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a NOTE:
As long as you use seperate botlib files as a dependency for your BSPC tool,
this fix shouldn't be applied! It destroys the ability to compute jump reachabilities.
The issue in short: the bot predicts it's jump route using 'AAS_ClientMovementPrediction'
(onground is set to qtrue), this means he uses 'phys_friction' (6) to predict the jump.
Though, actually he is NOT on ground when he is jumping, but he is also not swimming this
means jumping through air needs no (or at least nearly zero) friction, this seems to be
the reason they choose 'phys_waterfriction' (1) for when not swimming (assuming he is
jumping). All this becomes even more complicated because the bot can be onground AND
swimming (walking under water).
Additionally 'onground' is abused inside 'AAS_ClientMovementPrediction' as it seems.
Anyways, the opposite is true if the bot uses 'AAS_ClientMovementPrediction' for
non-precomputed actions (dynamically). For example in 'BotWalkInDirection', caused
if a bot wants to avoid obstacles or during attack moves. In this case
'AAS_ClientMovementPrediction' is called (from botlib) to check for gaps, hazards,
and whatnot. Here it makes sense to use the correct 'code' since the jump reachabilities
are already (pre)computed. All this is hacky, a real fix is on the run, though i'm lazy...
Here is a showcase of the problem, and where/how to fix: bspc-botlib-friction-fix-showcase.txt
Rename this file to .patch or .diff, but don't apply it to WoP, it's just for demonstration purposes.
Index: build/bspc-release-mingw32-x86_64/bspc.x86_64.exe
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: code/botlib/be_aas_move.c
===================================================================--- code/botlib/be_aas_move.c (revision 43)+++ code/botlib/be_aas_move.c (working copy)@@ -554,60 +554,77 @@
for (n = 0; n < maxframes; n++)
{
swimming = AAS_Swimming(org);
- //get gravity depending on swimming or not- gravity = swimming ? phys_watergravity : phys_gravity;+ //if swimming+ if (swimming)+ {+ gravity = phys_watergravity;+ }+ else+ {+ gravity = phys_gravity;+ }
//apply gravity at the START of the frame
frame_test_vel[2] = frame_test_vel[2] - (gravity * 0.1 * frametime);
- //if on the ground or swimming- if (onground || swimming)- {- friction = swimming ? phys_waterfriction : phys_friction;- //apply friction- VectorScale(frame_test_vel, 1/frametime, frame_test_vel);- AAS_ApplyFriction(frame_test_vel, friction, phys_stopspeed, frametime);- VectorScale(frame_test_vel, frametime, frame_test_vel);- } //end if
crouch = qfalse;
//apply command movement
if (n < cmdframes)
{
//ax = 0;
- maxvel = phys_maxwalkvelocity;- accelerate = phys_airaccelerate;
VectorCopy(cmdmove, wishdir);
- if (onground)+ //if not swimming+ if (!swimming)
{
- if (cmdmove[2] < -300)- {- crouch = qtrue;- maxvel = phys_maxcrouchvelocity;- } //end if
//if not swimming and upmove is positive then jump
- if (!swimming && cmdmove[2] > 1)+ if (cmdmove[2] > 1)
{
+ crouch = qfalse;
//jump velocity minus the gravity for one frame + 5 for safety
frame_test_vel[2] = phys_jumpvel - (gravity * 0.1 * frametime) + 5;
jump_frame = n;
+ maxvel = phys_maxwalkvelocity;
//jumping so air accelerate
accelerate = phys_airaccelerate;
+ friction = 0;
} //end if
+ else if (cmdmove[2] < -300)+ {+ crouch = qtrue;+ maxvel = phys_maxcrouchvelocity;+ accelerate = phys_walkaccelerate;+ friction = phys_friction;+ } //end if+ else if (!onground)+ {+ crouch = qfalse;+ maxvel = phys_maxwalkvelocity;+ accelerate = phys_airaccelerate;+ friction = 0;+ } //end if
else
{
+ crouch = qfalse;+ maxvel = phys_maxwalkvelocity;
accelerate = phys_walkaccelerate;
+ friction = phys_friction;
} //end else
- //ax = 2;+ wishdir[2] = 0;
} //end if
- if (swimming)+ else
{
+ crouch = qfalse;
maxvel = phys_maxswimvelocity;
accelerate = phys_swimaccelerate;
+ friction = phys_waterfriction;
//ax = 3;
+ } //end else+ if (onground || swimming)+ {+ //apply friction+ VectorScale(frame_test_vel, 1/frametime, frame_test_vel);+ AAS_ApplyFriction(frame_test_vel, friction, phys_stopspeed, frametime);+ VectorScale(frame_test_vel, frametime, frame_test_vel);
} //end if
- else- {- wishdir[2] = 0;- } //end else- //
wishspeed = VectorNormalize(wishdir);
if (wishspeed > maxvel) wishspeed = maxvel;
VectorScale(frame_test_vel, 1/frametime, frame_test_vel);
The text was updated successfully, but these errors were encountered:
Introduced in dec81dc.
Reverted in c608743
reported by Tobias Kuehnhammer
The text was updated successfully, but these errors were encountered: