feat: Improve stone layer visibility and rendering

This commit is contained in:
Kacper Kostka (aider)
2025-04-05 15:40:27 +02:00
parent 15fb106246
commit 883c3d9a08
3 changed files with 33 additions and 7 deletions

View File

@@ -56,8 +56,8 @@ function getOrCreateChunk(chunkX, chunkY) {
if (random() > noiseThreshold) {
chunkData[y * CHUNK_SIZE + x] = SAND;
} else {
// Randomly choose between stone and empty space
chunkData[y * CHUNK_SIZE + x] = random() < 0.7 ? STONE : EMPTY;
// Increase stone density to make it more visible
chunkData[y * CHUNK_SIZE + x] = random() < 0.9 ? STONE : EMPTY;
}
} else {
// Below the transition zone, it's all stone
@@ -65,6 +65,9 @@ function getOrCreateChunk(chunkX, chunkY) {
}
}
}
// Mark this chunk as dirty to ensure it gets rendered
dirtyChunks.add(key);
}
// Floor has been removed as it's no longer needed
@@ -524,10 +527,9 @@ function generateChunksAroundPlayer() {
const chunkY = 1; // The chunk at y = 1 (moved from y = -1)
const key = getChunkKey(chunkX, chunkY);
// Prioritize visible chunks
if (visibleChunkKeys.has(key)) {
getOrCreateChunk(chunkX, chunkY);
}
// Always generate and mark as dirty to ensure rendering
getOrCreateChunk(chunkX, chunkY);
dirtyChunks.add(key);
}
// Generate visible chunks first