These are chat archives for pixijs/pixi.js

2nd
Jan 2018
scarejar
@scarejar
Jan 02 2018 03:27
anyone here familiar with javascript performance ?

let mainMap = [ 0, 0, 0, 122, 111, 0    //debating if I should switch to a 2D arrray
                                 0, 0, 0 , 0, 1, 1  ] 

let arraySprites = [];
function createMapSpritePool(mainMap, mapTexture){
          //logic
          let tile = new PIXI.Sprite(mapTexture);
          arraySprites.push(tile);
  }


//culling:
 loop through the arraySprites and all their positions, compare if it falls within player boundaries
drawbacks: I'm expecting maps to have 10,000 tiles per layer, average 3 layers, so 30k so i'm not sure if the loop will be fast enough to re-generate the map on player move

is there a better way to do this ?
Ivan Popelyshev
@ivanpopelyshev
Jan 02 2018 09:48
use pixi-tilemap
general optimization: maintain a "window" around the camera, clear and refill it when camera touches the edge
that can work with your pool, but with pixi-tilemap it doesnt even need sprites