jake Posted December 15, 2013 Share Posted December 15, 2013 Hello everyone, So I've been testing out Phaser (I love the API btw) with a tiled map but I've been having performance issues. The map consists of 12 layers at 100 x 100 units (which are 16 x 16 pixels) and when traversing the map with the arrow keys it's quite slow. I don't know if I'm doing this optimally within Phaser so I'll just share code snippet I'm using. http://pastebin.com/QEd3ccr1 If there isn't issues with my code, could anyone tell me if Phaser would have problems handling maps this size or larger? Thanks. Link to comment Share on other sites More sharing options...
rich Posted December 15, 2013 Share Posted December 15, 2013 Change the size of your tilemapLayers so they are only the same width/height as your game. I understand why you set them to what you did, because one of the examples does this, but it's actually a mistake and creates a canvas far too large causing slow-down. Link to comment Share on other sites More sharing options...
jake Posted December 16, 2013 Author Share Posted December 16, 2013 Thanks Rich, this caused a noticeable performance increase for sure but still quite laggy. Any other suggestions? Link to comment Share on other sites More sharing options...
rich Posted December 16, 2013 Share Posted December 16, 2013 Don't use 12 layers It's having to redraw all tiles across 12 layers, every frame. Which is quite a hit. If any of those layers can be combined it would help a lot. In 1.1.4 I've added the ability to render multiple layers to a single canvas, but that won't be ready until end of this month. Link to comment Share on other sites More sharing options...
jake Posted December 16, 2013 Author Share Posted December 16, 2013 That's fair, I've mostly been experimenting with work from libGDX out of an interest for JavaScript. Thanks for your help Rich. Link to comment Share on other sites More sharing options...
Recommended Posts