feat: Improve stone layer visibility and rendering
This commit is contained in:
14
js/world.js
14
js/world.js
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user