Problem with game performance


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.


Hi @microspace,
One solution is to convert the tilemap layers into large sprites:

        // flour layer
        var flour = map.createLayer('flour');
        flour.resize(40*64, 17*64);
        var flour_texture = flour.generateTexture(1,PIXI.scaleModes.DEFAULT,;
        this.flourSprite =,0,flour_texture);
        flour.visible = false;

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.


Thank you for your replies! I’ll try adding one big sprite as layer in near future, sounds like great idea.