Skip to content

Conversation

@nAmKcAz
Copy link
Contributor

@nAmKcAz nAmKcAz commented Dec 4, 2024

The intent for this first pass was to get 'close' to parity with botsegment mouse recordings while building out the framework for exploratory actions to expand from here. There are some quirks/weirdnesses from time to time, but for bossroom and steelline, this does some things we couldn't do before with recording, while still coming close to being as deterministic in its action choices.

  • Loom Demo on Bossroom of Record + Playback

  • Creates the framework for allowing bots to explore actions to take when a recorded action errors

    • Adds ' retry last successful action' exploration technique as the default/first implementation
  • Adds a new recording of 'key moments' alongside the existing bot segments

    • These use the existing bot segment file format, but have no endCriteria other than action completed... all the logic is in the action and based on the clickedObjectNormalizedPaths of the muse data
    • These currently only support mouse inputs and they record the key interactions on clickable objects
    • These are now playable from the overlay as a 2nd recording type
      image
  • Re-writes how we detect objects at a mouse position (honestly the old was so not good I'm not sure how we go this far with it)

  • Sample KeyMoment Mouse Action file

{
"name":"KeyMoment: 2, Tick: 2 - Mouse Action Segment",
"description":null,
"sessionId":null,
"apiVersion":24,
"endCriteria":[
{"type":"ActionComplete","apiVersion":7,"transient":false,"data":{"apiVersion":11}}
],
"botAction":{"type":"KeyMoment_MouseAction","apiVersion":1,"data":{"apiVersion":28,"mouseActions":[
{"apiVersion":1,"startTime":17.0340247,"leftButton":false,"middleButton":false,"rightButton":false,"forwardButton":false,"backButton":false,"scroll":{"x":0,"y":0},"screenSize":{"x":1502,"y":796},"position":{"x":765,"y":587},"worldPosition":null,"clickedObjectNormalizedPaths":[]},
{"apiVersion":1,"startTime":17.0433465,"leftButton":true,"middleButton":false,"rightButton":false,"forwardButton":false,"backButton":false,"scroll":{"x":0,"y":0},"screenSize":{"x":1502,"y":796},"position":{"x":765,"y":587},"worldPosition":null,"clickedObjectNormalizedPaths":["UI Canvas/ProfilePopup/ProfilesPanel/Viewport/ProfileList/ProfileListItemUI Prototype/Select Profile Button","UI Canvas/ProfilePopup/ProfilesPanel/Viewport","UI Canvas/ProfilePopup","UI Canvas/Title","UI Canvas/ProfilePopup/ProfilesPanel/Viewport/ProfileList/ProfileListItemUI Prototype/Select Profile Button/ProfileNameLabel","UI Canvas/ProfilePopup/ProfilesPanel/Viewport/ProfileList/ProfileListItemUI Prototype","UI Canvas/ProfilePopup/Image"]},
{"apiVersion":1,"startTime":17.1590328,"leftButton":false,"middleButton":false,"rightButton":false,"forwardButton":false,"backButton":false,"scroll":{"x":0,"y":0},"screenSize":{"x":1502,"y":796},"position":{"x":765,"y":587},"worldPosition":null,"clickedObjectNormalizedPaths":["UI Canvas/Title"]}
]}}}

Find the pull request instructions here

Every reviewer and the owner of the PR should consider these points in their request (feel free to copy this checklist so you can fill it out yourself in the overall PR comment)

  • The code is extensible and backward compatible
  • New public interfaces are extensible and open to backward compatibility in the future
  • If preparing to remove a field in the future (i.e. this PR removes an argument), the argument stays but is no longer functional, and attaches a deprecation warning. A linear task is also created to track this deletion task.
  • Non-critical or potentially modifiable arguments are optional
  • Breaking changes and the approach to handling them have been verified with the team (in the Linear task, design doc, or PR itself)
  • The code is easy to read
  • Unit tests are added for expected and edge cases
  • Integration tests are added for expected and edge cases
  • Functions and classes are documented
  • Migrations for both up and down operations are completed
  • A documentation PR is created and being reviewed for anything in this PR that requires knowledge to use
  • Implications on other dependent code (i.e. sample games and sample bots) is considered, mentioned, and properly handled
  • Style changes and other non-blocking changes are marked as non-blocking from reviewers

@nAmKcAz nAmKcAz changed the title [REG-2205] Working last succesful action retry exploration [REG-2205] Exploratory bot actions + mouse key moment recording Dec 11, 2024
@nAmKcAz nAmKcAz changed the title [REG-2205] Exploratory bot actions + mouse key moment recording [REG-2202] [REG-2205] Exploratory bot actions + mouse key moment recording Dec 11, 2024
// if we're working on the first entry in the list is the only time we do actions
if (nextBotSegmentIndex == 0)
{
ProcessBotSegmentAction(nextBotSegment, transformStatuses, entityStatuses);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is the only real change of note in this method... the rest of it shows changed because I got tired of trying to find it in this class and moved it to the top

}
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where the exploration magic happens on playback / the algorithm from Update -> Update is documented

*
* The current implementation chooses one of the previous N successful IKeyMomentExploration actions to try on each update pass.
*/
public void PerformExploratoryAction(int segmentNumber, Dictionary<long, ObjectStatus> currentTransforms, Dictionary<long, ObjectStatus> currentEntities, out string error)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where exploratory actions are driven from. We will hook in other exploratory action types to this class as we create them

};

[CanBeNull]
public BotSegment EvaluateKeyMoment(long tickNumber, out long keyMomentNumber)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where KeyMoment recording happens.

We will hook in other types beyond mouse as noted in the comments in this file.

}

private List<ObjectStatus> FindObjectsAtPosition(Vector2 position, IEnumerable<ObjectStatus> statefulObjects, out float maxZDepth)
public static List<ObjectStatus> FindObjectsAtPosition(Vector2 position, IEnumerable<ObjectStatus> statefulObjects)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method now actually works as you would expect and returns properly sorted results based on depth from camera as a click would be processed.

@nAmKcAz nAmKcAz marked this pull request as ready for review December 11, 2024 21:07
@nAmKcAz nAmKcAz changed the title [REG-2202] [REG-2205] Exploratory bot actions + mouse key moment recording [REG-2202] [REG-2205] [REG-2228] Exploratory bot actions + mouse key moment recording Dec 12, 2024
@nAmKcAz
Copy link
Contributor Author

nAmKcAz commented Dec 12, 2024

Update post Loom video.. Commit e74ffb4 [REG-2228] fixes the world space object click misses

Copy link
Contributor

@abeizer abeizer left a comment

Choose a reason for hiding this comment

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

Wow, many changes and very dense. I appreciate the decision to document so much in-code, it was easy to understand how exploration is woven into the replay and how clicks + unclicks are tracked and applied to objects in the scene.

I'm hesitant to dig too deeply into reviewing line-by-line because I expect details to change frequently as we add exploration support to more actions and figure out how they should/shouldn't interact with each other. At a high level, I'm on board with this exploration pattern and think we should keep pushing forward.

Copy link
Contributor

@addisonbgross addisonbgross left a comment

Choose a reason for hiding this comment

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

I've reviewed this PR over 2 days, due to its size, and everything looks reasonable. Your Looms and PR/Code comments made it much easier to understand. Like Abby, I don't really have any commentary on the line-by-line changes. I look forward to testing this out!

@nAmKcAz nAmKcAz merged commit 169570a into zack/key-moment-recording Dec 16, 2024
2 checks passed
@nAmKcAz nAmKcAz deleted the zack/key-moment-exploration-action-retry branch December 16, 2024 13:58
Copy link
Collaborator

@vontell vontell left a comment

Choose a reason for hiding this comment

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

Just passing by because I finally had a chance to look at this today. Very excited to try this out, and good to see that these key moments and exploration is saved as an additional file to keep the previous approach intact.

I'll start to think about new exploratory approaches... got some initial ideas.

@nAmKcAz nAmKcAz restored the zack/key-moment-exploration-action-retry branch December 17, 2024 15:15
@nAmKcAz nAmKcAz deleted the zack/key-moment-exploration-action-retry branch December 17, 2024 15:32
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.

5 participants