Client side chunk sections

This commit is contained in:
2026-11-07 10:39:16 -03:00
parent 8e14e9842a
commit 71cbf901a5
19 changed files with 162 additions and 116 deletions
+6 -1
View File
@@ -6,6 +6,7 @@
// GameServer.use_worldgen_pool
import { assert, assertEquals } from "@std/assert";
import { is_within_view } from "@/common/chunk_streaming.ts";
import { to_flat } from "@/common/section.ts";
import { game_with_pool, load_view } from "./chunk_loading.ts";
// the workers and their ports live until the test closes them
@@ -32,7 +33,11 @@ Deno.test({
if (!is_within_view(cx, cz, player.chunks.view_distance, x, z)) continue;
const chunk = chunks.get(`${x},${z}`);
assert(chunk, `chunk ${x},${z} wasn't sent`);
assertEquals(chunk.blocks, t.game.world.generated_blocks(x, z).to_flat(), `chunk ${x},${z}`);
assertEquals(
to_flat(chunk.sections),
t.game.world.generated_blocks(x, z).to_flat(),
`chunk ${x},${z}`,
);
}
}
assert(t.pool!.generated - generated > chunks.size, "the pool made them, and their neighbors");