Jump to content

Poor performance with tilemap on Android


kidos
 Share

Recommended Posts

Hi guys, this forum is my last resort. I'm having a very bad performance on Android with Tilemap (checked with galaxy S2 and S3 )

I'm using Phaser 2.0.5 and CocoonJS 2.0.2.

 

If I'm doing it without tilemap, just a bunch of sprites the fps stays  fixed on 60-62.

But if I'm loading a tilemap with basic layers in it, I'm getting unstable fps (20-60), I'm not doing anything special, just an ordinary tilemap things.

Tried to comment out everything, even just a basic code like:

 

preload:

// Load Tilemapthis.game.load.tilemap('mapData', 'assets/tilemaps/World1Level1.json', null, Phaser.Tilemap.TILED_JSON);this.game.load.image('mapImage', 'assets/tilemaps/World1Tileset.png');this.game.load.image('mapTrees', 'assets/tilemaps/World1Trees.png');

create:

// Adding a map and layerthis.map = this.game.add.tilemap('mapData');this.map.addTilesetImage('World1Tileset', 'mapImage');this.map.addTilesetImage('World1Trees', 'mapTrees');this.layerback1 = this.map.createLayer('Back1');this.layerback2 = this.map.createLayer('Back2');this.layermain = this.map.createLayer('Ground');this.layerledge = this.map.createLayer('Ledge');this.layerfront = this.map.createLayer('Foreground');//  This resizes the game world to match the layer dimensionsthis.layermain.resizeWorld();// Some collisionsthis.map.setCollisionByExclusion([0],true, 'Ground');this.map.setCollision([2,3,4,5,6,7,22,23,24,25,26,27],true, 'Ledge');this.map.forEach(function(tile) {if ((tile.index >= 2 && tile.index <= 7) || (tile.index >= 22 && tile.index <= 27)) { tile.setCollision(false, false, true, false); // left, right, up, down}}, this, 0, 0, this.map.width, this.map.height, this.layerledge);

update (didn't copied the whole player code):

this.game.physics.arcade.collide(player.sprite, this.layermain);this.game.physics.arcade.collide(player.sprite, this.layerledge);

If the player don't walk the fps stays at 60fps but once he's starting to walk and the tilemap needs to be rendered in a new position the fps gets unstable.

Also tried to reduce the game resolution and all of my assets resolution which helped a bit but still not as I wanted.

In iOS it works perfectly (checked with iPhone 4s and 5c)

 

Has anyone experienced this problem before? Any ideas?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...