2026-10-28 18:54:20 +00:00
|
|
|
|
// Low-poly building models for the diorama, one per type and level tier. Each fits in
|
|
|
|
|
|
// the square [-s, s] around its own origin and returns its faces and roof height.
|
2026-10-28 21:26:50 +00:00
|
|
|
|
// Original shapes in the genre's style, solid from level 1: timber first, then bigger,
|
|
|
|
|
|
// stone at high levels.
|
2026-10-28 18:54:20 +00:00
|
|
|
|
|
|
|
|
|
|
import type { BuildingType } from '~/types/game'
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
import { box, cylinder, DOOR, type Face, framing, gable, gambrel, hash, house, log, mix, mudline, ngon, openings, orient, plane, plinthOf, prism, pyramid, rect, scale, shift, slab, trim, turn, type V2, type V3, wallPanel } from './iso'
|
2026-10-28 18:54:20 +00:00
|
|
|
|
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Hard times: weathered, dirty, cold colours, all flat; faces get their light from iso.ts
|
|
|
|
|
|
* shading only. Wood is grey with age, straw is old, cloth is undyed or faded, and the
|
|
|
|
|
|
* only warm colours are fire and blood.
|
|
|
|
|
|
*/
|
2026-10-28 18:54:20 +00:00
|
|
|
|
export const C = {
|
2026-10-30 09:35:47 +00:00
|
|
|
|
wood: '#7a6249',
|
|
|
|
|
|
woodDark: '#574536',
|
|
|
|
|
|
plank: '#8f7a5d',
|
|
|
|
|
|
thatch: '#948258',
|
|
|
|
|
|
canvas: '#ada38c',
|
|
|
|
|
|
canvasDark: '#8f8572',
|
|
|
|
|
|
roofRed: '#764535',
|
|
|
|
|
|
slate: '#545a61',
|
|
|
|
|
|
stone: '#928d84',
|
|
|
|
|
|
stoneDark: '#74716a',
|
|
|
|
|
|
field: '#626b45',
|
|
|
|
|
|
wheat: '#958653',
|
|
|
|
|
|
furrow: '#5c4d3b',
|
|
|
|
|
|
soil: '#5e4b39',
|
|
|
|
|
|
leaf: '#4d5a37',
|
|
|
|
|
|
leafDark: '#404b2e',
|
|
|
|
|
|
trunk: '#4a3b2e',
|
|
|
|
|
|
clay: '#94603f',
|
|
|
|
|
|
clayDark: '#734a33',
|
|
|
|
|
|
clayWet: '#66432f',
|
|
|
|
|
|
rock: '#75716a',
|
|
|
|
|
|
ore: '#4c535a',
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
fire: '#c96f26',
|
2026-10-30 09:35:47 +00:00
|
|
|
|
banner: '#6e1d16',
|
|
|
|
|
|
hay: '#a08d5a',
|
|
|
|
|
|
cloth: '#62544a',
|
|
|
|
|
|
skin: '#be9d82',
|
|
|
|
|
|
dark: '#241f1b',
|
|
|
|
|
|
grass: '#6a7049',
|
|
|
|
|
|
conifer: '#33432d',
|
|
|
|
|
|
coniferDark: '#2b3a27',
|
|
|
|
|
|
broadleaf: '#525c38',
|
|
|
|
|
|
broadleafDark: '#465030',
|
|
|
|
|
|
bush: '#4d5636',
|
|
|
|
|
|
barn: '#6e3d2e',
|
|
|
|
|
|
shingle: '#5f4c3c',
|
|
|
|
|
|
metal: '#868b8e',
|
|
|
|
|
|
water: '#4a5b5d',
|
|
|
|
|
|
chestnut: '#6f4429',
|
|
|
|
|
|
bay: '#4c3524',
|
|
|
|
|
|
grey: '#958f85',
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
/** Dried blood on the ground, and fresh. */
|
2026-10-30 09:35:47 +00:00
|
|
|
|
blood: '#5a1812',
|
|
|
|
|
|
bloodFresh: '#7a1e14',
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
/** Burnt timber and the ash round it. */
|
2026-10-30 09:35:47 +00:00
|
|
|
|
char: '#2a2521',
|
|
|
|
|
|
ash: '#5f5a53',
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
/** Bare dead wood and the pale cut of a stump. */
|
2026-10-30 09:35:47 +00:00
|
|
|
|
deadWood: '#655a4e',
|
|
|
|
|
|
cut: '#a8977a',
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
crow: '#121212',
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
/** What villagers wear: undyed linen, brown and grey wool, faded red and green. Soldiers in dark wool. */
|
2026-10-30 09:35:47 +00:00
|
|
|
|
export const SHIRTS = ['#73604c', '#7a4436', '#5d6247', '#8a826f', '#5a5d60']
|
|
|
|
|
|
export const UNIFORM = '#4e3f33'
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
/** Smoke from hearths, forges and smouldering ruins: sooty, not white. */
|
2026-10-30 09:35:47 +00:00
|
|
|
|
export const SMOKE = { fill: '#77736d', edge: '#625e59' }
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
|
2026-10-28 18:54:20 +00:00
|
|
|
|
export interface Model {
|
|
|
|
|
|
faces: Face[]
|
|
|
|
|
|
/** Highest point, for the level badge. */
|
|
|
|
|
|
height: number
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-28 21:26:50 +00:00
|
|
|
|
/** 1 for levels 1–4, 2 for 5–14, 3 from 15 on. */
|
|
|
|
|
|
export const tier = (level: number) => (level < 5 ? 1 : level < 15 ? 2 : 3)
|
2026-10-28 18:54:20 +00:00
|
|
|
|
|
|
|
|
|
|
// Small props
|
|
|
|
|
|
|
|
|
|
|
|
function post(x: number, y: number, h: number, r: number, color = C.woodDark): Face[] {
|
|
|
|
|
|
return prism(rect(x, y, r * 2, r * 2), 0, h, color)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function banner(x: number, y: number, h: number, size: number, color = C.banner): Face[] {
|
|
|
|
|
|
return [
|
|
|
|
|
|
...post(x, y, h, size * 0.035),
|
|
|
|
|
|
plane(
|
|
|
|
|
|
[
|
|
|
|
|
|
[x, y, h],
|
|
|
|
|
|
[x - size * 0.05, y + size * 0.75, h - size * 0.1],
|
|
|
|
|
|
[x - size * 0.05, y + size * 0.75, h - size * 0.5],
|
|
|
|
|
|
[x, y, h - size * 0.42],
|
|
|
|
|
|
],
|
|
|
|
|
|
color,
|
|
|
|
|
|
),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function crate(x: number, y: number, z: number, a: number): Face[] {
|
|
|
|
|
|
return box(x, y, a, a, z, a, C.plank, C.wood)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function tree(x: number, y: number, size: number, seed = 0): Face[] {
|
|
|
|
|
|
const leaf = hash(seed, 3) > 0.5 ? C.leaf : C.leafDark
|
|
|
|
|
|
const rot = hash(seed, 7) * Math.PI
|
|
|
|
|
|
return [
|
|
|
|
|
|
...prism(ngon(x, y, size * 0.09, 5, rot), 0, size * 0.32, C.trunk),
|
|
|
|
|
|
...pyramid(ngon(x, y, size * 0.48, 6, rot), size * 0.25, size * 0.75, leaf),
|
|
|
|
|
|
...pyramid(ngon(x, y, size * 0.34, 6, rot + 0.4), size * 0.68, size * 0.62, leaf),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
/** A broken rock: a crooked main peak and a lower shoulder split off beside it. */
|
2026-10-28 19:33:13 +00:00
|
|
|
|
export function rock(x: number, y: number, size: number, seed = 0, color = C.rock): Face[] {
|
2026-10-28 18:54:20 +00:00
|
|
|
|
const base = ngon(x, y, size * 0.5, 5, hash(seed, 1) * 6).map(([px, py], i): V2 => {
|
|
|
|
|
|
const k = 0.75 + 0.45 * hash(seed, i)
|
|
|
|
|
|
return [x + (px - x) * k, y + (py - y) * k]
|
|
|
|
|
|
})
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
const a = hash(seed, 10) * Math.PI * 2
|
|
|
|
|
|
const [sx, sy] = [x + Math.cos(a) * size * 0.3, y + Math.sin(a) * size * 0.3]
|
|
|
|
|
|
return [
|
|
|
|
|
|
...pyramid(base, 0, size * (0.45 + 0.3 * hash(seed, 9)), color, [x + size * (0.04 + 0.12 * hash(seed, 11)), y - size * (0.02 + 0.1 * hash(seed, 12))]),
|
|
|
|
|
|
...pyramid(ngon(sx, sy, size * 0.3, 5, a), 0, size * (0.22 + 0.12 * hash(seed, 13)), scale(color, 0.85), [sx + size * 0.05, sy + size * 0.03]),
|
|
|
|
|
|
]
|
2026-10-28 19:33:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Landscape: lighter trees for the forest around the village (few faces each).
|
|
|
|
|
|
|
2026-10-29 14:27:40 +00:00
|
|
|
|
/** A fir: two faceted tiers on a short trunk, the upper one a shade lighter. */
|
2026-10-28 19:33:13 +00:00
|
|
|
|
export function conifer(x: number, y: number, size: number, seed = 0): Face[] {
|
|
|
|
|
|
const rot = hash(seed, 7) * Math.PI
|
|
|
|
|
|
const color = hash(seed, 3) > 0.5 ? C.conifer : C.coniferDark
|
|
|
|
|
|
return [
|
|
|
|
|
|
...prism(ngon(x, y, size * 0.07, 4, rot), 0, size * 0.25, C.trunk),
|
2026-10-29 14:27:40 +00:00
|
|
|
|
...pyramid(ngon(x, y, size * 0.38, 5, rot), size * 0.18, size * 0.7, color),
|
|
|
|
|
|
...pyramid(ngon(x, y, size * 0.27, 5, rot + 0.6), size * 0.55, size * 0.68, scale(color, 1.1)),
|
2026-10-28 19:33:13 +00:00
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A deciduous tree: a faceted crown (two pyramids back to back) on a trunk. */
|
|
|
|
|
|
export function broadleaf(x: number, y: number, size: number, seed = 0): Face[] {
|
|
|
|
|
|
const rot = hash(seed, 5) * Math.PI
|
|
|
|
|
|
const color = hash(seed, 4) > 0.5 ? C.broadleaf : C.broadleafDark
|
|
|
|
|
|
const ring = ngon(x, y, size * 0.4, 5, rot)
|
|
|
|
|
|
const mid = size * 0.62
|
|
|
|
|
|
// Downward cone under the crown, flipped so its faces point outwards.
|
|
|
|
|
|
const bottom = pyramid(ring, mid, -size * 0.3, color).map((f) => ({ ...f, pts: orient(f.pts, [x, y, mid]) }))
|
|
|
|
|
|
return [
|
|
|
|
|
|
...prism(ngon(x, y, size * 0.07, 4, rot), 0, size * 0.36, C.trunk),
|
|
|
|
|
|
...bottom,
|
|
|
|
|
|
...pyramid(ring, mid, size * 0.42, color),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function bush(x: number, y: number, size: number, seed = 0): Face[] {
|
|
|
|
|
|
return pyramid(ngon(x, y, size * 0.4, 5, hash(seed, 2) * 6), 0, size * 0.35, C.bush)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
// Hard times: what the forest, the war and the winters leave behind.
|
|
|
|
|
|
|
|
|
|
|
|
/** An irregular flat patch on the ground: a stain, a puddle, a heap of ash. */
|
|
|
|
|
|
export function blot(cx: number, cy: number, r: number, n: number, seed: number, z: number, color: string): Face {
|
|
|
|
|
|
const pts = ngon(cx, cy, r, n, hash(seed, 1) * 6).map(([x, y], i): V3 => {
|
|
|
|
|
|
const k = 0.6 + 0.55 * hash(seed, i, 2)
|
|
|
|
|
|
return [cx + (x - cx) * k, cy + (y - cy) * k, z]
|
|
|
|
|
|
})
|
|
|
|
|
|
// Under everything else of its object, layered by height: ash, then char, then blood.
|
|
|
|
|
|
return { ...plane(pts, color), depth: -1e5 + z }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Blood soaked into the ground: a dark pool, a fresher heart and a few drops round it. */
|
|
|
|
|
|
export function blood(x: number, y: number, r: number, seed = 0): Face[] {
|
|
|
|
|
|
const faces = [blot(x, y, r, 9, seed, 0.7, C.blood), blot(x + r * 0.1, y - r * 0.05, r * 0.45, 7, seed + 1, 0.75, C.bloodFresh)]
|
|
|
|
|
|
for (let i = 0; i < 4; i++) {
|
|
|
|
|
|
const a = hash(seed, i, 3) * Math.PI * 2
|
|
|
|
|
|
const d = r * (1.2 + 0.6 * hash(seed, i, 4))
|
|
|
|
|
|
faces.push(blot(x + Math.cos(a) * d, y + Math.sin(a) * d, r * (0.12 + 0.1 * hash(seed, i, 5)), 5, seed + 10 + i, 0.7, C.blood))
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** What is left of a felled tree: a low stump with its pale cut. */
|
|
|
|
|
|
export function stump(x: number, y: number, size: number, seed = 0): Face[] {
|
|
|
|
|
|
const r = size * (0.07 + 0.04 * hash(seed, 1))
|
|
|
|
|
|
return prism(ngon(x, y, r, 6, hash(seed, 2) * 6), 0, size * (0.08 + 0.08 * hash(seed, 3)), C.trunk, C.cut)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A dead tree: a bare grey trunk, broken at the top, with two or three crooked branches. */
|
|
|
|
|
|
export function deadTree(x: number, y: number, size: number, seed = 0): Face[] {
|
|
|
|
|
|
const h = size * (0.75 + 0.3 * hash(seed, 1))
|
|
|
|
|
|
const r = size * 0.06
|
|
|
|
|
|
const faces: Face[] = [...prism(ngon(x, y, r, 5, hash(seed, 2) * 6), 0, h * 0.8, C.deadWood), ...pyramid(ngon(x, y, r, 5, hash(seed, 2) * 6), h * 0.8, h * 0.2, C.deadWood)]
|
|
|
|
|
|
const n = 2 + Math.floor(hash(seed, 3) * 2)
|
|
|
|
|
|
for (let i = 0; i < n; i++) {
|
|
|
|
|
|
const a = hash(seed, i, 4) * Math.PI * 2
|
|
|
|
|
|
const z = h * (0.4 + 0.35 * (i / n))
|
|
|
|
|
|
const len = size * (0.25 + 0.15 * hash(seed, i, 5))
|
|
|
|
|
|
const t = r * 0.5
|
|
|
|
|
|
const [ex, ey] = [x + Math.cos(a) * len, y + Math.sin(a) * len]
|
|
|
|
|
|
faces.push(
|
|
|
|
|
|
...slab(
|
|
|
|
|
|
[[x - t, y - t, z], [x + t, y - t, z], [x + t, y + t, z], [x - t, y + t, z]],
|
|
|
|
|
|
[[ex - t * 0.5, ey - t * 0.5, z + len * 0.8], [ex + t * 0.5, ey - t * 0.5, z + len * 0.8], [ex + t * 0.5, ey + t * 0.5, z + len * 0.8], [ex - t * 0.5, ey + t * 0.5, z + len * 0.8]],
|
|
|
|
|
|
C.deadWood,
|
|
|
|
|
|
),
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A crow sitting, beak towards +x before `quarters` turns, its feet at z. */
|
|
|
|
|
|
export function perchedCrow(x: number, y: number, z: number, k: number, quarters = 0): Face[] {
|
|
|
|
|
|
const faces: Face[] = [
|
|
|
|
|
|
...slab(
|
|
|
|
|
|
[[-1.2 * k, -0.4 * k, 0.3 * k], [0.6 * k, -0.45 * k, 0.4 * k], [0.6 * k, 0.45 * k, 0.4 * k], [-1.2 * k, 0.4 * k, 0.3 * k]],
|
|
|
|
|
|
[[-1.4 * k, -0.3 * k, 1.1 * k], [0.7 * k, -0.4 * k, 1.5 * k], [0.7 * k, 0.4 * k, 1.5 * k], [-1.4 * k, 0.3 * k, 1.1 * k]],
|
|
|
|
|
|
C.crow,
|
|
|
|
|
|
),
|
|
|
|
|
|
...box(0.8 * k, 0, 0.7 * k, 0.6 * k, 1.3 * k, 0.6 * k, C.crow),
|
|
|
|
|
|
...box(1.35 * k, 0, 0.5 * k, 0.16 * k, 1.5 * k, 0.12 * k, '#2a2622'),
|
|
|
|
|
|
]
|
|
|
|
|
|
return shift(turn(faces, quarters), x, y, z)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* A grave: a long mound of earth with a wooden cross at its head, the cross leaning a
|
|
|
|
|
|
* little on old graves; a few have a rough headstone. A fresh one lies open, its earth
|
|
|
|
|
|
* heaped beside it and a shovel stuck in.
|
|
|
|
|
|
*/
|
|
|
|
|
|
export function grave(x: number, y: number, s: number, seed = 0, fresh = false): Face[] {
|
|
|
|
|
|
const len = s * 0.62
|
|
|
|
|
|
const wid = s * 0.28
|
|
|
|
|
|
if (fresh) {
|
|
|
|
|
|
return [
|
|
|
|
|
|
plane(rect(x, y, len, wid).map(([px, py]): V3 => [px, py, 0.8]), C.dark),
|
|
|
|
|
|
...slab(
|
|
|
|
|
|
rect(x, y + wid * 1.05, len * 1.05, wid * 0.9).map(([px, py]): V3 => [px, py, 0]),
|
|
|
|
|
|
rect(x, y + wid * 1.05, len * 0.7, wid * 0.4).map(([px, py]): V3 => [px, py, s * 0.16]),
|
|
|
|
|
|
C.soil,
|
|
|
|
|
|
),
|
|
|
|
|
|
...shift(slab(rect(0, 0, s * 0.03, s * 0.03).map(([px, py]): V3 => [px, py, 0]), rect(s * 0.08, 0, s * 0.03, s * 0.03).map(([px, py]): V3 => [px, py, s * 0.5]), C.woodDark), x + len * 0.3, y + wid * 1.05, s * 0.1),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
const mound = slab(
|
|
|
|
|
|
rect(x, y, len, wid).map(([px, py]): V3 => [px, py, 0]),
|
|
|
|
|
|
rect(x, y, len * 0.8, wid * 0.55).map(([px, py]): V3 => [px, py, s * 0.08]),
|
|
|
|
|
|
hash(seed, 1) > 0.5 ? C.soil : mix(C.soil, C.grass, 0.5),
|
|
|
|
|
|
)
|
|
|
|
|
|
const hx = x - len / 2 - s * 0.04
|
|
|
|
|
|
if (hash(seed, 2) < 0.25) return [...mound, ...box(hx, y, s * 0.07, wid * 0.8, 0, s * 0.3, C.stoneDark, C.stone)]
|
|
|
|
|
|
const lean = (hash(seed, 3) - 0.5) * s * 0.12
|
|
|
|
|
|
const h = s * (0.42 + 0.1 * hash(seed, 4))
|
|
|
|
|
|
const t = s * 0.035
|
|
|
|
|
|
return [
|
|
|
|
|
|
...mound,
|
|
|
|
|
|
...slab(rect(hx, y, t, t).map(([px, py]): V3 => [px, py, 0]), rect(hx, y + lean, t, t).map(([px, py]): V3 => [px, py, h]), C.deadWood),
|
|
|
|
|
|
...box(hx, y + lean * 0.75, t, s * 0.26, h * 0.68, t, C.deadWood),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** The gallows by the road: a platform, two posts and a beam, a noose, crows on the beam. */
|
|
|
|
|
|
export function gallows(x: number, y: number, s: number, seed = 0): Face[] {
|
|
|
|
|
|
const a = s * 0.5
|
|
|
|
|
|
const h = s * 1.45
|
|
|
|
|
|
const t = s * 0.06
|
|
|
|
|
|
return [
|
|
|
|
|
|
...box(x, y, s * 1.2, s * 0.8, 0, s * 0.22, C.plank, C.wood),
|
|
|
|
|
|
...prism(rect(x, y - a, t * 2, t * 2), 0, h, C.woodDark),
|
|
|
|
|
|
...prism(rect(x, y + a, t * 2, t * 2), 0, h, C.woodDark),
|
|
|
|
|
|
...box(x, y, t * 2.2, a * 2 + t * 4, h, t * 2, C.woodDark),
|
|
|
|
|
|
...box(x, y + a * 0.2, s * 0.015, s * 0.015, h - s * 0.45, s * 0.45, C.cut),
|
|
|
|
|
|
...box(x, y + a * 0.2, s * 0.08, s * 0.08, h - s * 0.55, s * 0.1, C.cut),
|
|
|
|
|
|
...perchedCrow(x, y - a * 0.6, h + t * 2, s * 0.06, hash(seed, 1) > 0.5 ? 1 : 3),
|
|
|
|
|
|
...perchedCrow(x, y + a * 0.75, h + t * 2, s * 0.055, 0),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* A farmstead burnt to the ground: soot-black stumps of the corner posts, a beam fallen
|
|
|
|
|
|
* across, a piece of the roof on the ground, rubble of the chimney, all in a ring of ash.
|
|
|
|
|
|
*/
|
|
|
|
|
|
export function ruin(x: number, y: number, s: number, seed = 0): Face[] {
|
|
|
|
|
|
const w = s * 1.3
|
|
|
|
|
|
const d = s * 0.9
|
|
|
|
|
|
const p = s * 0.12
|
|
|
|
|
|
const posts = [
|
|
|
|
|
|
[-1, -1, 0.95],
|
|
|
|
|
|
[1, -1, 0.4],
|
|
|
|
|
|
[1, 1, 0.65],
|
|
|
|
|
|
[-1, 1, 0.25],
|
|
|
|
|
|
[0, -1, 0.7],
|
|
|
|
|
|
] as const
|
|
|
|
|
|
return [
|
|
|
|
|
|
blot(x, y, s * 1.25, 11, seed, 0.6, C.ash),
|
|
|
|
|
|
blot(x + s * 0.1, y, s * 0.8, 9, seed + 1, 0.7, C.char),
|
|
|
|
|
|
...box(x, y, w + p, d + p, 0, p, C.stoneDark, mix(C.stoneDark, C.char, 0.5)),
|
|
|
|
|
|
...posts.flatMap(([fx, fy, k]) => box(x + (fx * w) / 2, y + (fy * d) / 2, s * 0.09, s * 0.09, p, s * 0.75 * k, C.char)),
|
|
|
|
|
|
...slab(
|
|
|
|
|
|
rect(x + w * 0.5, y + d * 0.5, s * 0.08, s * 0.08).map(([px, py]): V3 => [px, py, s * 0.55]),
|
|
|
|
|
|
rect(x - w * 0.2, y + d * 0.65, s * 0.08, s * 0.08).map(([px, py]): V3 => [px, py, p]),
|
|
|
|
|
|
C.char,
|
|
|
|
|
|
),
|
|
|
|
|
|
plane([[x - w * 0.45, y - d * 0.1, p + 1], [x + w * 0.1, y - d * 0.35, p + 1], [x + w * 0.2, y + d * 0.1, s * 0.3], [x - w * 0.35, y + d * 0.3, s * 0.3]], mix(C.thatch, C.char, 0.7)),
|
|
|
|
|
|
...box(x - w * 0.42, y - d * 0.42, s * 0.25, s * 0.25, p, s * 0.5, C.stoneDark),
|
|
|
|
|
|
...pyramid(ngon(x - w * 0.15, y - d * 0.55, s * 0.18, 5, 1), 0, s * 0.14, C.stoneDark),
|
|
|
|
|
|
...pyramid(ngon(x - w * 0.6, y - d * 0.1, s * 0.14, 5, 2), 0, s * 0.1, C.stone),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-28 19:33:13 +00:00
|
|
|
|
/** The village well on the plaza. */
|
|
|
|
|
|
export function well(s: number): Model {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...prism(ngon(0, 0, s * 0.42, 8), 0, s * 0.32, C.stone, C.dark),
|
|
|
|
|
|
...post(-s * 0.36, 0, s * 0.85, s * 0.05),
|
|
|
|
|
|
...post(s * 0.36, 0, s * 0.85, s * 0.05),
|
|
|
|
|
|
...house(0, 0, s * 0.95, s * 0.55, s * 0.85, s * 0.3, C.woodDark, C.roofRed, 'x').slice(5),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.2,
|
|
|
|
|
|
}
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-29 14:27:40 +00:00
|
|
|
|
/** A villager: legs, a shirt and a head with hair, a few shaded faces. */
|
2026-10-28 18:54:20 +00:00
|
|
|
|
function person(x: number, y: number, s: number, shirt = C.cloth): Face[] {
|
2026-10-29 14:27:40 +00:00
|
|
|
|
const r = s * 0.055
|
|
|
|
|
|
return [
|
|
|
|
|
|
...prism(ngon(x, y, r * 0.8, 4, 0.4), 0, s * 0.09, C.dark),
|
|
|
|
|
|
...prism(ngon(x, y, r, 5), s * 0.09, s * 0.12, shirt),
|
|
|
|
|
|
...box(x, y, r * 1.2, r * 1.2, s * 0.21, r * 1.2, C.skin),
|
|
|
|
|
|
...box(x, y, r * 1.3, r * 1.3, s * 0.21 + r * 1.1, r * 0.35, C.woodDark),
|
|
|
|
|
|
]
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function field(x: number, y: number, w: number, d: number, color: string, rows: number): Face[] {
|
|
|
|
|
|
const faces: Face[] = [plane(rect(x, y, w, d).map(([px, py]) => [px, py, 0.6]), color)]
|
|
|
|
|
|
for (let i = 1; i < rows; i++) {
|
|
|
|
|
|
const fx = x - w / 2 + (w * i) / rows
|
|
|
|
|
|
faces.push(plane([[fx - 0.5, y - d / 2 + 1, 0.8], [fx + 0.5, y - d / 2 + 1, 0.8], [fx + 0.5, y + d / 2 - 1, 0.8], [fx - 0.5, y + d / 2 - 1, 0.8]], C.furrow))
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function logPile(x: number, y: number, s: number, rows = 2): Face[] {
|
|
|
|
|
|
const r = s * 0.09
|
|
|
|
|
|
const faces: Face[] = []
|
|
|
|
|
|
for (let row = 0; row < rows; row++) {
|
|
|
|
|
|
const n = 3 - row
|
|
|
|
|
|
for (let i = 0; i < n; i++) faces.push(...log(x, y - (n - 1) * r + i * r * 2, row * r * 1.7, s * 0.7, r, C.wood, C.plank))
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function bricks(x: number, y: number, s: number, layers: number): Face[] {
|
|
|
|
|
|
const faces: Face[] = []
|
|
|
|
|
|
for (let i = 0; i < layers; i++) faces.push(...box(x, y, s * 0.3, s * 0.2, i * s * 0.08, s * 0.08, i % 2 ? C.clayDark : C.clay))
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fire(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
const faces: Face[] = []
|
|
|
|
|
|
for (const [px, py] of ngon(x, y, s * 0.12, 6)) faces.push(...box(px, py, s * 0.05, s * 0.05, 0, s * 0.04, C.rock))
|
|
|
|
|
|
faces.push(...pyramid(ngon(x, y, s * 0.07, 4), 0, s * 0.2, C.fire).map((f) => ({ ...f, flat: true })))
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function kiln(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
return [
|
|
|
|
|
|
...prism(ngon(x, y, s * 0.32, 7), 0, s * 0.4, C.clay, C.clayDark),
|
|
|
|
|
|
...pyramid(ngon(x, y, s * 0.32, 7), s * 0.4, s * 0.28, C.clayDark),
|
|
|
|
|
|
...box(x + s * 0.05, y - s * 0.05, s * 0.1, s * 0.1, s * 0.5, s * 0.35, C.stoneDark),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function headframe(x: number, y: number, s: number, h: number): Face[] {
|
|
|
|
|
|
const a = s * 0.28
|
|
|
|
|
|
return [
|
|
|
|
|
|
...post(x - a, y - a, h, s * 0.04),
|
|
|
|
|
|
...post(x + a, y - a, h, s * 0.04),
|
|
|
|
|
|
...post(x - a, y + a, h, s * 0.04),
|
|
|
|
|
|
...post(x + a, y + a, h, s * 0.04),
|
|
|
|
|
|
...box(x, y, a * 2.3, a * 2.3, h, s * 0.06, C.wood),
|
|
|
|
|
|
...pyramid(rect(x, y, a * 2.3, a * 2.3), h + s * 0.06, s * 0.25, C.woodDark),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-29 15:34:42 +00:00
|
|
|
|
// Props that say what a building is for: horses, wheels and siege engines, weapons, stores.
|
|
|
|
|
|
|
|
|
|
|
|
/** A round on a wall facing +x or +y, seen flat: a shield, a target's rings. */
|
|
|
|
|
|
function wallDisc(face: 'x' | 'y', at: number, along: number, zc: number, r: number, depth: number, color: string, n = 8): Face {
|
|
|
|
|
|
const pts = ngon(along, zc, r, n, Math.PI / n).map(([a, z]): V3 => (face === 'x' ? [at, a, z] : [a, at, z]))
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
return { pts, color, twoSided: true, depth }
|
2026-10-29 15:34:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-29 15:42:54 +00:00
|
|
|
|
/** Faces that must draw over a wall: sorted from `depth` on, in their own front-to-back order. */
|
|
|
|
|
|
function over(faces: Face[], depth: number): Face[] {
|
|
|
|
|
|
const own = faces.map((f) => f.pts.reduce((n, [x, y, z]) => n + x + y + z, 0) / f.pts.length)
|
|
|
|
|
|
const low = Math.min(...own)
|
|
|
|
|
|
return faces.map((f, i) => ({ ...f, depth: depth + own[i]! - low }))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-29 15:34:42 +00:00
|
|
|
|
/** A beam lying on the ground between two points, or raised to z: a fence rail, a timber. */
|
|
|
|
|
|
function beam([ax, ay]: V2, [bx, by]: V2, z: number, t: number, h: number, color: string): Face[] {
|
|
|
|
|
|
const len = Math.hypot(bx - ax, by - ay) || 1
|
|
|
|
|
|
const nx = (-(by - ay) / len) * (t / 2)
|
|
|
|
|
|
const ny = ((bx - ax) / len) * (t / 2)
|
|
|
|
|
|
const base: V2[] = [
|
|
|
|
|
|
[ax - nx, ay - ny],
|
|
|
|
|
|
[bx - nx, by - ny],
|
|
|
|
|
|
[bx + nx, by + ny],
|
|
|
|
|
|
[ax + nx, ay + ny],
|
|
|
|
|
|
]
|
|
|
|
|
|
const ccw = (base[1]![0] - base[0]![0]) * (base[2]![1] - base[0]![1]) - (base[1]![1] - base[0]![1]) * (base[2]![0] - base[0]![0]) > 0
|
|
|
|
|
|
return prism(ccw ? base : [...base].reverse(), z, h, color)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A rail fence along the points: a post at each, two rails between. */
|
|
|
|
|
|
function fence(pts: V2[], h: number, t: number): Face[] {
|
|
|
|
|
|
const faces: Face[] = pts.flatMap(([x, y]) => post(x, y, h, t))
|
|
|
|
|
|
for (let i = 0; i < pts.length - 1; i++) {
|
|
|
|
|
|
faces.push(...beam(pts[i]!, pts[i + 1]!, h * 0.45, t * 0.8, t * 0.8, C.wood), ...beam(pts[i]!, pts[i + 1]!, h * 0.85, t * 0.8, t * 0.8, C.wood))
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* A horse standing on four legs, head towards +x before `quarters` turns: body, legs,
|
|
|
|
|
|
* a slanted neck with its mane, the head bent down, a tail. `k` is about a hand's height.
|
|
|
|
|
|
*/
|
|
|
|
|
|
export function horse(x: number, y: number, k: number, quarters: number, color: string): Face[] {
|
|
|
|
|
|
const legs = scale(color, 0.8)
|
|
|
|
|
|
const mane = scale(color, 0.5)
|
|
|
|
|
|
const faces: Face[] = [
|
|
|
|
|
|
...[-1, 1].flatMap((fx) => [-1, 1].flatMap((fy) => box(fx * 1.3 * k, fy * 0.4 * k, 0.32 * k, 0.32 * k, 0, 1.6 * k, legs))),
|
|
|
|
|
|
...box(0, 0, 3.5 * k, 1.15 * k, 1.55 * k, 1.3 * k, color),
|
|
|
|
|
|
...slab(
|
|
|
|
|
|
[[1.15 * k, -0.34 * k, 2.3 * k], [2.05 * k, -0.34 * k, 2.3 * k], [2.05 * k, 0.34 * k, 2.3 * k], [1.15 * k, 0.34 * k, 2.3 * k]],
|
|
|
|
|
|
[[1.85 * k, -0.28 * k, 3.65 * k], [2.45 * k, -0.28 * k, 3.65 * k], [2.45 * k, 0.28 * k, 3.65 * k], [1.85 * k, 0.28 * k, 3.65 * k]],
|
|
|
|
|
|
color,
|
|
|
|
|
|
mane,
|
|
|
|
|
|
),
|
|
|
|
|
|
...slab(
|
|
|
|
|
|
[[2.15 * k, -0.27 * k, 3.0 * k], [3.3 * k, -0.2 * k, 2.55 * k], [3.3 * k, 0.2 * k, 2.55 * k], [2.15 * k, 0.27 * k, 3.0 * k]],
|
|
|
|
|
|
[[2.15 * k, -0.27 * k, 3.75 * k], [3.3 * k, -0.2 * k, 3.05 * k], [3.3 * k, 0.2 * k, 3.05 * k], [2.15 * k, 0.27 * k, 3.75 * k]],
|
|
|
|
|
|
color,
|
|
|
|
|
|
),
|
|
|
|
|
|
...slab(
|
|
|
|
|
|
[[-1.95 * k, -0.12 * k, 1.2 * k], [-1.7 * k, -0.12 * k, 1.2 * k], [-1.7 * k, 0.12 * k, 1.2 * k], [-1.95 * k, 0.12 * k, 1.2 * k]],
|
|
|
|
|
|
[[-1.85 * k, -0.15 * k, 2.75 * k], [-1.6 * k, -0.15 * k, 2.75 * k], [-1.6 * k, 0.15 * k, 2.75 * k], [-1.85 * k, 0.15 * k, 2.75 * k]],
|
|
|
|
|
|
mane,
|
|
|
|
|
|
),
|
|
|
|
|
|
]
|
|
|
|
|
|
return shift(turn(faces, quarters), x, y)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A plank wheel standing upright, axle along x or y. */
|
|
|
|
|
|
function wheel(x: number, y: number, r: number, along: 'x' | 'y'): Face[] {
|
|
|
|
|
|
return [...cylinder(x, y, r, r, r * 0.3, along, C.woodDark, C.plank, 10), ...cylinder(x, y, r, r * 0.25, r * 0.5, along, C.dark, C.metal, 6)]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A battering ram facing +x before `quarters` turns: a pointed log under a plank roof on four wheels. */
|
|
|
|
|
|
function ram(x: number, y: number, k: number, quarters = 0): Face[] {
|
|
|
|
|
|
const faces: Face[] = [
|
|
|
|
|
|
...[-1, 1].flatMap((fx) => [-1, 1].map((fy) => [fx, fy])).flatMap(([fx, fy]) => wheel(fx! * 1.25 * k, fy! * 0.95 * k, 0.6 * k, 'y')),
|
|
|
|
|
|
...box(0, 0, 3.3 * k, 1.5 * k, 0.65 * k, 0.3 * k, C.wood, C.plank),
|
|
|
|
|
|
...[-1, 1].flatMap((fx) => [-1, 1].flatMap((fy) => post(fx * 1.45 * k, fy * 0.6 * k, 2.2 * k, 0.12 * k))),
|
|
|
|
|
|
...log(0.35 * k, -0.3 * k, 1.05 * k, 4.2 * k, 0.32 * k, C.trunk, C.plank),
|
|
|
|
|
|
...pyramid(rect(2.5 * k, 0, 0.5 * k, 0.6 * k), 1.05 * k, 0.6 * k, C.metal),
|
|
|
|
|
|
...gable(-1.75 * k, -0.9 * k, 1.75 * k, 0.9 * k, 2.2 * k, 0.85 * k, 'x', C.plank, C.wood),
|
|
|
|
|
|
]
|
|
|
|
|
|
return shift(turn(faces, quarters), x, y)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-29 15:42:54 +00:00
|
|
|
|
/** A siege engine in the making, facing +x: the frame on its wheels, two posts up. */
|
|
|
|
|
|
function frame(x: number, y: number, k: number): Face[] {
|
|
|
|
|
|
return shift(
|
|
|
|
|
|
[
|
|
|
|
|
|
...[-1, 1].flatMap((fx) => [-1, 1].map((fy) => [fx, fy])).flatMap(([fx, fy]) => wheel(fx! * 1.25 * k, fy! * 0.95 * k, 0.6 * k, 'y')),
|
|
|
|
|
|
...box(0, 0, 3.3 * k, 1.5 * k, 0.65 * k, 0.3 * k, C.plank, C.plank),
|
|
|
|
|
|
...post(-1.45 * k, -0.6 * k, 2.2 * k, 0.12 * k),
|
|
|
|
|
|
...post(1.45 * k, -0.6 * k, 2.2 * k, 0.12 * k),
|
|
|
|
|
|
...box(0, -0.6 * k, 3.1 * k, 0.12 * k, 2.1 * k, 0.12 * k, C.wood),
|
|
|
|
|
|
],
|
|
|
|
|
|
x,
|
|
|
|
|
|
y,
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-29 15:34:42 +00:00
|
|
|
|
/** A catapult facing +x before `quarters` turns: a wheeled frame, two uprights with a crossbar, the arm with its bucket raised. */
|
|
|
|
|
|
function catapult(x: number, y: number, k: number, quarters = 0): Face[] {
|
|
|
|
|
|
const faces: Face[] = [
|
|
|
|
|
|
...[-1, 1].flatMap((fx) => [-1, 1].map((fy) => [fx, fy])).flatMap(([fx, fy]) => wheel(fx! * 1.2 * k, fy! * 0.9 * k, 0.55 * k, 'y')),
|
|
|
|
|
|
...box(0, 0, 3.2 * k, 1.4 * k, 0.6 * k, 0.28 * k, C.wood, C.plank),
|
|
|
|
|
|
...post(0.4 * k, -0.55 * k, 2.4 * k, 0.13 * k),
|
|
|
|
|
|
...post(0.4 * k, 0.55 * k, 2.4 * k, 0.13 * k),
|
|
|
|
|
|
...box(0.4 * k, 0, 0.24 * k, 1.35 * k, 2.15 * k, 0.24 * k, C.woodDark),
|
|
|
|
|
|
...slab(
|
|
|
|
|
|
[[-1.3 * k, -0.13 * k, 0.9 * k], [-1.1 * k, -0.13 * k, 0.9 * k], [-1.1 * k, 0.13 * k, 0.9 * k], [-1.3 * k, 0.13 * k, 0.9 * k]],
|
|
|
|
|
|
[[0.9 * k, -0.11 * k, 2.85 * k], [1.1 * k, -0.11 * k, 2.85 * k], [1.1 * k, 0.11 * k, 2.85 * k], [0.9 * k, 0.11 * k, 2.85 * k]],
|
|
|
|
|
|
C.wood,
|
|
|
|
|
|
),
|
|
|
|
|
|
...box(1.1 * k, 0, 0.55 * k, 0.55 * k, 2.8 * k, 0.3 * k, C.woodDark, C.dark),
|
|
|
|
|
|
]
|
|
|
|
|
|
return shift(turn(faces, quarters), x, y)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A rack of spears with a shield leaning on it, along x or y. */
|
|
|
|
|
|
function weaponRack(x: number, y: number, s: number, along: 'x' | 'y'): Face[] {
|
|
|
|
|
|
const len = s * 0.55
|
|
|
|
|
|
const at = (u: number): V2 => (along === 'x' ? [x + u, y] : [x, y + u])
|
|
|
|
|
|
const faces: Face[] = [...post(...at(-len / 2), s * 0.5, s * 0.03), ...post(...at(len / 2), s * 0.5, s * 0.03)]
|
|
|
|
|
|
faces.push(...(along === 'x' ? box(x, y, len, s * 0.04, s * 0.38, s * 0.04, C.wood) : box(x, y, s * 0.04, len, s * 0.38, s * 0.04, C.wood)))
|
|
|
|
|
|
for (let i = 0; i < 4; i++) {
|
|
|
|
|
|
const [px, py] = at(-len * 0.36 + (i * len * 0.72) / 3)
|
|
|
|
|
|
faces.push(...box(px, py, s * 0.025, s * 0.025, 0, s * 0.72, C.woodDark), ...pyramid(rect(px, py, s * 0.05, s * 0.05), s * 0.72, s * 0.1, C.metal))
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A straw training dummy on a post, arms out. */
|
|
|
|
|
|
function dummy(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
return [
|
|
|
|
|
|
...post(x, y, s * 0.6, s * 0.025),
|
|
|
|
|
|
...box(x, y, s * 0.17, s * 0.13, s * 0.3, s * 0.24, C.hay),
|
|
|
|
|
|
...box(x, y, s * 0.05, s * 0.42, s * 0.45, s * 0.05, C.wood),
|
|
|
|
|
|
...box(x, y, s * 0.11, s * 0.11, s * 0.56, s * 0.11, C.hay),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** An archery target facing +x on two legs, its rings in red. */
|
|
|
|
|
|
function target(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
const r = s * 0.2
|
|
|
|
|
|
const zc = s * 0.33
|
|
|
|
|
|
const front = x + s * 0.04
|
|
|
|
|
|
const depth = front + y + zc + 0.2
|
|
|
|
|
|
return [
|
|
|
|
|
|
...post(x - s * 0.08, y - r * 0.6, zc, s * 0.02),
|
|
|
|
|
|
...post(x - s * 0.08, y + r * 0.6, zc, s * 0.02),
|
|
|
|
|
|
...cylinder(x, y, zc, r, s * 0.08, 'x', C.hay, C.hay, 10),
|
|
|
|
|
|
wallDisc('x', front + 0.1, y, zc, r * 0.66, depth, C.banner, 10),
|
|
|
|
|
|
wallDisc('x', front + 0.2, y, zc, r * 0.4, depth + 0.1, C.canvas, 10),
|
|
|
|
|
|
wallDisc('x', front + 0.3, y, zc, r * 0.18, depth + 0.2, C.banner, 8),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A canvas tent: a ridge from the ground, its open flap on the end towards the viewer. */
|
|
|
|
|
|
function tent(x: number, y: number, w: number, d: number, h: number, along: 'x' | 'y', color: string, door = false): Face[] {
|
|
|
|
|
|
const x1 = x + w / 2
|
|
|
|
|
|
const y1 = y + d / 2
|
|
|
|
|
|
const flap: V3[] =
|
|
|
|
|
|
along === 'x'
|
2026-10-29 15:42:54 +00:00
|
|
|
|
? [[x1 + 0.1, y - d * 0.27, 0], [x1 + 0.1, y + d * 0.27, 0], [x1 + 0.1, y, h * 0.7]]
|
|
|
|
|
|
: [[x - w * 0.27, y1 + 0.1, 0], [x + w * 0.27, y1 + 0.1, 0], [x, y1 + 0.1, h * 0.7]]
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const depth = (along === 'x' ? x1 + y : x + y1) + h / 3 + 0.2
|
|
|
|
|
|
return [
|
|
|
|
|
|
...gable(x - w / 2, y - d / 2, x1, y1, 0, h, along, color, scale(color, 0.9)),
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
{ pts: flap, color: door ? DOOR : C.dark, twoSided: true, depth },
|
2026-10-29 15:42:54 +00:00
|
|
|
|
...shift(along === 'x' ? post(x1, y, h * 0.2, w * 0.02) : post(x, y1, h * 0.2, d * 0.02), 0, 0, h * 0.94),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function barrel(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
return [...prism(ngon(x, y, s * 0.1, 8), 0, s * 0.24, C.wood, C.woodDark), ...prism(ngon(x, y, s * 0.105, 8), s * 0.08, s * 0.025, C.dark)]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function sack(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
return [...prism(ngon(x, y, s * 0.09, 6, 0.3), 0, s * 0.14, C.canvas), ...pyramid(ngon(x, y, s * 0.09, 6, 0.3), s * 0.14, s * 0.07, C.canvasDark)]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function hayBale(x: number, y: number, s: number, along: 'x' | 'y' = 'x'): Face[] {
|
|
|
|
|
|
return along === 'x' ? box(x, y, s * 0.32, s * 0.2, 0, s * 0.18, C.hay) : box(x, y, s * 0.2, s * 0.32, 0, s * 0.18, C.hay)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function trough(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
return [...box(x, y, s * 0.42, s * 0.16, 0, s * 0.13, C.wood), plane(rect(x, y, s * 0.34, s * 0.09).map(([px, py]): V3 => [px, py, s * 0.131]), C.water)]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Squared timbers piled along x. */
|
|
|
|
|
|
function timbers(x: number, y: number, s: number, layers = 2): Face[] {
|
|
|
|
|
|
const faces: Face[] = []
|
|
|
|
|
|
for (let l = 0; l < layers; l++) {
|
|
|
|
|
|
for (let i = 0; i < 3 - l; i++) faces.push(...box(x, y - s * 0.1 * (2 - l) / 2 + i * s * 0.1, s * 0.75, s * 0.085, l * s * 0.085, s * 0.085, i % 2 ? C.plank : C.wood, C.plank))
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Merlons along the top edges of a flat-topped box. */
|
|
|
|
|
|
function battlements(cx: number, cy: number, w: number, d: number, z: number, m: number, color: string): Face[] {
|
|
|
|
|
|
const faces: Face[] = []
|
|
|
|
|
|
const nx = Math.max(2, Math.round(w / (m * 2)))
|
|
|
|
|
|
const ny = Math.max(2, Math.round(d / (m * 2)))
|
|
|
|
|
|
for (let i = 0; i <= nx; i++) {
|
|
|
|
|
|
const x = Math.min(cx + w / 2 - m / 2, Math.max(cx - w / 2 + m / 2, cx - w / 2 + (i * w) / nx))
|
|
|
|
|
|
faces.push(...box(x, cy - d / 2 + m / 2, m, m, z, m, color), ...box(x, cy + d / 2 - m / 2, m, m, z, m, color))
|
|
|
|
|
|
}
|
|
|
|
|
|
for (let j = 1; j < ny; j++) {
|
|
|
|
|
|
const y = cy - d / 2 + (j * d) / ny
|
|
|
|
|
|
faces.push(...box(cx - w / 2 + m / 2, y, m, m, z, m, color), ...box(cx + w / 2 - m / 2, y, m, m, z, m, color))
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* A barn, ridge along x so its gable end faces the viewer: walls on a plinth, a gambrel
|
|
|
|
|
|
* roof, big double doors in the end wall and a loft door above (with a hoist beam and a
|
|
|
|
|
|
* sack on its rope when `hoist`), vents high on the long side.
|
|
|
|
|
|
*/
|
|
|
|
|
|
function barn(cx: number, cy: number, w: number, d: number, h: number, rise: number, walls: string, roof: string, hoist: boolean): Face[] {
|
|
|
|
|
|
const p = Math.min(h * 0.14, d * 0.1)
|
|
|
|
|
|
const o = d * 0.06
|
|
|
|
|
|
const x1 = cx + w / 2
|
|
|
|
|
|
const xDepth = x1 + cy + (p + h) / 2 + 0.1
|
|
|
|
|
|
const yDepth = cx + cy + d / 2 + (p + h) / 2 + 0.1
|
|
|
|
|
|
const endDepth = x1 + o + cy + h + rise * 0.44 + 0.1
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
const frame = trim(walls)
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const dw = d * 0.46
|
|
|
|
|
|
const dh = (h - p) * 0.82
|
|
|
|
|
|
const loftZ = h + rise * 0.12
|
|
|
|
|
|
const faces: Face[] = [
|
|
|
|
|
|
...box(cx, cy, w + p * 0.6, d + p * 0.6, 0, p, C.stone),
|
|
|
|
|
|
...box(cx, cy, w, d, p, h - p, walls),
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
...mudline(cx, cy, w, d, p, h, walls),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...(walls === C.stone ? [] : framing(cx, cy, w, d, p, h, walls)),
|
|
|
|
|
|
...gambrel(cx - w / 2 - o, cy - d / 2 - o, x1 + o, cy + d / 2 + o, h, rise, 'x', roof, walls),
|
|
|
|
|
|
wallPanel('x', x1 + 0.25, cy, p, dw * 1.14, dh + d * 0.05, xDepth, frame),
|
|
|
|
|
|
wallPanel('x', x1 + 0.3, cy, p, dw, dh, xDepth + 0.05, DOOR),
|
|
|
|
|
|
wallPanel('x', x1 + 0.35, cy, p, d * 0.025, dh, xDepth + 0.1, scale(DOOR, 0.7)),
|
|
|
|
|
|
wallPanel('x', x1 + 0.35, cy, p + dh * 0.45, dw, d * 0.035, xDepth + 0.1, frame),
|
|
|
|
|
|
wallPanel('x', x1 + o + 0.3, cy, loftZ, d * 0.24, rise * 0.34, endDepth, frame),
|
|
|
|
|
|
wallPanel('x', x1 + o + 0.35, cy, loftZ + rise * 0.02, d * 0.19, rise * 0.29, endDepth + 0.05, hoist ? C.hay : C.dark),
|
|
|
|
|
|
...[-0.28, 0.28].map((u) => wallPanel('y', cy + d / 2 + 0.25, cx + u * w, h * 0.62, w * 0.07, h * 0.18, yDepth, C.dark)),
|
|
|
|
|
|
]
|
|
|
|
|
|
if (hoist) {
|
|
|
|
|
|
const bz = loftZ + rise * 0.4
|
|
|
|
|
|
faces.push(
|
|
|
|
|
|
...box(x1 + o + d * 0.12, cy, d * 0.3, d * 0.05, bz, d * 0.05, C.woodDark),
|
|
|
|
|
|
...box(x1 + o + d * 0.24, cy, d * 0.012, d * 0.012, bz - rise * 0.32, rise * 0.32, C.dark),
|
|
|
|
|
|
...sack(x1 + o + d * 0.24, cy, d).map((f) => ({ ...f, pts: f.pts.map(([x, y, z]): V3 => [x, y, z + bz - rise * 0.32 - d * 0.2]) })),
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-30 12:54:57 +00:00
|
|
|
|
/** A cot along x: a low frame on four legs, a straw mattress, a rumpled blanket and a bolster. */
|
|
|
|
|
|
function cot(x: number, y: number, s: number, blanket = C.canvasDark): Face[] {
|
|
|
|
|
|
return [
|
|
|
|
|
|
...[-1, 1].flatMap((fx) => [-1, 1].flatMap((fy) => post(x + fx * s * 0.21, y + fy * s * 0.08, s * 0.1, s * 0.015))),
|
|
|
|
|
|
...box(x, y, s * 0.5, s * 0.2, s * 0.1, s * 0.035, C.wood),
|
|
|
|
|
|
...box(x + s * 0.05, y, s * 0.38, s * 0.19, s * 0.135, s * 0.04, blanket),
|
|
|
|
|
|
...box(x - s * 0.19, y, s * 0.09, s * 0.15, s * 0.135, s * 0.035, C.canvas),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Bandages drying on a line between two posts along y, some still stained. */
|
|
|
|
|
|
function bandages(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
const h = s * 0.55
|
|
|
|
|
|
const a = s * 0.32
|
|
|
|
|
|
const strip = (u: number, color: string, len = 0.22): Face => plane([[x, y + u - s * 0.04, h], [x, y + u + s * 0.04, h], [x, y + u + s * 0.04, h - s * len], [x, y + u - s * 0.04, h - s * len]], color)
|
|
|
|
|
|
return [
|
|
|
|
|
|
...post(x, y - a, h + s * 0.04, s * 0.022),
|
|
|
|
|
|
...post(x, y + a, h + s * 0.04, s * 0.022),
|
|
|
|
|
|
...beam([x, y - a], [x, y + a], h, s * 0.012, s * 0.012, C.dark),
|
|
|
|
|
|
strip(-a * 0.6, C.canvas),
|
|
|
|
|
|
strip(-a * 0.15, C.blood, 0.18),
|
|
|
|
|
|
strip(a * 0.3, C.canvas, 0.26),
|
|
|
|
|
|
strip(a * 0.7, C.canvasDark, 0.16),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A lean-to roof on two posts against a wall facing +y: from z0 at the wall (y0) down to z1 at y1. */
|
|
|
|
|
|
function leanTo(x0: number, x1: number, y0: number, y1: number, z0: number, z1: number, s: number, color: string): Face[] {
|
|
|
|
|
|
return [...post(x0, y1, z1, s * 0.03), ...post(x1, y1, z1, s * 0.03), plane([[x0, y0, z0], [x1, y0, z0], [x1, y1, z1], [x0, y1, z1]], color)]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A bed of herbs in rows, for salves and teas. */
|
|
|
|
|
|
function herbs(x: number, y: number, w: number, d: number): Face[] {
|
|
|
|
|
|
return field(x, y, w, d, C.leaf, 4)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-31 10:07:33 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* A market stall along x, open towards +y: a counter with goods heaped on it, posts higher
|
|
|
|
|
|
* at the back, and a striped awning sloping down to the front with a valance at its edge.
|
|
|
|
|
|
*/
|
|
|
|
|
|
function stall(x: number, y: number, s: number, stripes: [string, string], goods: string[]): Face[] {
|
|
|
|
|
|
const w = s * 0.56
|
|
|
|
|
|
const d = s * 0.34
|
|
|
|
|
|
const y0 = y - d / 2
|
|
|
|
|
|
const y1 = y + d / 2
|
|
|
|
|
|
const hb = s * 0.6
|
|
|
|
|
|
const hf = s * 0.5
|
|
|
|
|
|
const faces: Face[] = [
|
|
|
|
|
|
...post(x - w / 2, y0, hb, s * 0.022),
|
|
|
|
|
|
...post(x + w / 2, y0, hb, s * 0.022),
|
|
|
|
|
|
...post(x - w / 2, y1, hf, s * 0.022),
|
|
|
|
|
|
...post(x + w / 2, y1, hf, s * 0.022),
|
|
|
|
|
|
...box(x, y + d * 0.15, w * 0.9, d * 0.5, 0, s * 0.2, C.wood, C.plank),
|
|
|
|
|
|
]
|
|
|
|
|
|
goods.forEach((color, i) => {
|
|
|
|
|
|
const gx = x - w * 0.28 + (i * w * 0.56) / Math.max(1, goods.length - 1)
|
|
|
|
|
|
faces.push(...pyramid(ngon(gx, y + d * 0.15, s * 0.065, 6, i), s * 0.2, s * 0.075, color))
|
|
|
|
|
|
})
|
|
|
|
|
|
const x0 = x - w / 2 - s * 0.03
|
|
|
|
|
|
const span = w + s * 0.06
|
|
|
|
|
|
const ya = y0 - s * 0.02
|
|
|
|
|
|
const yb = y1 + s * 0.04
|
|
|
|
|
|
const zb = hf - s * 0.02
|
|
|
|
|
|
for (let i = 0; i < 4; i++) {
|
|
|
|
|
|
const xa = x0 + (i * span) / 4
|
|
|
|
|
|
const xb = x0 + ((i + 1) * span) / 4
|
|
|
|
|
|
faces.push(plane([[xa, ya, hb], [xb, ya, hb], [xb, yb, zb], [xa, yb, zb]], stripes[i % 2]!))
|
|
|
|
|
|
}
|
|
|
|
|
|
faces.push(plane([[x0, yb, zb], [x0 + span, yb, zb], [x0 + span, yb, zb - s * 0.06], [x0, yb, zb - s * 0.06]], stripes[0]))
|
|
|
|
|
|
return faces
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A stall at (x, y), open towards +y or turned to open towards +x. */
|
|
|
|
|
|
function stallAt(x: number, y: number, s: number, opens: 'x' | 'y', stripes: [string, string], goods: string[]): Face[] {
|
|
|
|
|
|
return opens === 'y' ? stall(x, y, s, stripes, goods) : shift(turn(stall(0, 0, s, stripes, goods), 3), x, y)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A two-wheeled cart facing +x before `quarters` turns: a railed bed, shafts down at the front, its load on the bed. */
|
|
|
|
|
|
function cart(x: number, y: number, k: number, quarters = 0, load: Face[] = []): Face[] {
|
|
|
|
|
|
const bed = k * 0.5
|
|
|
|
|
|
const shaft = (side: number) =>
|
|
|
|
|
|
slab(
|
|
|
|
|
|
rect(k * 0.8, side * k * 0.32, k * 0.08, k * 0.08).map(([px, py]): V3 => [px, py, bed]),
|
|
|
|
|
|
rect(k * 1.9, side * k * 0.32, k * 0.08, k * 0.08).map(([px, py]): V3 => [px, py, k * 0.04]),
|
|
|
|
|
|
C.woodDark,
|
|
|
|
|
|
)
|
|
|
|
|
|
const faces: Face[] = [
|
|
|
|
|
|
...wheel(-k * 0.1, -k * 0.62, k * 0.45, 'y'),
|
|
|
|
|
|
...box(0, 0, k * 1.6, k * 1.0, bed, k * 0.1, C.plank, C.wood),
|
|
|
|
|
|
...box(0, -k * 0.47, k * 1.6, k * 0.06, bed + k * 0.1, k * 0.2, C.wood),
|
|
|
|
|
|
...box(-k * 0.77, 0, k * 0.06, k * 0.88, bed + k * 0.1, k * 0.2, C.wood),
|
|
|
|
|
|
...box(0, k * 0.47, k * 1.6, k * 0.06, bed + k * 0.1, k * 0.2, C.wood),
|
|
|
|
|
|
...shaft(-1),
|
|
|
|
|
|
...shaft(1),
|
|
|
|
|
|
...shift(load, 0, 0, bed + k * 0.1),
|
|
|
|
|
|
...wheel(-k * 0.1, k * 0.62, k * 0.45, 'y'),
|
|
|
|
|
|
]
|
|
|
|
|
|
return shift(turn(faces, quarters), x, y)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** The pillory on the market square: a post on a stone step with the board for neck and hands. */
|
|
|
|
|
|
function pillory(x: number, y: number, s: number): Face[] {
|
|
|
|
|
|
return [
|
|
|
|
|
|
...box(x, y, s * 0.28, s * 0.28, 0, s * 0.06, C.stoneDark, C.stone),
|
|
|
|
|
|
...post(x, y, s * 0.66, s * 0.03),
|
|
|
|
|
|
...box(x, y, s * 0.06, s * 0.36, s * 0.4, s * 0.08, C.woodDark),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** An open hall: posts under a gable roof along x over [x0, x1] × [y0, y1], a long counter beneath. */
|
|
|
|
|
|
function hall(x0: number, x1: number, y0: number, y1: number, h: number, rise: number, s: number, roof: string, goods: string[]): Face[] {
|
|
|
|
|
|
const o = s * 0.05
|
|
|
|
|
|
const cx = (x0 + x1) / 2
|
|
|
|
|
|
const cy = (y0 + y1) / 2
|
|
|
|
|
|
return [
|
|
|
|
|
|
...[x0, cx, x1].flatMap((x) => [...post(x, y0, h, s * 0.035), ...post(x, y1, h, s * 0.035)]),
|
|
|
|
|
|
...box(cx, cy + (y1 - y0) * 0.1, (x1 - x0) * 0.8, (y1 - y0) * 0.35, 0, s * 0.2, C.wood, C.plank),
|
|
|
|
|
|
...goods.flatMap((color, i) => pyramid(ngon(x0 + ((x1 - x0) * (i + 1)) / (goods.length + 1), cy + (y1 - y0) * 0.1, s * 0.07, 6, i), s * 0.2, s * 0.08, color)),
|
|
|
|
|
|
...gable(x0 - o, y0 - o, x1 + o, y1 + o, h, rise, 'x', roof, C.wood),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-29 15:34:42 +00:00
|
|
|
|
/** The village banner on a tall pole, flying from its top. */
|
|
|
|
|
|
function flag(x: number, y: number, h: number, size: number): Face[] {
|
|
|
|
|
|
return [...post(x, y, h, size * 0.03), plane([[x, y, h], [x - size * 0.1, y + size * 0.85, h - size * 0.08], [x, y, h - size * 0.4]], C.banner)]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-28 18:54:20 +00:00
|
|
|
|
// Buildings
|
|
|
|
|
|
|
|
|
|
|
|
const models: Record<BuildingType, (s: number, t: number) => Model> = {
|
2026-10-29 15:34:42 +00:00
|
|
|
|
// The village hall, the biggest building: its door between two banners and steps up to
|
|
|
|
|
|
// it. A thatched longhouse with a cross wing and a porch first, then a hall of timber on
|
|
|
|
|
|
// stone with a flag tower, then a stone keep.
|
2026-10-28 18:54:20 +00:00
|
|
|
|
headquarters(s, t) {
|
|
|
|
|
|
if (t === 1) {
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const x1 = s * 0.6
|
|
|
|
|
|
const yd = -s * 0.05 + s * 0.95 * 0.12
|
2026-10-28 18:54:20 +00:00
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...house(-s * 0.15, -s * 0.05, s * 1.5, s * 0.95, s * 0.55, s * 0.6, C.wood, C.thatch),
|
|
|
|
|
|
...flag(-s * 0.75, -s * 0.75, s * 1.75, s * 0.45),
|
|
|
|
|
|
...post(x1 + s * 0.36, yd - s * 0.24, s * 0.44, s * 0.035),
|
|
|
|
|
|
...post(x1 + s * 0.36, yd + s * 0.24, s * 0.44, s * 0.035),
|
|
|
|
|
|
...gable(x1 - s * 0.02, yd - s * 0.3, x1 + s * 0.44, yd + s * 0.3, s * 0.44, s * 0.24, 'x', C.thatch, C.wood),
|
|
|
|
|
|
...banner(x1 + s * 0.55, yd - s * 0.5, s * 0.95, s * 0.42),
|
|
|
|
|
|
...banner(x1 + s * 0.55, yd + s * 0.5, s * 0.95, s * 0.42),
|
|
|
|
|
|
...fire(s * 0.15, s * 0.8, s),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
],
|
2026-10-29 15:34:42 +00:00
|
|
|
|
height: s * 1.75,
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const w = s * 1.4
|
|
|
|
|
|
const d = s * 1.0
|
|
|
|
|
|
const h1 = s * 0.38
|
|
|
|
|
|
const h2 = s * 0.38
|
|
|
|
|
|
const j = s * 0.06
|
|
|
|
|
|
const x1 = w / 2
|
|
|
|
|
|
const yd = d * 0.12
|
|
|
|
|
|
const up = h1 + h2
|
|
|
|
|
|
const xDepth = x1 + j / 2 + (h1 + up) / 2 + 0.12
|
|
|
|
|
|
const yDepth = d / 2 + j / 2 + (h1 + up) / 2 + 0.12
|
|
|
|
|
|
const win = s * 0.12
|
2026-10-28 18:54:20 +00:00
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...box(0, 0, w, d, 0, h1, C.stone, C.stoneDark),
|
|
|
|
|
|
...openings(0, 0, w, d, 0, h1 * 1.25, C.stone),
|
|
|
|
|
|
...box(0, 0, w + j, d + j, h1, h2, C.plank),
|
|
|
|
|
|
...framing(0, 0, w + j, d + j, h1, up, C.plank),
|
|
|
|
|
|
...[-0.25, 0.25].map((u) => wallPanel('x', x1 + j / 2 + 0.3, u * d, h1 + h2 * 0.3, win, win * 1.1, xDepth, C.dark)),
|
|
|
|
|
|
...[-0.3, 0, 0.3].map((u) => wallPanel('y', d / 2 + j / 2 + 0.3, u * w, h1 + h2 * 0.3, win, win * 1.1, yDepth, C.dark)),
|
|
|
|
|
|
...gable(-w / 2 - j, -d / 2 - j, w / 2 + j, d / 2 + j, up, s * 0.5, 'x', C.roofRed, C.plank),
|
|
|
|
|
|
...box(-s * 0.55, -s * 0.42, s * 0.48, s * 0.48, 0, s * 1.4, C.stone, C.stoneDark),
|
|
|
|
|
|
...pyramid(rect(-s * 0.55, -s * 0.42, s * 0.6, s * 0.6), s * 1.4, s * 0.42, C.roofRed),
|
|
|
|
|
|
...flag(-s * 0.55, -s * 0.42, s * 2.15, s * 0.45),
|
|
|
|
|
|
...box(x1 + s * 0.12, yd, s * 0.22, s * 0.42, 0, s * 0.05, C.stoneDark, C.stone),
|
|
|
|
|
|
...banner(x1 + s * 0.38, yd - s * 0.42, s * 1.05, s * 0.45),
|
|
|
|
|
|
...banner(x1 + s * 0.38, yd + s * 0.42, s * 1.05, s * 0.45),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
],
|
2026-10-29 15:34:42 +00:00
|
|
|
|
height: s * 2.15,
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const x1 = s * 0.675
|
|
|
|
|
|
const yd = s * 1.35 * 0.12
|
2026-10-28 18:54:20 +00:00
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...box(0, 0, s * 1.35, s * 1.35, 0, s * 0.9, C.stone, C.stoneDark),
|
2026-10-29 15:08:57 +00:00
|
|
|
|
...openings(0, 0, s * 1.35, s * 1.35, 0, s * 0.9, C.stone),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
...pyramid(rect(0, 0, s * 1.5, s * 1.5), s * 0.9, s * 0.65, C.slate),
|
|
|
|
|
|
...prism(ngon(-s * 0.72, s * 0.72, s * 0.28, 6), 0, s * 1.3, C.stone),
|
|
|
|
|
|
...pyramid(ngon(-s * 0.72, s * 0.72, s * 0.34, 6), s * 1.3, s * 0.45, C.slate),
|
|
|
|
|
|
...prism(ngon(s * 0.72, -s * 0.72, s * 0.28, 6), 0, s * 1.3, C.stone),
|
|
|
|
|
|
...pyramid(ngon(s * 0.72, -s * 0.72, s * 0.34, 6), s * 1.3, s * 0.45, C.slate),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...prism(ngon(-s * 0.5, -s * 0.5, s * 0.3, 6), 0, s * 1.75, C.stone),
|
|
|
|
|
|
...pyramid(ngon(-s * 0.5, -s * 0.5, s * 0.36, 6), s * 1.75, s * 0.5, C.slate),
|
|
|
|
|
|
...flag(-s * 0.5, -s * 0.5, s * 2.6, s * 0.5),
|
|
|
|
|
|
...box(x1 + s * 0.12, yd, s * 0.22, s * 0.45, 0, s * 0.06, C.stoneDark, C.stone),
|
|
|
|
|
|
...banner(x1 + s * 0.4, yd - s * 0.4, s * 1.15, s * 0.45),
|
|
|
|
|
|
...banner(x1 + s * 0.4, yd + s * 0.4, s * 1.15, s * 0.45),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
],
|
2026-10-29 15:34:42 +00:00
|
|
|
|
height: s * 2.6,
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2026-10-29 15:34:42 +00:00
|
|
|
|
// A barn: tall walls under a gambrel roof, big double doors in the gable end and a loft
|
|
|
|
|
|
// door with its hoist above, sacks and barrels at the door. Wood first, then painted
|
|
|
|
|
|
// planks with a hay loft, then stone with a granary on staddle stones beside it.
|
2026-10-28 18:54:20 +00:00
|
|
|
|
storage(s, t) {
|
2026-10-29 15:34:42 +00:00
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [...barn(-s * 0.2, -s * 0.05, s * 1.25, s * 1.0, s * 0.6, s * 0.6, C.wood, C.thatch, false), ...barrel(s * 0.75, -s * 0.45, s), ...sack(s * 0.72, s * 0.42, s), ...sack(s * 0.88, s * 0.3, s)],
|
|
|
|
|
|
height: s * 1.3,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-10-28 18:54:20 +00:00
|
|
|
|
if (t === 2) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...barn(-s * 0.2, -s * 0.1, s * 1.4, s * 1.1, s * 0.72, s * 0.72, C.barn, C.shingle, true),
|
|
|
|
|
|
...barrel(s * 0.8, -s * 0.55, s),
|
|
|
|
|
|
...barrel(s * 0.8, -s * 0.33, s),
|
|
|
|
|
|
...sack(s * 0.75, s * 0.38, s),
|
|
|
|
|
|
...sack(s * 0.92, s * 0.48, s),
|
|
|
|
|
|
...sack(s * 0.82, s * 0.6, s),
|
|
|
|
|
|
...hayBale(-s * 0.45, s * 0.75, s),
|
|
|
|
|
|
...shift(hayBale(-s * 0.45, s * 0.75, s), 0, 0, s * 0.18),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
],
|
2026-10-29 15:34:42 +00:00
|
|
|
|
height: s * 1.55,
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const granary: Face[] = [
|
|
|
|
|
|
...[-1, 1].flatMap((fx) => [-1, 1].flatMap((fy) => prism(ngon(-s * 0.55 + fx * s * 0.18, s * 0.78 + fy * s * 0.14, s * 0.05, 5), 0, s * 0.16, C.stone))),
|
|
|
|
|
|
...shift(house(-s * 0.55, s * 0.78, s * 0.5, s * 0.4, s * 0.3, s * 0.25, C.wood, C.thatch, 'x', true), 0, 0, s * 0.16),
|
|
|
|
|
|
]
|
2026-10-28 18:54:20 +00:00
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...barn(-s * 0.1, -s * 0.2, s * 1.5, s * 1.15, s * 0.78, s * 0.78, C.stone, C.slate, true),
|
|
|
|
|
|
...granary,
|
|
|
|
|
|
...barrel(s * 0.9, -s * 0.65, s),
|
|
|
|
|
|
...barrel(s * 0.9, -s * 0.43, s),
|
|
|
|
|
|
...barrel(s * 1.06, -s * 0.54, s),
|
|
|
|
|
|
...sack(s * 0.85, s * 0.35, s),
|
|
|
|
|
|
...sack(s * 1.0, s * 0.45, s),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
],
|
2026-10-29 15:34:42 +00:00
|
|
|
|
height: s * 1.65,
|
2026-10-28 18:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
farm(s, t) {
|
|
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...field(0, s * 0.3, s * 1.6, s * 1.0, C.wheat, 6),
|
|
|
|
|
|
...house(-s * 0.35, -s * 0.65, s * 0.7, s * 0.55, s * 0.4, s * 0.35, C.wood, C.thatch),
|
|
|
|
|
|
...person(s * 0.3, s * 0.3, s),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 0.8,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...field(-s * 0.4, s * 0.35, s * 1.05, s * 1.1, C.wheat, 4),
|
|
|
|
|
|
...field(s * 0.55, s * 0.35, s * 0.75, s * 1.1, C.field, 3),
|
|
|
|
|
|
...house(-s * 0.2, -s * 0.65, s * 0.9, s * 0.6, s * 0.45, s * 0.4, C.plank, C.roofRed),
|
|
|
|
|
|
...pyramid(ngon(s * 0.65, -s * 0.6, s * 0.22, 7), 0, s * 0.42, C.hay),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 0.85,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...field(-s * 0.3, s * 0.45, s * 1.3, s * 0.95, C.wheat, 5),
|
|
|
|
|
|
...field(s * 0.7, s * 0.45, s * 0.55, s * 0.95, C.field, 2),
|
|
|
|
|
|
...house(-s * 0.3, -s * 0.6, s * 1.1, s * 0.7, s * 0.6, s * 0.45, C.roofRed, C.slate),
|
|
|
|
|
|
...prism(ngon(s * 0.65, -s * 0.6, s * 0.22, 7), 0, s * 1.1, C.stone),
|
|
|
|
|
|
...pyramid(ngon(s * 0.65, -s * 0.6, s * 0.26, 7), s * 1.1, s * 0.3, C.slate),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.4,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
timber_camp(s, t) {
|
|
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...logPile(s * 0.2, s * 0.45, s, 2),
|
|
|
|
|
|
...post(-s * 0.75, -s * 0.15, s * 0.6, s * 0.04),
|
|
|
|
|
|
...post(-s * 0.15, -s * 0.15, s * 0.6, s * 0.04),
|
|
|
|
|
|
...post(-s * 0.75, -s * 0.75, s * 0.75, s * 0.04),
|
|
|
|
|
|
...post(-s * 0.15, -s * 0.75, s * 0.75, s * 0.04),
|
|
|
|
|
|
plane([[-s * 0.85, -s * 0.85, s * 0.75], [-s * 0.05, -s * 0.85, s * 0.75], [-s * 0.05, -s * 0.05, s * 0.6], [-s * 0.85, -s * 0.05, s * 0.6]], C.woodDark),
|
|
|
|
|
|
...tree(s * 0.6, -s * 0.55, s * 1.1, 2),
|
|
|
|
|
|
...tree(-s * 0.7, s * 0.65, s * 0.9, 3),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.1,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...house(-s * 0.2, -s * 0.35, s * 1.1, s * 0.8, s * 0.5, s * 0.4, C.wood, C.plank),
|
|
|
|
|
|
...logPile(s * 0.25, s * 0.6, s, 2),
|
|
|
|
|
|
...tree(s * 0.7, -s * 0.6, s * 1.1, 4),
|
|
|
|
|
|
...tree(-s * 0.75, s * 0.7, s, 5),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.1,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...house(-s * 0.15, -s * 0.3, s * 1.35, s * 0.95, s * 0.6, s * 0.45, C.plank, C.roofRed),
|
|
|
|
|
|
...logPile(-s * 0.3, s * 0.7, s, 3),
|
|
|
|
|
|
...box(s * 0.55, s * 0.6, s * 0.5, s * 0.25, 0, s * 0.18, C.plank),
|
|
|
|
|
|
...tree(s * 0.75, -s * 0.7, s * 1.2, 6),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.2,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
clay_pit(s, t) {
|
|
|
|
|
|
const pit = (x: number, y: number, r: number): Face[] => [
|
|
|
|
|
|
plane(ngon(x, y, r, 7, 0.2).map(([px, py]) => [px, py, 0.4]), C.clayDark),
|
|
|
|
|
|
plane(ngon(x, y, r * 0.65, 7, 0.5).map(([px, py]) => [px, py, 0.6]), C.clayWet),
|
|
|
|
|
|
]
|
|
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [...pit(-s * 0.2, s * 0.2, s * 0.6), ...bricks(s * 0.6, -s * 0.45, s, 4), ...bricks(s * 0.25, -s * 0.7, s, 3), ...person(s * 0.4, s * 0.3, s)],
|
|
|
|
|
|
height: s * 0.45,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [...pit(-s * 0.3, s * 0.3, s * 0.55), ...kiln(s * 0.35, -s * 0.35, s), ...bricks(s * 0.65, s * 0.55, s, 5)],
|
|
|
|
|
|
height: s * 0.85,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...pit(-s * 0.35, s * 0.4, s * 0.5),
|
|
|
|
|
|
...kiln(s * 0.45, -s * 0.15, s),
|
|
|
|
|
|
...kiln(-s * 0.35, -s * 0.55, s),
|
|
|
|
|
|
...bricks(s * 0.65, s * 0.65, s, 6),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 0.85,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
iron_mine(s, t) {
|
|
|
|
|
|
const outcrop = (k: number) => pyramid(ngon(-s * 0.2, -s * 0.25, s * 0.75 * k, 6, 0.4), 0, s * 0.95 * k, C.rock, [-s * 0.35, -s * 0.45])
|
|
|
|
|
|
const mouth = plane([[s * 0.32, -s * 0.35, 0], [s * 0.32, -s * 0.05, 0], [s * 0.2, -s * 0.05, s * 0.3], [s * 0.2, -s * 0.35, s * 0.3]], C.dark)
|
|
|
|
|
|
const ore = (x: number, y: number) => pyramid(ngon(x, y, s * 0.18, 5), 0, s * 0.18, C.ore)
|
|
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...outcrop(1),
|
|
|
|
|
|
mouth,
|
|
|
|
|
|
...post(s * 0.36, -s * 0.4, s * 0.38, s * 0.04),
|
|
|
|
|
|
...post(s * 0.36, 0, s * 0.38, s * 0.04),
|
|
|
|
|
|
...box(s * 0.36, -s * 0.2, s * 0.08, s * 0.5, s * 0.38, s * 0.06, C.woodDark),
|
|
|
|
|
|
...box(s * 0.6, s * 0.55, s * 0.3, s * 0.2, s * 0.04, s * 0.12, C.woodDark, C.ore),
|
|
|
|
|
|
...ore(s * 0.1, s * 0.6),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 0.95,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) return { faces: [...outcrop(1.05), mouth, ...headframe(s * 0.45, s * 0.35, s, s * 1.0), ...ore(-s * 0.5, s * 0.6)], height: s * 1.3 }
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...outcrop(1.15),
|
|
|
|
|
|
mouth,
|
|
|
|
|
|
...headframe(s * 0.5, s * 0.25, s, s * 1.15),
|
|
|
|
|
|
...box(-s * 0.45, s * 0.6, s * 0.55, s * 0.45, 0, s * 0.4, C.stone),
|
|
|
|
|
|
...box(-s * 0.3, s * 0.5, s * 0.12, s * 0.12, s * 0.4, s * 0.5, C.stoneDark),
|
|
|
|
|
|
{ pts: ngon(-s * 0.3, s * 0.5, s * 0.05, 4).map(([x, y]): V3 => [x, y, s * 0.92]), color: C.fire, flat: true },
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.45,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
hiding_place(s, t) {
|
|
|
|
|
|
const door = plane([[s * 0.45, -s * 0.2, 0], [s * 0.45, s * 0.2, 0], [s * 0.45, s * 0.2, s * 0.35], [s * 0.45, -s * 0.2, s * 0.35]], C.dark)
|
|
|
|
|
|
if (t === 1) return { faces: [...pyramid(rect(0, 0, s * 1.2, s * 1.2), 0, s * 0.55, C.grass), door], height: s * 0.55 }
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [...box(0, 0, s * 1.0, s * 1.0, 0, s * 0.4, C.stone), ...pyramid(rect(0, 0, s * 1.1, s * 1.1), s * 0.4, s * 0.3, C.grass), shift([door], s * 0.06, 0)[0]!],
|
|
|
|
|
|
height: s * 0.7,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
// Where the army gathers and comes back: the platform with its banners, spears left
|
|
|
|
|
|
// stuck in the ground, a split shield, and blood trodden into the mud.
|
|
|
|
|
|
rally_point(s) {
|
|
|
|
|
|
const spear = (x: number, y: number, dx: number, dy: number): Face[] => [
|
|
|
|
|
|
...slab(rect(x, y, s * 0.03, s * 0.03).map(([px, py]): V3 => [px, py, 0]), rect(x + dx, y + dy, s * 0.03, s * 0.03).map(([px, py]): V3 => [px, py, s * 0.62]), C.woodDark),
|
|
|
|
|
|
...pyramid(rect(x + dx, y + dy, s * 0.05, s * 0.05), s * 0.62, s * 0.1, C.metal),
|
|
|
|
|
|
]
|
2026-10-28 18:54:20 +00:00
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
...blood(s * 0.6, s * 0.15, s * 0.2, 21),
|
|
|
|
|
|
...blood(-s * 0.35, s * 0.7, s * 0.14, 22),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
...box(0, 0, s * 0.9, s * 0.9, 0, s * 0.15, C.plank, C.wood),
|
|
|
|
|
|
...banner(-s * 0.3, -s * 0.3, s * 1.8, s * 0.8),
|
|
|
|
|
|
...banner(s * 0.3, s * 0.3, s * 1.5, s * 0.7, C.slate),
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
...spear(s * 0.75, -s * 0.55, -s * 0.08, s * 0.1),
|
|
|
|
|
|
...spear(s * 0.88, -s * 0.38, s * 0.1, -s * 0.04),
|
|
|
|
|
|
...spear(-s * 0.7, s * 0.3, s * 0.05, s * 0.12),
|
|
|
|
|
|
plane(ngon(s * 0.45, s * 0.65, s * 0.13, 7).map(([x, y]): V3 => [x, y, 1]), C.banner),
|
|
|
|
|
|
plane(ngon(s * 0.62, s * 0.72, s * 0.1, 3, 0.4).map(([x, y]): V3 => [x, y, 1.1]), scale(C.banner, 0.8)),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.8,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
|
// A lookout on stilts first, then a planked tower, then stone with a slate roof.
|
|
|
|
|
|
watchtower(s, t) {
|
|
|
|
|
|
// Four corner posts from z0 up to z0 + h, `r` from the middle.
|
|
|
|
|
|
const corners = (r: number, z0: number, h: number) =>
|
|
|
|
|
|
[-1, 1].flatMap((dx) => [-1, 1].flatMap((dy) => prism(rect(dx * r, dy * r, s * 0.1, s * 0.1), z0, h, C.woodDark)))
|
|
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...corners(s * 0.32, 0, s * 1.5),
|
|
|
|
|
|
...box(0, 0, s * 0.85, s * 0.85, s * 1.5, s * 0.12, C.plank, C.wood),
|
|
|
|
|
|
...corners(s * 0.36, s * 1.62, s * 0.25),
|
|
|
|
|
|
...pyramid(rect(0, 0, s * 0.95, s * 0.95), s * 1.87, s * 0.45, C.thatch),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 2.3,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...box(0, 0, s * 0.8, s * 0.8, 0, s * 1.7, C.plank, C.wood),
|
|
|
|
|
|
...box(0, 0, s * 1.0, s * 1.0, s * 1.7, s * 0.14, C.wood),
|
|
|
|
|
|
...corners(s * 0.44, s * 1.84, s * 0.28),
|
|
|
|
|
|
...pyramid(rect(0, 0, s * 1.05, s * 1.05), s * 2.12, s * 0.5, C.roofRed),
|
|
|
|
|
|
...banner(0, 0, s * 3.0, s * 0.55),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 3.0,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...prism(ngon(0, 0, s * 0.55, 8), 0, s * 2.2, C.stone, C.stoneDark),
|
|
|
|
|
|
...prism(ngon(0, 0, s * 0.7, 8), s * 2.2, s * 0.25, C.stoneDark, C.plank),
|
|
|
|
|
|
...pyramid(ngon(0, 0, s * 0.72, 8), s * 2.45, s * 0.65, C.slate),
|
|
|
|
|
|
plane([[s * 0.55, -s * 0.12, 0], [s * 0.55, s * 0.12, 0], [s * 0.55, s * 0.12, s * 0.45], [s * 0.55, -s * 0.12, s * 0.45]], C.dark),
|
|
|
|
|
|
...banner(0, 0, s * 3.5, s * 0.6),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 3.5,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2026-10-29 15:34:42 +00:00
|
|
|
|
// Military: an army camp of tents first, then a timber hall with shields on its walls,
|
|
|
|
|
|
// then a stone hall with battlements. A training yard in front: spears on a rack,
|
|
|
|
|
|
// straw dummies, a target.
|
2026-10-28 20:44:41 +00:00
|
|
|
|
barracks(s, t) {
|
|
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...tent(-s * 0.3, -s * 0.4, s * 0.95, s * 0.7, s * 0.62, 'x', C.canvas, true),
|
|
|
|
|
|
...tent(-s * 0.6, s * 0.42, s * 0.75, s * 0.55, s * 0.5, 'x', C.canvasDark),
|
2026-10-29 15:42:54 +00:00
|
|
|
|
...weaponRack(s * 0.4, s * 0.65, s, 'x'),
|
|
|
|
|
|
...dummy(s * 0.8, -s * 0.2, s),
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
...blood(s * 0.85, s * 0.25, s * 0.13, 11),
|
2026-10-29 15:42:54 +00:00
|
|
|
|
...fire(s * 0.4, s * 0.15, s),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...banner(-s * 0.95, -s * 0.85, s * 1.15, s * 0.45),
|
2026-10-28 20:44:41 +00:00
|
|
|
|
],
|
2026-10-29 15:34:42 +00:00
|
|
|
|
height: s * 1.15,
|
2026-10-28 20:44:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const cx = -s * 0.1
|
|
|
|
|
|
const cy = -s * 0.3
|
|
|
|
|
|
const w = s * 1.7
|
|
|
|
|
|
const d = s * 0.8
|
|
|
|
|
|
const h = s * 0.58
|
|
|
|
|
|
const ey = cy + d / 2 + 0.3
|
|
|
|
|
|
const depth = cx + cy + d / 2 + (plinthOf(w, d, h) + h) / 2 + 0.3
|
|
|
|
|
|
const shields = [-0.42, 0, 0.42].flatMap((u, i) => [
|
|
|
|
|
|
wallDisc('y', ey, cx + u * w, h * 0.62, s * 0.085, depth, i === 1 ? C.slate : C.banner),
|
|
|
|
|
|
wallDisc('y', ey + 0.1, cx + u * w, h * 0.62, s * 0.025, depth + 0.1, C.metal, 6),
|
|
|
|
|
|
])
|
2026-10-28 20:44:41 +00:00
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...house(cx, cy, w, d, h, s * 0.45, C.plank, C.woodDark),
|
|
|
|
|
|
...shields,
|
|
|
|
|
|
...weaponRack(s * 0.55, s * 0.6, s, 'x'),
|
|
|
|
|
|
...dummy(-s * 0.55, s * 0.6, s),
|
|
|
|
|
|
...dummy(-s * 0.1, s * 0.75, s),
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
...blood(-s * 0.3, s * 0.42, s * 0.17, 12),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...target(s * 0.9, -s * 0.75, s),
|
|
|
|
|
|
...banner(s * 0.95, s * 0.05, s * 1.3, s * 0.5),
|
2026-10-28 20:44:41 +00:00
|
|
|
|
],
|
2026-10-29 15:34:42 +00:00
|
|
|
|
height: s * 1.3,
|
2026-10-28 20:44:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const cx = -s * 0.1
|
|
|
|
|
|
const cy = -s * 0.3
|
|
|
|
|
|
const w = s * 1.75
|
|
|
|
|
|
const d = s * 0.85
|
|
|
|
|
|
const h = s * 0.72
|
2026-10-28 20:44:41 +00:00
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...box(cx, cy, w, d, 0, h, C.stone, C.stoneDark),
|
|
|
|
|
|
...openings(cx, cy, w, d, 0, h * 0.9, C.stone),
|
|
|
|
|
|
...battlements(cx, cy, w, d, h, s * 0.1, C.stone),
|
|
|
|
|
|
...prism(ngon(cx - w / 2, cy - d / 2, s * 0.3, 8), 0, h * 1.55, C.stone, C.stoneDark),
|
|
|
|
|
|
...battlements(cx - w / 2, cy - d / 2, s * 0.5, s * 0.5, h * 1.55, s * 0.09, C.stone),
|
|
|
|
|
|
...flag(cx - w / 2, cy - d / 2, h * 1.55 + s * 0.75, s * 0.45),
|
|
|
|
|
|
...weaponRack(s * 0.55, s * 0.6, s, 'x'),
|
|
|
|
|
|
...dummy(-s * 0.6, s * 0.55, s),
|
|
|
|
|
|
...dummy(-s * 0.2, s * 0.72, s),
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
...blood(-s * 0.4, s * 0.38, s * 0.18, 13),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...target(s * 0.95, -s * 0.85, s),
|
2026-10-28 20:44:41 +00:00
|
|
|
|
],
|
2026-10-29 15:34:42 +00:00
|
|
|
|
height: h * 1.55 + s * 0.75,
|
2026-10-28 20:44:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2026-10-29 15:34:42 +00:00
|
|
|
|
// A long, low stable with a stall door for every horse, heads looking out, and a fenced
|
|
|
|
|
|
// paddock in front where horses stand by the trough and the hay.
|
2026-10-28 20:44:41 +00:00
|
|
|
|
stable(s, t) {
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const [walls, roof] = t === 1 ? [C.wood, C.thatch] : t === 2 ? [C.plank, C.shingle] : [C.stone, C.slate]
|
|
|
|
|
|
const cx = -s * 0.05
|
|
|
|
|
|
const cy = -s * 0.5
|
|
|
|
|
|
const w = s * 1.8
|
|
|
|
|
|
const d = s * 0.62
|
|
|
|
|
|
const h = s * 0.48
|
|
|
|
|
|
const x1 = cx + w / 2
|
|
|
|
|
|
const ey = cy + d / 2 + 0.25
|
|
|
|
|
|
const yDepth = cx + cy + d / 2 + (plinthOf(w, d, h) + h) / 2 + 0.1
|
|
|
|
|
|
const xDepth = x1 + cy + (plinthOf(w, d, h) + h) / 2 + 0.1
|
|
|
|
|
|
const coats = [C.chestnut, C.bay, C.grey]
|
|
|
|
|
|
const stalls = 4
|
|
|
|
|
|
const heads = t
|
|
|
|
|
|
const faces: Face[] = [...house(cx, cy, w, d, h, s * 0.36, walls, roof, 'x', true)]
|
|
|
|
|
|
for (let i = 0; i < stalls; i++) {
|
|
|
|
|
|
const x = cx - w / 2 + (w * (i + 0.5)) / stalls
|
|
|
|
|
|
faces.push(
|
|
|
|
|
|
wallPanel('y', ey, x, h * 0.12, s * 0.27, h * 0.45, yDepth, scale(walls, 0.72)),
|
|
|
|
|
|
wallPanel('y', ey + 0.05, x, h * 0.6, s * 0.24, h * 0.3, yDepth + 0.05, C.dark),
|
|
|
|
|
|
)
|
|
|
|
|
|
if (i < heads) {
|
|
|
|
|
|
// A head looking out over the stall door, nose down.
|
|
|
|
|
|
const k = s * 0.1
|
|
|
|
|
|
const y0 = ey + 0.1
|
|
|
|
|
|
const z0 = h * 0.88
|
|
|
|
|
|
faces.push(
|
2026-10-29 15:42:54 +00:00
|
|
|
|
...over(slab(
|
2026-10-29 15:34:42 +00:00
|
|
|
|
[[x - 0.26 * k, y0, z0 - 0.75 * k], [x + 0.26 * k, y0, z0 - 0.75 * k], [x + 0.2 * k, y0 + 1.25 * k, z0 - 1.2 * k], [x - 0.2 * k, y0 + 1.25 * k, z0 - 1.2 * k]],
|
|
|
|
|
|
[[x - 0.26 * k, y0, z0], [x + 0.26 * k, y0, z0], [x + 0.2 * k, y0 + 1.25 * k, z0 - 0.75 * k], [x - 0.2 * k, y0 + 1.25 * k, z0 - 0.75 * k]],
|
|
|
|
|
|
coats[(i + 1) % 3]!,
|
2026-10-29 15:42:54 +00:00
|
|
|
|
), yDepth + 0.3),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
)
|
|
|
|
|
|
}
|
2026-10-28 20:44:41 +00:00
|
|
|
|
}
|
2026-10-29 15:34:42 +00:00
|
|
|
|
faces.push(
|
feat: grim, war-worn village: cold overcast light, a dark desaturated palette, mud, ruts and puddles, rotten roofs, stumps and dead trees, a graveyard, the gallows, a burnt farmstead, blood on the training yard and rally ground, drab clothes, sooty smoke and crows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-30 09:26:43 +00:00
|
|
|
|
wallPanel('x', x1 + 0.25, cy, h * 0.12, d * 0.5, h * 0.62, xDepth, trim(walls)),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
wallPanel('x', x1 + 0.3, cy, h * 0.12, d * 0.4, h * 0.56, xDepth + 0.05, DOOR),
|
|
|
|
|
|
)
|
|
|
|
|
|
// The paddock, with a horse more for every tier.
|
|
|
|
|
|
const py0 = cy + d / 2 + s * 0.08
|
|
|
|
|
|
faces.push(...fence([[-s * 0.95, py0], [-s * 0.95, s * 0.95], [s * 0.95, s * 0.95], [s * 0.95, s * 0.35]], s * 0.24, s * 0.035))
|
|
|
|
|
|
faces.push(...trough(s * 0.55, py0 + s * 0.14, s), ...hayBale(-s * 0.72, py0 + s * 0.14, s))
|
|
|
|
|
|
const spots: [number, number, number][] = [
|
|
|
|
|
|
[-s * 0.35, s * 0.42, 0],
|
|
|
|
|
|
[s * 0.35, s * 0.7, 1],
|
|
|
|
|
|
[s * 0.4, s * 0.15, 3],
|
|
|
|
|
|
]
|
|
|
|
|
|
spots.slice(0, t).forEach(([x, y, q], i) => faces.push(...horse(x, y, s * 0.13, q, coats[i]!)))
|
|
|
|
|
|
return { faces, height: s * 1.0 }
|
2026-10-28 20:44:41 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
2026-10-29 15:42:54 +00:00
|
|
|
|
// Where siege engines are made: wheels stand in a row by the door, timbers lie ready.
|
|
|
|
|
|
// An open shed with a wheeled frame in the making first, then a ram ready in front,
|
|
|
|
|
|
// then a stone hall with a ram and a catapult.
|
2026-10-28 20:44:41 +00:00
|
|
|
|
workshop(s, t) {
|
2026-10-29 15:34:42 +00:00
|
|
|
|
const shed = (x0: number, y0: number, x1: number, y1: number, h: number, roof: string): Face[] => {
|
2026-10-29 15:42:54 +00:00
|
|
|
|
const inside = scale(C.plank, 0.55)
|
2026-10-29 15:34:42 +00:00
|
|
|
|
return [
|
|
|
|
|
|
plane(rect((x0 + x1) / 2, (y0 + y1) / 2, x1 - x0, y1 - y0).map(([x, y]): V3 => [x, y, 0.5]), C.soil),
|
2026-10-29 15:42:54 +00:00
|
|
|
|
plane([[x0, y0, 0], [x1, y0, 0], [x1, y0, h], [x0, y0, h]], inside),
|
|
|
|
|
|
plane([[x0, y0, 0], [x0, y1, 0], [x0, y1, h], [x0, y0, h]], scale(inside, 0.9)),
|
|
|
|
|
|
...[x0, (x0 + x1) / 2, x1].flatMap((x) => [...post(x, y1, h, s * 0.045), ...post(x, y0, h, s * 0.045)]),
|
|
|
|
|
|
...post(x1, (y0 + y1) / 2, h, s * 0.045),
|
|
|
|
|
|
...gable(x0 - s * 0.06, y0 - s * 0.06, x1 + s * 0.06, y1 + s * 0.06, h, s * 0.3, 'x', roof, C.wood),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
]
|
|
|
|
|
|
}
|
2026-10-29 15:42:54 +00:00
|
|
|
|
/** Finished wheels standing in a row along y, faces to the viewer. */
|
|
|
|
|
|
const wheels = (x: number, y: number, n: number) => Array.from({ length: n }, (_, i) => wheel(x, y + i * s * 0.34, s * 0.17, 'x')).flat()
|
2026-10-29 15:34:42 +00:00
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:42:54 +00:00
|
|
|
|
...shed(-s * 0.9, -s * 0.9, s * 0.2, -s * 0.15, s * 0.62, C.thatch),
|
|
|
|
|
|
...wheel(-s * 0.55, -s * 0.78, s * 0.2, 'y'),
|
|
|
|
|
|
...wheel(-s * 0.15, -s * 0.78, s * 0.2, 'y'),
|
|
|
|
|
|
...frame(s * 0.05, s * 0.35, s * 0.15),
|
|
|
|
|
|
...wheels(s * 0.75, -s * 0.6, 2),
|
|
|
|
|
|
...timbers(-s * 0.5, s * 0.6, s),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
],
|
|
|
|
|
|
height: s * 0.95,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:42:54 +00:00
|
|
|
|
...shed(-s * 0.95, -s * 0.95, s * 0.35, -s * 0.15, s * 0.68, C.shingle),
|
|
|
|
|
|
...wheel(-s * 0.65, -s * 0.83, s * 0.2, 'y'),
|
|
|
|
|
|
...wheel(-s * 0.25, -s * 0.83, s * 0.2, 'y'),
|
|
|
|
|
|
...frame(-s * 0.3, -s * 0.45, s * 0.13),
|
|
|
|
|
|
...ram(s * 0.05, s * 0.4, s * 0.16),
|
|
|
|
|
|
...wheels(s * 0.8, -s * 0.75, 3),
|
|
|
|
|
|
...timbers(-s * 0.65, s * 0.55, s, 3),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.05,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-10-28 20:44:41 +00:00
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-29 15:42:54 +00:00
|
|
|
|
...house(-s * 0.3, -s * 0.62, s * 1.35, s * 0.72, s * 0.62, s * 0.42, C.stone, C.slate),
|
2026-10-29 15:34:42 +00:00
|
|
|
|
...box(-s * 0.85, -s * 0.85, s * 0.14, s * 0.14, s * 0.75, s * 0.5, C.stoneDark),
|
2026-10-29 15:42:54 +00:00
|
|
|
|
...ram(-s * 0.45, s * 0.42, s * 0.15),
|
|
|
|
|
|
...catapult(s * 0.62, s * 0.25, s * 0.15),
|
|
|
|
|
|
...wheels(s * 0.85, -s * 0.85, 2),
|
|
|
|
|
|
...timbers(-s * 0.1, s * 0.92, s, 2),
|
2026-10-28 20:44:41 +00:00
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.2,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-10-30 12:54:57 +00:00
|
|
|
|
|
|
|
|
|
|
// The Lazarett, where the wounded lie: a field tent with cots in the open first, then a
|
|
|
|
|
|
// timber infirmary with cots under a lean-to and a herb bed, then a stone one with a
|
|
|
|
|
|
// bell gable and a fenced herb garden. Bandages dry on a line, some still stained.
|
|
|
|
|
|
hospital(s, t) {
|
|
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...tent(-s * 0.2, -s * 0.25, s * 1.25, s * 0.75, s * 0.62, 'x', C.canvas, true),
|
|
|
|
|
|
...cot(-s * 0.45, s * 0.55, s),
|
|
|
|
|
|
...cot(s * 0.15, s * 0.6, s, C.cloth),
|
|
|
|
|
|
...bandages(s * 0.8, -s * 0.15, s),
|
|
|
|
|
|
...barrel(s * 0.72, s * 0.62, s),
|
|
|
|
|
|
...fire(s * 0.6, -s * 0.72, s),
|
|
|
|
|
|
...blood(s * 0.42, s * 0.25, s * 0.1, 31),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 0.8,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...house(-s * 0.15, -s * 0.3, s * 1.45, s * 0.8, s * 0.5, s * 0.45, C.wood, C.thatch, 'x'),
|
|
|
|
|
|
...leanTo(-s * 0.8, s * 0.45, s * 0.1, s * 0.45, s * 0.42, s * 0.3, s, C.thatch),
|
|
|
|
|
|
...cot(-s * 0.5, s * 0.7, s),
|
|
|
|
|
|
...cot(s * 0.1, s * 0.72, s, C.cloth),
|
|
|
|
|
|
...bandages(s * 0.85, -s * 0.2, s),
|
|
|
|
|
|
...herbs(s * 0.65, s * 0.62, s * 0.4, s * 0.32),
|
|
|
|
|
|
...barrel(s * 0.85, -s * 0.72, s),
|
|
|
|
|
|
...blood(s * 0.5, s * 0.25, s * 0.1, 32),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.1,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
const bell: Face[] = [
|
|
|
|
|
|
...box(-s * 0.55, -s * 0.25, s * 0.2, s * 0.2, s * 0.95, s * 0.35, C.stone),
|
|
|
|
|
|
...pyramid(rect(-s * 0.55, -s * 0.25, s * 0.28, s * 0.28), s * 1.3, s * 0.25, C.slate),
|
|
|
|
|
|
]
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...house(-s * 0.15, -s * 0.25, s * 1.6, s * 0.95, s * 0.65, s * 0.5, C.stone, C.slate, 'x'),
|
|
|
|
|
|
...bell,
|
|
|
|
|
|
...leanTo(-s * 0.85, s * 0.55, s * 0.24, s * 0.55, s * 0.55, s * 0.4, s, C.shingle),
|
|
|
|
|
|
...cot(-s * 0.6, s * 0.78, s),
|
|
|
|
|
|
...cot(-s * 0.05, s * 0.8, s, C.cloth),
|
|
|
|
|
|
...bandages(s * 0.9, -s * 0.3, s),
|
|
|
|
|
|
...herbs(s * 0.68, s * 0.65, s * 0.45, s * 0.38),
|
|
|
|
|
|
...fence([[s * 0.43, s * 0.88], [s * 0.93, s * 0.88], [s * 0.93, s * 0.42]], s * 0.2, s * 0.02),
|
|
|
|
|
|
...barrel(s * 0.95, -s * 0.8, s),
|
|
|
|
|
|
...barrel(s * 0.78, -s * 0.85, s),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.55,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-10-31 10:07:33 +00:00
|
|
|
|
|
|
|
|
|
|
// The market square, trodden to mud: stalls under faded striped awnings, a cart with
|
|
|
|
|
|
// its load, crates and barrels. A merchant's hut first; then a counting house with an
|
|
|
|
|
|
// open hall, a horse at the cart and the pillory; then a stone guild hall on a paved
|
|
|
|
|
|
// square with three stalls.
|
|
|
|
|
|
market(s, t) {
|
|
|
|
|
|
const faded = mix(C.banner, C.canvas, 0.45)
|
|
|
|
|
|
const moss = mix(C.leaf, C.canvas, 0.35)
|
|
|
|
|
|
const square = (r: number, seed: number, ground = mix(C.soil, C.furrow, 0.35)): Face[] => [
|
|
|
|
|
|
blot(0, s * 0.05, r, 11, seed, 0.5, ground),
|
|
|
|
|
|
blot(s * 0.3, s * 0.5, s * 0.16, 7, seed + 1, 0.6, mix(C.water, C.soil, 0.35)),
|
|
|
|
|
|
blot(-s * 0.1, s * 0.05, s * 0.13, 6, seed + 2, 0.55, mix(C.hay, C.soil, 0.45)),
|
|
|
|
|
|
]
|
|
|
|
|
|
const sacks = (k: number) => [...sack(-k * 0.35, -k * 0.18, k * 2.4), ...sack(k * 0.05, k * 0.2, k * 2.4), ...sack(k * 0.4, -k * 0.12, k * 2.2)]
|
|
|
|
|
|
const crates = (k: number) => [...crate(-k * 0.35, 0, 0, k * 0.45), ...crate(k * 0.2, -k * 0.1, 0, k * 0.42), ...crate(-k * 0.3, 0, k * 0.45, k * 0.38)]
|
|
|
|
|
|
const stack = (x: number, y: number): Face[] => [...crate(x, y, 0, s * 0.15), ...crate(x, y, s * 0.15, s * 0.12), ...crate(x - s * 0.17, y + s * 0.04, 0, s * 0.13)]
|
|
|
|
|
|
if (t === 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...square(s * 1.05, 41),
|
|
|
|
|
|
...house(-s * 0.5, -s * 0.55, s * 0.7, s * 0.55, s * 0.4, s * 0.32, C.wood, C.thatch, 'y'),
|
|
|
|
|
|
...stallAt(s * 0.4, -s * 0.5, s, 'y', [C.canvas, faded], [C.wheat, C.leaf, C.clay]),
|
|
|
|
|
|
...stallAt(-s * 0.6, s * 0.35, s, 'x', [C.canvasDark, moss], [C.ore, C.wheat]),
|
|
|
|
|
|
...cart(s * 0.3, s * 0.38, s * 0.26, 1, sacks(s * 0.26)),
|
|
|
|
|
|
...stack(s * 0.88, -s * 0.05),
|
|
|
|
|
|
...barrel(s * 0.85, s * 0.25, s),
|
|
|
|
|
|
...person(s * 0.45, -s * 0.18, s, C.cloth),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 0.85,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (t === 2) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...square(s * 1.12, 42),
|
|
|
|
|
|
...house(-s * 0.6, -s * 0.55, s * 0.62, s * 0.7, s * 0.5, s * 0.36, C.plank, C.shingle, 'y'),
|
|
|
|
|
|
...hall(-s * 0.15, s * 0.85, -s * 0.92, -s * 0.38, s * 0.48, s * 0.3, s, C.thatch, [C.wheat, C.clay, C.ore, C.leaf]),
|
|
|
|
|
|
...stallAt(-s * 0.55, s * 0.4, s, 'x', [C.canvas, faded], [C.wheat, C.clay, C.leaf]),
|
|
|
|
|
|
...pillory(s * 0.1, s * 0.02, s),
|
|
|
|
|
|
...cart(s * 0.12, s * 0.62, s * 0.26, 0, crates(s * 0.26)),
|
|
|
|
|
|
...horse(s * 0.6, s * 0.62, s * 0.1, 0, C.bay),
|
|
|
|
|
|
...stack(s * 0.9, -s * 0.12),
|
|
|
|
|
|
...barrel(s * 0.62, -s * 0.15, s),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.0,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...square(s * 1.15, 43, mix(C.stoneDark, C.soil, 0.4)),
|
|
|
|
|
|
blot(-s * 0.2, s * 0.3, s * 0.45, 9, 47, 0.55, mix(C.soil, C.furrow, 0.35)),
|
|
|
|
|
|
...house(-s * 0.4, -s * 0.55, s * 1.15, s * 0.7, s * 0.62, s * 0.42, C.stone, C.slate, 'x'),
|
|
|
|
|
|
...stallAt(-s * 0.65, s * 0.35, s, 'y', [C.canvas, faded], [C.wheat, C.clay, C.leaf]),
|
|
|
|
|
|
...stallAt(-s * 0.05, s * 0.4, s, 'y', [C.canvasDark, moss], [C.ore, C.wheat]),
|
|
|
|
|
|
...stallAt(s * 0.75, -s * 0.15, s, 'x', [C.canvas, faded], [C.leaf, C.clay, C.wheat]),
|
|
|
|
|
|
...pillory(s * 0.85, s * 0.35, s),
|
|
|
|
|
|
...cart(s * 0.22, s * 0.75, s * 0.24, 0, sacks(s * 0.24)),
|
|
|
|
|
|
...horse(s * 0.66, s * 0.75, s * 0.09, 0, C.grey),
|
|
|
|
|
|
...stack(s * 0.5, -s * 0.85),
|
|
|
|
|
|
...barrel(s * 0.75, -s * 0.8, s),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.3,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-10-28 20:44:41 +00:00
|
|
|
|
|
|
|
|
|
|
// The academy (Adelshof): a stone manor with towers.
|
|
|
|
|
|
academy(s, t) {
|
|
|
|
|
|
const tower = (x: number, y: number, h: number): Face[] => [
|
|
|
|
|
|
...prism(ngon(x, y, s * 0.24, 6), 0, h, C.stone),
|
|
|
|
|
|
...pyramid(ngon(x, y, s * 0.3, 6), h, s * 0.4, C.slate),
|
|
|
|
|
|
]
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
|
|
|
|
|
...box(0, 0, s * 1.6, s * 1.3, 0, s * 0.9, C.stone, C.stoneDark),
|
2026-10-29 15:08:57 +00:00
|
|
|
|
...openings(0, 0, s * 1.6, s * 1.3, 0, s * 0.9, C.stone),
|
2026-10-28 20:44:41 +00:00
|
|
|
|
...pyramid(rect(0, 0, s * 1.75, s * 1.45), s * 0.9, s * 0.6, C.slate),
|
|
|
|
|
|
...tower(-s * 0.85, -s * 0.7, s * 1.5),
|
|
|
|
|
|
...tower(s * 0.85, s * 0.7, s * 1.5),
|
|
|
|
|
|
...banner(0, s * 0.75, s * 1.9, s * 0.6),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 1.9,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2026-10-28 19:33:13 +00:00
|
|
|
|
// The wall is drawn as the ring around the village, see scene.ts.
|
2026-10-28 18:54:20 +00:00
|
|
|
|
wall: () => ({ faces: [], height: 0 }),
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function buildingModel(type: BuildingType, level: number, s: number): Model {
|
|
|
|
|
|
return models[type](s, tier(level))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A queued new building: posts, planks and its outline on the ground. */
|
|
|
|
|
|
export function scaffold(s: number): Model {
|
|
|
|
|
|
const a = s * 0.6
|
|
|
|
|
|
return {
|
|
|
|
|
|
faces: [
|
2026-10-28 19:33:13 +00:00
|
|
|
|
plane(rect(0, 0, a * 2.1, a * 2.1).map(([x, y]) => [x, y, 0.5]), C.soil),
|
2026-10-28 18:54:20 +00:00
|
|
|
|
...post(-a, -a, s * 0.75, s * 0.035),
|
|
|
|
|
|
...post(a, -a, s * 0.75, s * 0.035),
|
|
|
|
|
|
...post(-a, a, s * 0.75, s * 0.035),
|
|
|
|
|
|
...post(a, a, s * 0.75, s * 0.035),
|
|
|
|
|
|
...box(0, a, a * 2.1, s * 0.05, s * 0.45, s * 0.05, C.plank),
|
|
|
|
|
|
...box(a, 0, s * 0.05, a * 2.1, s * 0.6, s * 0.05, C.plank),
|
|
|
|
|
|
...crate(-a * 0.3, a * 0.2, 0, s * 0.22),
|
|
|
|
|
|
],
|
|
|
|
|
|
height: s * 0.8,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** A small crane beside a building that is being upgraded or taken down. */
|
|
|
|
|
|
export function crane(s: number, height: number): Face[] {
|
|
|
|
|
|
const x = s * 0.85
|
|
|
|
|
|
const y = -s * 0.85
|
|
|
|
|
|
const h = height + s * 0.35
|
|
|
|
|
|
return [
|
|
|
|
|
|
...post(x, y, h, s * 0.045, C.woodDark),
|
|
|
|
|
|
...box(x - s * 0.3, y, s * 0.75, s * 0.06, h, s * 0.06, C.wood),
|
|
|
|
|
|
...box(x - s * 0.6, y, s * 0.02, s * 0.02, h - s * 0.4, s * 0.4, C.dark),
|
|
|
|
|
|
...crate(x - s * 0.6, y, h - s * 0.55, s * 0.14),
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|