-
Notifications
You must be signed in to change notification settings - Fork 6
1122 test path smoothing with splines #1139
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
base: main
Are you sure you want to change the base?
Conversation
7b100a1
to
77e36ba
Compare
412a89c
to
cd66994
Compare
bc5d13e
to
871b2d3
Compare
ae46d35
to
a7850ce
Compare
4e7b897
to
d1fcc58
Compare
d1fcc58
to
e72177a
Compare
Ran loadtest without using splines. Here's the snapshot. While metrics didn't vary that much, the game felt a bit more stuttery compared with main with 400 games, but run smoothly with 300 |
Just ran another loadtest but with the splines feature on. The games felt more stuttery. We'll merge this PR but keeping the flag off by default with a note on splines. In the future if we double down on them we can look for improvements such as:
|
before it was being added in game_socket_handler from the BotManager but that file was deleted
5368d95
to
3d8be76
Compare
|> maybe_set_obstacles(game_state) | ||
end | ||
|
||
defp maybe_set_obstacles(%{bot_state_machine: %{obstacles: nil}} = state, %{obstacles: obstacles}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to store the obstacles in order to perform collision checks when simplifying the path
@segment_point_amount 5 | ||
@tension 0.2 | ||
@alpha 0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also play with these values. I used the values suggested in the article, and played around with the segment_point_amount
. After 5 I didn't see a difference
Motivation
We want to make the bot movement a bit less robot-like. For now we won't mind it not being perfect. We compared against brawl stars and tried to use their bot movement as a baseline
Closes #1122
Summary of changes
Added 2 core functions for bots:
TEST_PATHFINDING_SPLINES
. Based on load tests there is a noticeable performance impact of doing this, so for now we'll keep it off by default. Once we retake bots research we can use it to compare against other techniques or try to improve it.How to test it?
Play a game locally. Check that bots take more reasonable paths. You can test the splines by running
export TEST_PATHFINDING_SPLINES=true
and restarting the app. Bots will take more "rounded" paths, the movement is still not 100% smooth, but it is done so in small increments.Checklist