Buildings (modern/fantasy, multi-floor, footprint shapes), caves, outdoor biomes, and town/village + city-block settlements. Auto-places Foundry walls, doors, windows, lighting; furniture as locked tiles; live preview. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
1.2 KiB
JavaScript
25 lines
1.2 KiB
JavaScript
/** Dev harness for the outdoor engine. node dev/render-outdoor-sample.mjs */
|
|
import { writeFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { dirname, join } from "node:path";
|
|
|
|
import { generateOutdoor } from "../module/lib/outdoor.mjs";
|
|
import { renderOutdoorSVG } from "../module/lib/render-outdoor.mjs";
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
|
|
const SAMPLES = [
|
|
{ name: "out-grass", biome: "grassland", cols: 28, rows: 20, seed: "meadow-5" },
|
|
{ name: "out-desert", biome: "desert", cols: 28, rows: 20, seed: "dune-3" },
|
|
{ name: "out-snow", biome: "snow", cols: 26, rows: 20, seed: "frost-8" },
|
|
{ name: "out-badlands", biome: "badlands", cols: 30, rows: 20, seed: "mesa-2" }
|
|
];
|
|
|
|
for (const cfg of SAMPLES) {
|
|
const model = generateOutdoor({ cols: cfg.cols, rows: cfg.rows, biome: cfg.biome, seed: cfg.seed });
|
|
const svg = renderOutdoorSVG({ model, gridSize: 70, seed: cfg.seed });
|
|
console.log(`${cfg.name.padEnd(14)} trees:${model.trees.length} rocks:${model.rocks.length} water:${model.water ? "y" : "n"} segs:${model.segments.length}`);
|
|
writeFileSync(join(here, `${cfg.name}.svg`), svg);
|
|
}
|
|
console.log("\nWrote outdoor samples to", here);
|