Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LootGoal to prevent bot getting stuck #639

Merged
merged 6 commits into from
Dec 21, 2024

Conversation

lionaneesh
Copy link

No description provided.

@@ -102,7 +105,7 @@ public override void OnEnter()

private void WaitForLootReset()
{
wait.While(LootReset);
wait.WhileWithTimeout(LootReset, MAX_TIME_TO_RESET_LOOT);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide logs about this situation ?

I'm really curious about you end up stuck in here. If the code stuck in here, then there's no point of entering the Goal itself. This can be moved into CanRun() or add a Precondition

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes the Inventory is full and the bot gets stuck looting. This fixes that with a timeout.

Copy link
Owner

@Xian55 Xian55 Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that LootReset value is hooked up to the LootWindow visibility, if the player cannot loot any items or just partially be able to loot a few items, then the LootWindow will remain visible indefinitely.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not only about the window, the bot is stuck looting and getting hit by mob but not attacking.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested the change locally while my inventory was full. My character was not remained stuck after loot.

related log:

[00:01:04:660 I] [CastingHandler   ] [Raptor Strike    ] ... AfterCastWaitSwing
[00:01:04:793 I] [CastingHandler   ] [Raptor Strike    ] castbar input 68ms 7.2016ms
[00:01:08:697 I] [GoapAgent        ] Kill credit detected! Session Total: 3 | Last Combat: 1 | Currently fighting: 0
[00:01:08:697 I] [CombatGoal       ] Lost target!
[00:01:08:758 I] [GoapAgent        ] New Plan=  Consume Corpse
[00:01:08:758 I] [ConsumeCorpseGoal] Safe to consume a corpse.
[00:01:08:761 I] [GoapAgent        ] New Plan=  Loot
[00:01:08:761 I] [LootGoal         ] Lost target 0ms
[00:01:08:762 W] [LootGoal         ] Inventory is full
[00:01:08:832 I] [LootGoal         ] Keyboard last target found!
[00:01:08:832 I] [LootGoal         ] Keyboard soft target found!
[00:01:09:131 I] [BagChangeTracker ]  4 ->  5 Chipped Claw
[00:01:11:950 I] [LootGoal         ] Loot Failed -3007.1746ms   <------- This logic is not in `OnEnter`
[00:01:12:021 I] [GoapAgent        ] New Plan=  Corpse Consumed
[00:01:12:022 I] [CorpseConsumedGoal] Total: 0 | Remaining: 0
[00:01:12:025 I] [GoapAgent        ] New Plan=  Adhoc N P C
[00:01:12:100 I] [Navigation       ] Pathfinder - 92.714584 - <-6247.6924, 411.44055, 383.45654> -> <-6228.9346, 320.6433, 0> 3.9286ms
[00:01:27:505 I] [NpcNameFinder] type = None | mode = Fuzzy
[00:01:27:606 I] [NpcNameTargeting ] NPC found: Vendor | 0 | Rectangle [ X=458, Y=250, Width=30, Height=14 ]
[00:01:27:641 I] [AdhocNPCGoal     ] Found Target!
[00:01:28:209 W] [AdhocNPCGoal     ] Gossip no options! 514.3007ms
[00:01:28:209 I] [AdhocNPCGoal     ] Merchant window opened after 514.3007ms
[00:01:28:424 I] [AdhocNPCGoal     ] Merchant sell grey items started after 152.9196ms
[00:01:28:642 I] [BagChangeTracker ] - 1 Flimsy Chain Pants
[00:01:28:693 I] [BagChangeTracker ] - 1 Ruined Pelt
[00:01:28:860 I] [BagChangeTracker ] - 3 Broken Fang
[00:01:28:907 I] [BagChangeTracker ] - 1 Flimsy Chain Bracers
[00:01:28:960 I] [BagChangeTracker ] - 5 Chipped Claw
[00:01:29:027 I] [BagChangeTracker ] - 1 Ragged Cloak
[00:01:29:074 I] [BagChangeTracker ] - 1 Flimsy Chain Gloves
[00:01:29:123 I] [BagChangeTracker ] - 1 Ruined Pelt
[00:01:29:193 I] [BagChangeTracker ] - 2 Chipped Claw
[00:01:29:307 I] [BagChangeTracker ] - 1 Chipped Claw
[00:01:29:509 I] [BagChangeTracker ] - 1 Ruined Pelt
[00:01:29:559 I] [BagChangeTracker ] - 1 Chipped Claw
[00:01:29:625 I] [BagChangeTracker ] - 1 Chipped Claw
[00:01:29:677 I] [BagChangeTracker ] - 1 Flimsy Chain Vest
[00:01:29:726 I] [BagChangeTracker ] - 1 Chipped Claw
[00:01:29:860 I] [BagChangeTracker ] - 1 Chipped Claw
[00:01:29:924 I] [BagChangeTracker ] - 1 Chipped Claw
[00:01:30:025 I] [AdhocNPCGoal     ] Merchant sell grey items finished, took 1600.0306ms
[00:01:30:212 I] [NpcNameFinder] type = None | mode = Fuzzy
[00:01:30:212 I] [GoapAgent        ] New Plan=  Follow 1-5_ Gnome
[00:01:30:217 I] [FollowRouteGoal  ] RefillWaypoints - findClosest:True - ThereAndBack:False
[00:01:30:245 I] [Navigation       ] Pathfinder - 30.064636 - <-6228.134, 322.33752, 383.1168> -> <-6258.0254, 319.11658, 0> 13.2514ms
[00:01:30:259 I] [NpcNameFinder] type = None | mode = Fuzzy
[00:01:34:531 I] [FollowRouteGoal  ] RefillWaypoints - findClosest:False - ThereAndBack:False
[00:01:34:531 I] [FollowRouteGoal  ] RefillWaypoints - Set destination from closest to nearest endpoint - with 17 waypoints
[00:01:35:251 I] [FollowRouteGoal  ] Random jump

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold on i might have a repro case for it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ye its been a long running issue which always screw me over since it was introduced with the latest expansion.

Since Dragonflight a new Soft Targeting system has been added, which was not fully integrated with the gameplay.

Its highly situational and depends on your character positioning and camera angle to get stuck.

So the scenario is this

  • Currently my inventory is full, but i think it does not really matter overall, as it could cause problem with skinning as well.
  • You are fighting with one mob, facing forward at it, or in other words looking directly at it, the mob is the center of your monitor.
  • You can either pull one more or body pull it.
  • The goal is get into a situation when you are fighting with two mobs at the same time.
  • The first mob dies, and the second mob is currently attacking you.
  • So if you profile has mention auto attack / Approach goal which usually have the following mention in the class config
      {
        "Name": "AutoAttack",
        "Requirements": [
          "InMeleeRange",
          "!AutoAttacking",
        ]
      },
      {
        "Name": "Approach",
        "Log": false,
        "Requirements": [
          "InMeleeRange",
        ]
      }
  • Since the CombatGoal is active there will be no other action to use to it most likely going to choose either AutoAttack or Approach.
  • By using either of them its going to use the Interact with target which going to initiate loot if the soft target becomes the previously killed target.
[00:22:57:097 I] [GoapAgent        ] New Plan=  Pull Target
[00:22:57:111 I] [PullTargetGoal   ] Stop auto interact!
[00:22:57:145 I] [WowProcessInput  ] [Delete] press random 32ms
[00:22:57:149 V] [ConfigurableInput] [StopAttack] Delete pressed 32ms
[00:22:57:283 I] [WowProcessInput  ] [D3] press random 50ms
[00:22:57:284 D] [ConfigurableInput] [Auto Shot] D3 pressed 50ms
[00:22:57:367 I] [CastingHandler   ] [Auto Shot        ] castbar input 51ms -77.3231ms
[00:22:57:883 I] [BagChangeTracker ] 20 -> 19 Light Shot
[00:22:57:918 I] [CastingHandler   ] [Auto Shot        ] ... AfterCastWaitCombat 546.2254ms
[00:22:57:918 D] [CombatUtil       ] Combat Enter
[00:22:58:546 I] [GoapAgent        ] New Plan=  Combat
[00:22:59:916 I] [BagChangeTracker ] 19 -> 18 Light Shot
[00:23:02:050 I] [BagChangeTracker ] 18 -> 17 Light Shot
[00:23:03:647 I] [WowProcessInput  ] [S] press random 3016ms
[00:23:03:648 V] [ConfigurableInput] [Stepback] S pressed 3016ms
[00:23:03:651 I] [CastingHandler   ] [Stepback         ] castbar input 1552ms
[00:23:03:654 I] [GoapAgent        ] New Plan=  Approach Target
[00:23:03:707 I] [WowProcessInput  ] [I] press random 38ms
[00:23:03:707 V] [ConfigurableInput] [Approach] I pressed 38ms
[00:23:03:836 I] [GoapAgent        ] New Plan=  Combat
[00:23:03:850 V] [WowProcessInput  ] [UpArrow] move Pressed 4ms
[00:23:03:887 I] [CastingHandler   ] [Raptor Strike    ] ... AfterCastWaitSwing
[00:23:03:939 I] [WowProcessInput  ] [Delete] press random 50ms
[00:23:03:940 V] [ConfigurableInput] [StopAttack] Delete pressed 50ms
[00:23:04:013 I] [WowProcessInput  ] [D4] press random 72ms
[00:23:04:014 D] [ConfigurableInput] [Raptor Strike] D4 pressed 72ms
[00:23:04:098 I] [CastingHandler   ] [Raptor Strike    ] castbar input 74ms -83.1022ms
[00:23:04:206 I] [WowProcessInput  ] [I] press random 37ms
[00:23:04:710 I] [WowProcessInput  ] [I] press random 11ms
[00:23:05:150 I] [WowProcessInput  ] [I] press random 17ms
[00:23:05:623 I] [WowProcessInput  ] [I] press random 39ms
[00:23:06:131 I] [WowProcessInput  ] [I] press random 28ms
[00:23:06:600 I] [WowProcessInput  ] [I] press random 34ms
[00:23:07:108 I] [WowProcessInput  ] [I] press random 24ms
[00:23:07:629 I] [WowProcessInput  ] [I] press random 11ms
[00:23:08:108 I] [WowProcessInput  ] [I] press random 20ms
[00:23:08:585 I] [WowProcessInput  ] [I] press random 32ms
[00:23:09:201 I] [WowProcessInput  ] [I] press random 31ms
[00:23:09:650 I] [WowProcessInput  ] [I] press random 14ms
[00:23:10:158 I] [WowProcessInput  ] [I] press random 21ms
[00:23:10:652 I] [WowProcessInput  ] [I] press random 32ms
[00:23:11:083 I] [WowProcessInput  ] [I] press random 12ms
[00:23:11:518 I] [WowProcessInput  ] [I] press random 11ms
[00:23:12:022 I] [WowProcessInput  ] [I] press random 32ms
[00:23:12:256 I] [CastingHandler   ] [Raptor Strike    ] ... AfterCastWaitSwing
[00:23:12:306 I] [WowProcessInput  ] [Delete] press random 49ms
[00:23:12:307 V] [ConfigurableInput] [StopAttack] Delete pressed 49ms
[00:23:12:370 I] [WowProcessInput  ] [D4] press random 62ms
[00:23:12:371 D] [ConfigurableInput] [Raptor Strike] D4 pressed 62ms
[00:23:12:468 I] [CastingHandler   ] [Raptor Strike    ] castbar input 63ms -97.1922ms
[00:23:12:534 I] [WowProcessInput  ] [I] press random 26ms  -- my character started looting 
[00:23:12:590 I] [GoapAgent        ] Kill credit detected! Session Total: 1 | Last Combat: 1 | Currently fighting: 1
[00:23:12:591 I] [CombatGoal       ] Lost target!
[00:23:12:593 I] [GoapAgent        ] New Plan=  Wait
[00:23:12:594 I] [WaitGoal         ] ...
At this point i manually intervened and turned my character a little bit
[00:23:14:177 I] [GoapAgent        ] New Plan=  Combat
[00:23:18:607 I] [CastingHandler   ] [Raptor Strike    ] ... AfterCastWaitSwing
[00:23:18:662 I] [WowProcessInput  ] [Delete] press random 54ms

Locally i managed to work around the issue by adding two extra Requirements to RequirementFactory

            // Soft Target
            { "STarget", bits.SoftInteract },
            { "STargetDead", bits.SoftInteract_Dead },

so my class profile looks like this

      {
        "Name": "AutoAttack",
        "Requirements": [
          "InMeleeRange",
          "!AutoAttacking",
          "!STargetDead"
        ]
      },
      {
        "Name": "Approach",
        "Log": false,
        "Requirements": [
          "InMeleeRange",
          "!STargetDead"
        ]
      }

Copy link
Owner

@Xian55 Xian55 Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just pushed a new version, i think it should tackle the concerns about the original PR, however potentially fixes many more issues, even with skinning related issues. When the player become idle due conflicting Soft Targeting feature... especially when multiple mob encounter is involved!

If you have time to checkout this version and run some test, i would highly appreciate your feedback on the matter!

Copy link
Owner

@Xian55 Xian55 Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a video with the fixed logic.

Notice, after the first mob dies, it wont immediately start auto attacking the second, but awaits the Raptor Strike cooldown which initiates the Auto Attacking due the dead target still the player soft target! Pressing the Interact with Target key(I) would make the player stuck.

1080_watermark_big.mp4

Sadly during this situation the Interact key looting become unavailable due it will keep attempting the same target instead of trying to progress with the rest of the dead targets.

  • Currently only the mouse based looting would work
  • One possible solution would be is to keep turning the player, but it is not clear to me what direction the player should turn(left or right) as we don't have info about the corpse exact locations only approximations.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's another one with 3 targets.

1080_watermark_big.mp4

Fix: Core: LootGoal: Prevent possible endless wait for LootStatus to be reset.

Revert: Core: ConsumeCorpseGoal: Allow to loot early even while the player is in combat, but theres not immediate danger from CombatLog(DamagaTaken,DamageDone)

Core: ClassConfigurationBaseActions: Approach and AutoAttack has a predefined Requirement to prevent colliding with Soft Targeting feature if its enabled...

Core: ClassConfiguration: Added a way to inhert BaseAction Requirements to Goal
@Xian55 Xian55 merged commit de8fd0e into Xian55:dev Dec 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants