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

Use surveil in move tutorial #2064

Merged
merged 9 commits into from
Jul 22, 2024
Merged

Use surveil in move tutorial #2064

merged 9 commits into from
Jul 22, 2024

Conversation

xsebek
Copy link
Member

@xsebek xsebek commented Jul 21, 2024

This should make the move tutorial run faster by making most of the robots surveil the door to their section.

@xsebek xsebek requested a review from kostmo July 21, 2024 16:21
@xsebek xsebek marked this pull request as ready for review July 21, 2024 16:21
@xsebek xsebek requested a review from byorgey July 21, 2024 16:21
Comment on lines +417 to +419
m <- instant (run "scenarios/Tutorials/move_surveil.sw";
main [action="P", entity="flower", room=3]);
m
Copy link
Member Author

Choose a reason for hiding this comment

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

@byorgey this is how instant has to be used to not pay for tangible run. The result is the rest of the computation which waits and places the wall.

@byorgey
Copy link
Member

byorgey commented Jul 21, 2024

For me, it's super laggy up until you move to the first flower, then very snappy after that. By "super laggy" I mean e.g. it takes several seconds to respond at all when I start typing move; move; even after that it still takes up to half a second to respond to each keypress.

I actually don't quite understand what's going on here. Sometimes, when I start the tutorial it pauses for several seconds before showing the goals dialog, and then is reasonably fast after that. But sometimes, it shows the goal dialog right away, and then once I exit that it sits there not responding for several seconds. The first feels annoying but acceptable; the second feels pretty bad because it looks like it is ready for you to start typing but it is not.

@xsebek
Copy link
Member Author

xsebek commented Jul 21, 2024

@byorgey I removed a few busy waiting robots and put the check robot to sleep if you are far from the door.

I don't think I can easily optimize this further; most of the time is spent parsing the same file 60 times:
Screenshot 2024-07-22 at 1 27 26

I could make a robot that runs the file and instantly builds new robots, which would teleport to their place.
That would only parse once, but have new problems:

  • timing problems - build takes another tick, so the first corridor would have to be longer
  • it would use manually written position lists with no declarative map
  • I don't want to write that; I would rather work on import

@byorgey
Copy link
Member

byorgey commented Jul 22, 2024

Hmm, it definitely feels more responsive now (@DanRyba253 also posted some timing data in Discord suggesting the same thing). However, it seems slightly broken: when I execute move; move to go to the first flower, the corridor to the second flower opens up, but there is no goal popup dialog. After I move to the second flower, two goal dialogs pop up in succession.

@byorgey
Copy link
Member

byorgey commented Jul 22, 2024

And yes, as for import, definitely don't spend effort trying to optimize the repeated file reading, we'll work on that separately.

@@ -13,7 +13,7 @@ objectives:
condition: |
r <- robotNamed "check";
w <- as r {count "Win"};
return (w >= 2)
return (w >= 1)
Copy link
Member Author

Choose a reason for hiding this comment

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

@byorgey, thanks for pointing it out; I made a typo while changing the conditions to use one robot.

Copy link
Member

@byorgey byorgey left a comment

Choose a reason for hiding this comment

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

Looks good now, this seems a strict improvement over the previous version.

I still don't understand why sometimes I get a long pause before the initial goal modal is shown, and sometimes I get a long unresponsive pause after dismissing the goal modal. I have not been able to find any particular way to consistently get one behavior or the other. But whatever the reason I don't think it's the fault of this scenario.

@xsebek xsebek added the merge me Trigger the merge process of the Pull request. label Jul 22, 2024
@mergify mergify bot merged commit 2329736 into main Jul 22, 2024
14 checks passed
@mergify mergify bot deleted the surveil-move-tutorial branch July 22, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants