Skip to content

Commit

Permalink
throttle chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Dec 16, 2024
1 parent ed226ac commit cbf9572
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/three/scenes/Worldmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ export default class WorldmapScene extends HexagonScene {
this.interactiveHexManager.clearHexes();

let currentIndex = 0;
const batchSize = 25;
const batchSize = 50;

const processBatch = () => {
const endIndex = Math.min(currentIndex + batchSize, rows * cols);
Expand Down Expand Up @@ -806,7 +806,7 @@ export default class WorldmapScene extends HexagonScene {
return { chunkX, chunkZ };
}

updateVisibleChunks(force: boolean = false) {
updateVisibleChunks = throttle((force: boolean = false) => {
const cameraPosition = new THREE.Vector3();
cameraPosition.copy(this.controls.target);
const { selectedEntityId } = this.state.armyActions;
Expand All @@ -832,7 +832,7 @@ export default class WorldmapScene extends HexagonScene {
this.highlightHexManager.highlightHexes([]);
}
}
}
}, 1000);

update(deltaTime: number) {
super.update(deltaTime);
Expand Down

0 comments on commit cbf9572

Please sign in to comment.