Jump to content

Tilemap's initial freeze


WombatTurkey
 Share

Recommended Posts

When loading multiple layer's for your tilemap by using the createLayer method, the browser actually freezes for (1 to 3 seconds), based upon how many layer's you're loading and map size. 

The problem is, the entire browser page freezes and so if you have an animated gif loader, that will freeze for those 1 to 3 seconds and it just doesn't look seamless. Looks glitchy if you will.

But, after that initial freeze of a few hundred milliseconds, everything works fine and there is no lag when the player moves around the map.  Am I the only one who experiences this?

 

 

Edit: just reduced my tiled map size and it's still there, but the duration has decreased by a lot.  Hmm, I wonder if there is a way to get rid of that initial freeze?

 

Link to comment
Share on other sites

Hi Wombat - I'm pretty new to phaser game dev but working on an ambitious project myself.  A few questions to isolate your problem:  how are you building your layers - is this a tiled map json export?  Do you have a lot of collision layers?  Is this a large scale array with no culling?

 

I am currently working with a world map at 4096x4096 and am not noticing what you are reporting, however, I've built my map with tiled and have been very carefully eliminating any created items I don't need.

Link to comment
Share on other sites

9 hours ago, greatimposter said:

Hi Wombat - I'm pretty new to phaser game dev but working on an ambitious project myself.  A few questions to isolate your problem:  how are you building your layers - is this a tiled map json export?  Do you have a lot of collision layers?  Is this a large scale array with no culling?

 

I am currently working with a world map at 4096x4096 and am not noticing what you are reporting, however, I've built my map with tiled and have been very carefully eliminating any created items I don't need.

 

Hey imposter,

Yea, it's a tiled map json export and only 1 collision layer (but enabling or disabling the collision layer doesn't have an effect). I have around 4 layers, using layer, then the other 3 ground layers.

%7Boption%7Dhttps://i.gyazo.com/01a441480441bd98bf302600e8c0bacf.png

And my tileset image is: 

%7Boption%7Dhttps://i.gyazo.com/335be0504630e168efc7e6fdcd38737d.png

My tileset is pretty large in dimensions and size.

And my exported JSON level is 256KB (gzipped to around 3KB after sent across the pipe)

 

 

Also, I switched to https://github.com/englercj/phaser-tiled

And the initial loading (freezing) decreased by about a second, and holy crap! There is no lag whatsoever while moving! This is a huge, HUGE increase and I wonder why it's not added into the Phaser core!

 

Link to comment
Share on other sites

I attempted using phaser-tiled recently and actually found more problems with it than it solved.  I do believe Phaser has outgrown that particular plugin, which may become obvious if you use State transition plugins like phaser-statetransition.

 

That being said, I think theoretically your issue may be related to "culling".  phaser-tiled does some good work around autoculling, but I think out of the box phaser doesn't auto cull and instead requires it to be turned on.

http://phaser.io/docs/2.4.4/Phaser.TilemapLayer.html#autoCull

I think TilemapLayer has an autoCull property that can be set to true.  I'm curious if you see an improvement with that, it definitely worked for me - essentially preventing the texture from being rendered outside of the camera viewport.  I think phaser-tiled does viewport culling by default.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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