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

Gamelab: Update p5.play to 1.1.9-cdo #14849

Merged
merged 1 commit into from May 8, 2017
Merged

Conversation

islemaster
Copy link
Contributor

Updates p5.play from v1.1.6-cdo to v1.1.9-cdo, with the general result of improving collisions and performance. Here's the complete diff. The main improvements are:

  • Adds a broad-phase tunneling check using swept collider bounds for more accurate tunneling prevention, implemented by @joshlory.
  • Fixes a nasty bug in CollisionShape.prototype.getBoundingBox that was hurting performance.
  • Disables adding colliders to the quadtree - we're disabling the quadtree in Game Lab anyway, but p5.play was still doing the fairly expensive work of adding each collider to the quadtree as it was created.

Copy link
Contributor

@Hamms Hamms left a comment

Choose a reason for hiding this comment

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

Do we have any numbers for how much this update will improve performance?

@islemaster
Copy link
Contributor Author

I've only got rough measurements but here's what I found:

Using the 500-sprite test program listed in code-dot-org/p5.play#24 I found the run-button-click delay (running student setup code and the first draw loop) improved from about 1.5s to about 0.5s.

  • The getBoundingBox method we fix here is only used by the quadtree.
  • We didn't see much framerate improvement because we already disabled the quadtree update in Game Lab.
  • Even with quadtree disabled, we were adding colliders to the quadtree when they were created which also hit getBoundingBox - hence the big slowdown on the first frame when all 500 sprites get default colliders created. We disable this too so the getBoundingBox code isn't actually called from Game Lab at all anymore.
  • I tried re-enabling the quadtree now that getBoundingBox is fixed - it's a lot better, but it's still a bit slower than running without the quadtree. I suspect at this point quadtree might improve performance for apps using groups and having very high collision event density, but we suspect that's the less common case and we'll want to speed up our bounding box code more before we re-enable it.

It looks like the next perf target for Game Lab might actually be lots of small tuning of vector operations - we create and destroy too many vectors in our collision code, cleaning up individual methods and using a vector pool might help.

@islemaster islemaster merged commit bad93d2 into staging May 8, 2017
@islemaster islemaster deleted the gamelab-p5-1.1.9-cdo branch May 8, 2017 21:03
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.

None yet

2 participants