← all modules
@metanet-games/

chainscape

πŸ—ΊοΈ
live on npm needs chainseed npm β†— source β†— Apache-2.0

Turn placed BSV blocks into a contiguous, deterministic 2-D biome map β€” the same world for every player, with no map server.

Install

$ npm i @metanet-games/chainscape

Example

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

Plug it into your game

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