Better world generation

This commit is contained in:
2026-09-25 17:14:26 -03:00
parent c750321ced
commit d07528bd0e
14 changed files with 1315 additions and 334 deletions
+3 -3
View File
@@ -485,7 +485,7 @@ export class ClientLevel {
let chunk = this.chunks.get(key);
if (chunk) {
// a placeholder made by a neighbor's tree, keep its blocks where generation left air
// a placeholder made by a neighbor's feature, keep its blocks where generation left air
const existing = chunk.blocks;
for (let i = 0; i < blocks.length; i++) {
if (blocks[i] !== AIR) {
@@ -509,7 +509,7 @@ export class ClientLevel {
}
}
// trees spill into neighboring chunks, so their changes need reapplying too
// features spill into neighboring chunks, so their changes need reapplying too
for (let dx = -1; dx <= 1; dx++) {
for (let dz = -1; dz <= 1; dz++) {
this.apply_chunk_changes(cx + dx, cz + dz);
@@ -569,7 +569,7 @@ export class ClientLevel {
mesh.index_buffer = create_index_buffer(message.indices);
}
// a neighbor's leaves, only fill air so the result doesn't depend on which chunk loaded first.
// blocks a neighbor's features put here, only fill air so the result doesn't depend on which chunk loaded first.
// the server builds chunks the same way (server/game/world.ts)
#set_block_raw(x: number, y: number, z: number, nid: number) {
if (y < 0 || y >= CHUNK_HEIGHT) {
+1 -1
View File
@@ -53,7 +53,7 @@ export type FromChunkWorker =
chunk_x: number;
chunk_z: number;
blocks: Uint32Array;
// blocks that landed in other chunks (tree leaves), flattened as x, y, z, numeric id
// blocks that landed in other chunks (from features like a mod's trees), flattened as x, y, z, numeric id
spills: Int32Array;
}
| {