Mapwright v0.5.0 — procedural battle map generator for Foundry VTT
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>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/** Dev harness for the settlement engine. node dev/render-settlement-sample.mjs */
|
||||
import { writeFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname, join } from "node:path";
|
||||
|
||||
import { generateSettlement } from "../module/lib/settlement.mjs";
|
||||
import { renderSettlementSVG } from "../module/lib/render-settlement.mjs";
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const SAMPLES = [
|
||||
{ name: "city-block", style: "city", cols: 34, rows: 24, seed: "downtown-5" },
|
||||
{ name: "village", style: "village", cols: 34, rows: 24, seed: "hamlet-3" }
|
||||
];
|
||||
|
||||
for (const cfg of SAMPLES) {
|
||||
const model = generateSettlement({ cols: cfg.cols, rows: cfg.rows, style: cfg.style, seed: cfg.seed });
|
||||
const svg = renderSettlementSVG({ model, gridSize: 70, seed: cfg.seed });
|
||||
console.log(`${cfg.name.padEnd(12)} buildings:${model.buildings.length} walls:${model.segments.length} trees:${model.trees.length} plots:${model.plots.length}`);
|
||||
writeFileSync(join(here, `${cfg.name}.svg`), svg);
|
||||
}
|
||||
console.log("\nWrote settlement samples to", here);
|
||||
Reference in New Issue
Block a user