Workers for chunk generation !

This commit is contained in:
2026-10-11 01:15:14 -03:00
parent 3d2b235f64
commit cd3b39c3d7
24 changed files with 1119 additions and 91 deletions
+12
View File
@@ -3,6 +3,7 @@
import { register_mod_data } from "$/common/mod_loader.ts";
import type { ModData, ModListing } from "$/common/mod_loader.ts";
import { load_worldgen } from "$/common/worldgen_loader.ts";
import { worldgen_bundle } from "$/common/worldgen_bundle.ts";
import { GameHost, GameServer } from "./game_server.ts";
import type { WorldSave } from "./saves.ts";
import { ModRuntime } from "./mod_runtime.ts";
@@ -73,6 +74,17 @@ export async function start_game(
mods.flatMap((mod) => mod.server_url ? [{ ...script_of(mod), url: mod.server_url }] : []),
);
runtime.finish_setup();
// what a worldgen worker needs to generate the same chunks, see worldgen_pool.ts
game.worldgen_bundle = worldgen_bundle(
game.world.seed,
GENERATOR,
mods.map((mod) => ({
id: mod.listing.id,
data: mod.data,
worldgen_url: mod.worldgen_url,
engine_access: mod.listing.engine_access,
})),
);
runtime.after.server_start.emit({});
return game;