OldUnreal / UnrealTournamentPatches

Other
982 stars 29 forks source link

[469d] Bots able stuck on edges, without jump down #1568

Closed SeriousBuggie closed 3 weeks ago

SeriousBuggie commented 5 months ago

If some conditions meet, bots able stuck on edge, and never jump down. They start move in the loop:

https://github.com/OldUnreal/UnrealTournamentPatches/assets/70026933/2b202e0c-ad6c-439d-a30a-69ad0372cf18

There happen next:

  1. Bot try reach destination, but not jump off edge of the platform.
  2. So it start walk to wall.
  3. Bot touch wall.
  4. HitWall event fire.
    function HitWall(vector HitNormal, actor Wall)
    {
        if (Physics == PHYS_Falling)
            return;
        if ( Wall.IsA('Mover') && Mover(Wall).HandleDoor(self) )
        {
            if ( SpecialPause > 0 )
                Acceleration = vect(0,0,0);
            GotoState('Roaming', 'SpecialNavig');
            return;
        }
        Focus = Destination;
        if ( !bWallAdjust && PickWallAdjust() )
        {
            if ( Physics == PHYS_Falling )
                SetFall();
            else
                GotoState('Roaming', 'AdjustFromWall');
        }
        else
        {
            MoveTimer = -1.0;
            bWallAdjust = false;
        }
    }

    There called PickWallAdjust:

    /* PickWallAdjust()
    Check if could jump up over obstruction (only if there is a knee height obstruction)
    If so, start jump, and return current destination
    Else, try to step around - return a destination 90 degrees right or left depending on traces
    out and floor checks
    */
    native(526) final function bool PickWallAdjust();

    , which set destination forward.

  5. Bot strafe to it, and start MoveTo original destination, as specified in state code:
    AdjustFromWall:
    if ( !IsAnimating() )
        AnimEnd();
    bWallAdjust = true;
    bCamping = false;
    StrafeTo(Destination, Focus);
    Destination = Focus;
    MoveTo(Destination);
    bWallAdjust = false;
    Goto('Moving');

    But during MoveTo happen another HitWall, since it slide in same way. But now bWallAdjust is set to True, so it just reset MoveTarget and force search paths again. And search paths return exactly same paths as before, so bot walk to start point, and try reach next one. Which close loop, since it exactly same action, what be before.

This loop never ends.

SeriousBuggie commented 5 months ago

Test map for reproduce: bot_loop_edge.zip img Just add one bot.

SeriousBuggie commented 4 months ago

Also this issue touch physics, since bot can simple jump and not do all this mess. But bot not do this. So I guess it can be also bug in ledge detection and ability jump from ledge during move on walk physics.

SeriousBuggie commented 4 months ago

Worst case: bot_loop_edge2.zip And possible implementation for fix it:

https://github.com/OldUnreal/UnrealTournamentPatches/assets/70026933/a2d6973e-4dc3-43e8-98bc-7bed690481bc

https://github.com/OldUnreal/UnrealTournamentPatches/assets/70026933/6482540c-dc9d-4b23-bbcd-ff6042929a4e