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

Optimize BroadPhase2dHashGrid to not pair elements on different layers #45989

Merged

Conversation

HenryWConklin
Copy link
Contributor

@HenryWConklin HenryWConklin commented Feb 14, 2021

Closes #45824, up from <1fps to 60fps on my laptop so I'll call that a success.

This could use some testing, but I could not figure out how to set up a BroadPhase2dHashGrid in a test in a way that I could monitor it.

@Calinou Calinou added bug topic:physics cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Feb 14, 2021
@Calinou Calinou added this to the 4.0 milestone Feb 14, 2021
@akien-mga akien-mga requested review from a team and removed request for AndreaCatania February 14, 2021 11:04
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp left a comment

Choose a reason for hiding this comment

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

This fix seems to work well!
I've just left some comments to change a few things that could make the code easier to follow.

servers/physics_2d/broad_phase_2d_hash_grid.cpp Outdated Show resolved Hide resolved
servers/physics_2d/broad_phase_2d_hash_grid.cpp Outdated Show resolved Hide resolved
servers/physics_2d/broad_phase_2d_hash_grid.cpp Outdated Show resolved Hide resolved
servers/physics_2d/broad_phase_2d_hash_grid.h Outdated Show resolved Hide resolved
@HenryWConklin HenryWConklin force-pushed the optimize-2dphys-different-layers branch 2 times, most recently from 55c2735 to a3388aa Compare April 15, 2021 12:49
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp left a comment

Choose a reason for hiding this comment

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

Thanks, there's just a couple things to change and it should be good to go.

servers/physics_2d/broad_phase_2d_hash_grid.cpp Outdated Show resolved Hide resolved
servers/physics_2d/broad_phase_2d_hash_grid.h Outdated Show resolved Hide resolved
@HenryWConklin HenryWConklin force-pushed the optimize-2dphys-different-layers branch from a3388aa to 9b65b00 Compare April 15, 2021 21:20
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp left a comment

Choose a reason for hiding this comment

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

Amazing, thank you!

@akien-mga akien-mga merged commit dddbde8 into godotengine:master Apr 16, 2021
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Colliding Rigidbody2Ds cause FPS drop even if their masks/layers don't match
4 participants