Turn placed BSV blocks into a contiguous, deterministic 2-D biome map β the same world for every player, with no map server.
import { spiralCells, makeGrid } from "@metanet-games/chainscape";
// cells: [{ height, hash }, β¦] β a window of BSV blocks
const pos = spiralCells(cells.length); // Ulam-spiral placement
const cellMap = new Map(cells.map((c, i) =>
[pos[i][0] + "," + pos[i][1], { ...c, gx: pos[i][0], gy: pos[i][1] }]));
const gridFor = makeGrid(cellMap, new Map());
const biomes = gridFor(cells[0]); // NΓN grid of biome indices
Feed it a window of blocks and it paints a seamless world that's identical for everyone. Appending a new block never rewrites terrain already placed, so the map just grows outward as the chain does. You decide what each biome index means β walkable, minable, a spawn point.
Part of chainkit β verifiable building blocks for BSV games. Verify don't trust.
π§© github.com/metanet-games/chainkit Β· πΉοΈ the games Β· metanet.games