feat: building portraits, screen headers and a livelier village: shadows, smoke, walkers, a pond
Each building screen opens with the building drawn as it stands, its level and what it
does; the HQ list and the building cards show the same portraits. In the village,
buildings and trees cast flat shadows, chimneys, forges and kilns smoke, villagers walk
the roads to the zones they work in (more where more work), and a pond lies in the
meadow. Motion stops for players who prefer reduced motion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:46:15 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import type { BuildingType } from '~/types/game'
|
|
|
|
|
import { mix, plane, project, toPolys, type V3 } from '~/diorama/iso'
|
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 { buildingModel, C } from '~/diorama/models'
|
feat: building portraits, screen headers and a livelier village: shadows, smoke, walkers, a pond
Each building screen opens with the building drawn as it stands, its level and what it
does; the HQ list and the building cards show the same portraits. In the village,
buildings and trees cast flat shadows, chimneys, forges and kilns smoke, villagers walk
the roads to the zones they work in (more where more work), and a pond lies in the
meadow. Motion stops for players who prefer reduced motion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:46:15 +00:00
|
|
|
|
|
|
|
|
const props = defineProps<{ type: BuildingType; level: number }>()
|
|
|
|
|
|
|
|
|
|
// The building as it stands in the village, on its own patch of grass: the same model
|
|
|
|
|
// and shading as the diorama, framed to its bounds.
|
|
|
|
|
const S = 24
|
|
|
|
|
const picture = computed(() => {
|
|
|
|
|
const model = buildingModel(props.type, Math.max(1, props.level), S)
|
|
|
|
|
const patch = Array.from({ length: 14 }, (_, i): V3 => {
|
|
|
|
|
const a = (i / 14) * Math.PI * 2
|
|
|
|
|
const r = S * (1.45 + 0.08 * Math.sin(i * 2.3))
|
|
|
|
|
return [Math.cos(a) * r, Math.sin(a) * r, 0]
|
|
|
|
|
})
|
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 ground = toPolys([plane(patch, C.grass)])
|
|
|
|
|
const rim = toPolys([plane(patch.map(([x, y]): V3 => [x * 1.06, y * 1.06, -3]), mix(C.grass, C.dark, 0.45))])
|
feat: building portraits, screen headers and a livelier village: shadows, smoke, walkers, a pond
Each building screen opens with the building drawn as it stands, its level and what it
does; the HQ list and the building cards show the same portraits. In the village,
buildings and trees cast flat shadows, chimneys, forges and kilns smoke, villagers walk
the roads to the zones they work in (more where more work), and a pond lies in the
meadow. Motion stops for players who prefer reduced motion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:46:15 +00:00
|
|
|
const polys = [...rim, ...ground, ...toPolys(model.faces)]
|
|
|
|
|
const pts = polys.flatMap((p) => p.points.split(' ').map((xy) => xy.split(',').map(Number) as [number, number]))
|
|
|
|
|
const top = project([0, 0, model.height])[1]
|
|
|
|
|
const xs = pts.map((p) => p[0])
|
|
|
|
|
const ys = [...pts.map((p) => p[1]), top]
|
|
|
|
|
const pad = 4
|
|
|
|
|
const x0 = Math.min(...xs) - pad
|
|
|
|
|
const y0 = Math.min(...ys) - pad
|
|
|
|
|
return { polys, viewBox: `${x0.toFixed(1)} ${y0.toFixed(1)} ${(Math.max(...xs) - x0 + pad).toFixed(1)} ${(Math.max(...ys) - y0 + pad).toFixed(1)}` }
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<svg :viewBox="picture.viewBox" class="block" aria-hidden="true">
|
|
|
|
|
<g stroke-width="0.6" stroke-linejoin="round">
|
|
|
|
|
<polygon v-for="(p, i) in picture.polys" :key="i" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
|
|
|
|
|
</g>
|
|
|
|
|
</svg>
|
|
|
|
|
</template>
|