Fix Biome System integration, memory optimization, and Tiled live sync workflow

This commit is contained in:
2025-12-27 12:50:58 +01:00
parent f8d533465b
commit 43f4b11c87
19 changed files with 1314 additions and 591 deletions

View File

@@ -81,7 +81,7 @@ class StructureSystem {
const sampleRate = 50;
for (let x = 0; x < this.worldWidth; x += sampleRate) {
for (let y = 0; y < this.worldHeight; y += sampleRate) {
const biome = this.biomeSystem.getBiome(x, y);
const biome = this.biomeSystem.getBiomeAt(x, y);
if (!biomeLocations[biome]) biomeLocations[biome] = [];
biomeLocations[biome].push({ x, y });
}
@@ -91,7 +91,9 @@ class StructureSystem {
const roadPoints = [];
// Central hub (spawn point)
roadPoints.push({ x: 250, y: 250, name: 'Center' });
const centerX = Math.floor(this.worldWidth / 2);
const centerY = Math.floor(this.worldHeight / 2);
roadPoints.push({ x: centerX, y: centerY, name: 'Center' });
// Add one major location per biome
for (const [biomeName, locations] of Object.entries(biomeLocations)) {
@@ -228,7 +230,7 @@ class StructureSystem {
// Check if location is valid
if (this.canPlaceStructure(x, y, 20)) {
const biome = this.biomeSystem.getBiome(x, y);
const biome = this.biomeSystem.getBiomeAt(x, y);
const types = this.structureTypes[biome];
if (types && types.length > 0) {
@@ -334,7 +336,7 @@ class StructureSystem {
const x = Math.floor(Math.random() * this.worldWidth);
const y = Math.floor(Math.random() * this.worldHeight);
const biome = this.biomeSystem.getBiome(x, y);
const biome = this.biomeSystem.getBiomeAt(x, y);
if (biome === biomeName && this.canPlaceStructure(x, y, minDistance)) {
return { x, y };