sivael Posted June 25, 2014 Share Posted June 25, 2014 Hi. I've just been profiling my game and it has been *awfully* slow to cleanup a part of a tilemap.There wasn't any indication of why it would be slow; 20x20 was snappy. 100x100 was a nightmare. And I was updating 390 tiles.Now I'm not using physics.Tilemap code updates all layers when things change so it was a loop of 100x100x390 updates in TileMap.calculateFaces.Unsure if I was doing something wrong or some such, but I don't think this is a desired functionality. I'd say - do this at most once per frame.What I did was hack it by adding "return; //collision isn't used here." in the first line.I do my collisions outside of phaser (I anyway need to store my map data and objects logic for load/save) so that's probably why this was not needed.Anyway - It'd be nice to make it simple to update multiple layers and keep the calculateFaces from firing.Maybe something like:TileMap.preventRecalculate(doPrevent);and if it's prevented and changed, you just mark it for update.Simple, I think. Thanks for the freat framework,Tim. Link to comment Share on other sites More sharing options...
Heppell08 Posted June 25, 2014 Share Posted June 25, 2014 by any chance are you destroying a previous layer and creating back onto that layer or are you doing something else? I have a game that has many levels and they are all tilemaps, i destroy the layer and then create on the same layer again. It's difficult to say really but maybe this post i made when i had a few issues a while about my level logic might be worth a look? http://www.html5gamedevs.com/topic/4466-help-on-something-probably-quite-simple/ Link to comment Share on other sites More sharing options...
sivael Posted June 27, 2014 Author Share Posted June 27, 2014 No, not recreating.I have an object Map that contains the map data and handles the updates.It has a Layer and a TileMap reference.In the Map object, I am modifying a part of the layerthis.phaserMap.removeTile(ix, iy, this.phaserBGLayer);ORthis.phaserMap.putTile(instance.subId, x, y, this.phaserBGLayer);(390 out of the total 10000 tiles) and that is taking a *long* time. That time is spent in TileMap.calculateFacesevery time after I change a single tile. UPDATE: Lost part of the post o.0Pull request here: https://github.com/photonstorm/phaser/pull/951 Link to comment Share on other sites More sharing options...
Recommended Posts