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

TilemapLayer / Tileset performance and documentation #1250

Merged
merged 5 commits into from
Nov 8, 2014

Conversation

pnstickne
Copy link
Contributor

Huge scrolling-performance efficiency increase and some cleanup.

TilemapLayer
 - Added "delta scroll rendering"
   - Enabled (by default) via `renderSettings.enableScrollDelta`
   - Dramatic CPU reduction: 30% to 2% scrolling 50x37 region
   - Side-effect: fixed some Chrome de-opt issues with `render`
   - Various rendering updates and removal of many `_mc` field
 - Made `index` a read-only propert that reflects the layer.index
 - Creates a local cache from tile index -> tileset, added `resetTilesetCache`
   - Also prevents crash when an index not associated with a tileset is
     used; see `missingImageOverfill`.
 - Various debug options moved to `debugSettings` and simplified; documentation updated.
   - Uses `debugSettings.missingImageOverfill` and `tileColor` (deprecated) to display invalid tileset images
 - Only change the context alpha when the tile alpha changes; in Chrome 38
   this removed a .5% penalty
 - Added `renderSettings` which controls misc. rendering/optimizations.
 - Updated documentation to @member, clarified

Tileset
 - Added `containsTileIndex` method to allow being queried if the specific tile index is handled/supported.
 - Uses a firstgid bias and interlacing to fit the data in single densely packed array.
 - Updated documentation to @member, clarified
- Minor regression fix, increasing argument specifity/documentation
@pnstickne
Copy link
Contributor Author

This should also fix: #1240

@pnstickne
Copy link
Contributor Author

These changes should alleviate some scrolling performance boos. The only breaking API changes are against some of the debug* properties; but being debug properties..

@pnstickne
Copy link
Contributor Author

May alleviate #1194 - if this does shown an improvement (esp. in Canvas) then the next step is to add in overdraw and bounding support for texture moving for additional performance improvements in WebGL.

* @param {integer} x
* @param {integer} y
*/
Phaser.TilemapLayer.prototype.shiftCanvas = function (context, x, y)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shifting the canvas is alot more efficient then redrawing the entire canvas.

@photonstorm
Copy link
Collaborator

Merging for test. If this goes forward I'm going to have to bump the version to 2.2.0 imho (especially given the ScaleManager updates as well)

photonstorm added a commit that referenced this pull request Nov 8, 2014
TilemapLayer / Tileset performance and documentation
@photonstorm photonstorm merged commit b250e61 into phaserjs:dev Nov 8, 2014
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.

None yet

2 participants