Move world generation outside the engine and into mods and data files

This commit is contained in:
2026-10-11 00:33:59 -03:00
parent afe6e03d4c
commit 3d2b235f64
118 changed files with 8250 additions and 1108 deletions
+27
View File
@@ -0,0 +1,27 @@
// how long generating chunks takes, for keeping generation fast as it moves to data, see GENERATION.md.
// deno task bench
import { generate_raw_chunk } from "$/common/generation.ts";
import { test_game } from "./helpers.ts";
const SEED = "bench-seed";
const { game } = await test_game("mods", undefined, SEED);
const { block_ids, worldgen, default_values } = game.world;
Deno.bench("generate 1 chunk", () => {
for (let i = 0; i < 1; i++) {
generate_raw_chunk(i * 37 - 300, i * 23 - 180, SEED, block_ids, worldgen, default_values);
}
});
Deno.bench("generate 4 chunks", () => {
for (let i = 0; i < 4; i++) {
generate_raw_chunk(i * 37 - 300, i * 23 - 180, SEED, block_ids, worldgen, default_values);
}
});
// the same 16 chunks every time, from ocean to mountains, so runs can be compared. a sixteenth of it is a chunk
Deno.bench("generate 16 chunks", () => {
for (let i = 0; i < 16; i++) {
generate_raw_chunk(i * 37 - 300, i * 23 - 180, SEED, block_ids, worldgen, default_values);
}
});