Hello! Sorry for rather broad question. Here I have a game and its source code. Map has 8 layers, Tile size is 64 px. Sprite size in 140x100 and its size is 350 Kb.
Game consumes 60 Mb RAM, 20% CPU and 160 Mb GPU and its laggy on some low resource PCs.
Is it consuming so much resources because of large map?
What steps, beside decreasing tile maps size and tile size, can I take to increase performance?
Hi, don’t show such a large part of you map, try to reduce number of layers and try to use CANVAS instead of WebGL. Or try to do the same in P3 where tilemaps should be faster.
If you need a layer in the collisions, hide it to not use the renderer:
// on flour layer
this.onFlour = map.createLayer('onFlour');
this.onFlour.visible = false;
In your case, you don’t need to process the sprites generated in your onSizeChange () method.
Result in my pc: performance has improved from 20% cpu to 6% cpu.
Regards.