experiment with optimising map-chunk message
This commit is contained in:
parent
ee62f9646e
commit
4a2c771603
1 changed files with 37 additions and 0 deletions
|
|
@ -41,6 +41,43 @@ function mapTilesUpdateDebounce(
|
|||
protos: {},
|
||||
}
|
||||
|
||||
|
||||
// let maxX = 0
|
||||
// let minX = 0
|
||||
// let maxY = 0
|
||||
// let minY = 0
|
||||
// for (const tile of tiles) {
|
||||
// //@formatter:off
|
||||
// if (tile.position.x < minX) minX = tile.position.x
|
||||
// if (tile.position.x > maxX) maxX = tile.position.x
|
||||
// if (tile.position.y > minY) minY = tile.position.y
|
||||
// if (tile.position.y > maxY) maxY = tile.position.y
|
||||
// //@formatter:on
|
||||
// }
|
||||
//
|
||||
// const noTileProto = 0
|
||||
//
|
||||
// const grid: int[][] = []
|
||||
// for (let x = 0; x < maxX; x++) {
|
||||
// grid[x] = []
|
||||
// for (let y = 0; y < maxY; y++) {
|
||||
// grid[x][y] = noTileProto
|
||||
// }
|
||||
// }
|
||||
// data.tileDictionary.protos["no-tile"] = noTileProto
|
||||
//
|
||||
// let protosCount2: uint = 0
|
||||
// for (const tile of tiles) {
|
||||
// const x = tile.position.x - minX
|
||||
// const y = tile.position.y - minY
|
||||
//
|
||||
// data.tileDictionary.protos[tile.name] ??= protosCount2++
|
||||
// grid[x][y] = data.tileDictionary.protos[tile.name]
|
||||
// }
|
||||
//
|
||||
// const grid2: string[] = grid.map(row => table.concat(row))
|
||||
|
||||
|
||||
let protosCount: uint = 0
|
||||
for (const tile of tiles) {
|
||||
data.tileDictionary.protos[tile.name] ??= protosCount++
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue