fix: a grey day, not dusk: lighter worn colours, softer shadow sides, less darkening at the edges, in the village, close-ups and on the map

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fabian @ Blax Software 2026-10-30 10:35:47 +01:00
parent d8dd9aec07
commit 59b551c246
13 changed files with 136 additions and 136 deletions

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,7 @@ function onClick(e: MouseEvent) {
:aria-label="t('map.minimap')" :aria-label="t('map.minimap')"
@click="onClick" @click="onClick"
> >
<rect :width="size.w" :height="size.h" fill="#4b5033" /> <rect :width="size.w" :height="size.h" fill="#656a45" />
<line <line
v-for="(l, i) in lines" v-for="(l, i) in lines"
:key="i" :key="i"

View File

@ -9,10 +9,10 @@ const props = defineProps<{ tier: 1 | 2 | 3 | 4 | 5; relation: MapRelation; crow
// faces and a two-facet roof, so it reads as 3D like the village diorama. // faces and a two-facet roof, so it reads as 3D like the village diorama.
const tones = computed(() => const tones = computed(() =>
props.relation === 'barbarian' props.relation === 'barbarian'
? { wallLight: '#948e83', wallDark: '#6c675f', roofLight: '#5a544c', roofDark: '#403b35' } ? { wallLight: '#aaa498', wallDark: '#827d74', roofLight: '#6e685f', roofDark: '#524c45' }
: { wallLight: '#9f8f72', wallDark: '#76684f', roofLight: '#6b3826', roofDark: '#4a2619' }, : { wallLight: '#b5a486', wallDark: '#8b7c62', roofLight: '#7f4430', roofDark: '#5a3020' },
) )
const STONE = { wallLight: '#858078', wallDark: '#5f5b55', roofLight: '#464a50', roofDark: '#33363b' } const STONE = { wallLight: '#9d988f', wallDark: '#77736c', roofLight: '#5a5f66', roofDark: '#45494f' }
const flag = computed(() => ({ own: '#d9b44a', player: '#962a1f', barbarian: '#8b9094' })[props.relation]) const flag = computed(() => ({ own: '#d9b44a', player: '#962a1f', barbarian: '#8b9094' })[props.relation])
interface Block { interface Block {
@ -91,7 +91,7 @@ const pole = computed(() => {
<template> <template>
<g> <g>
<ellipse cx="50" cy="72" rx="42" ry="18" fill="#463f2e" /> <ellipse cx="50" cy="72" rx="42" ry="18" fill="#5f5640" />
<g v-for="(b, i) in blocks" :key="i"> <g v-for="(b, i) in blocks" :key="i">
<polygon :points="faces(b).left" :fill="faces(b).colors.wallDark" /> <polygon :points="faces(b).left" :fill="faces(b).colors.wallDark" />
<polygon :points="faces(b).right" :fill="faces(b).colors.wallLight" /> <polygon :points="faces(b).right" :fill="faces(b).colors.wallLight" />
@ -100,16 +100,16 @@ const pole = computed(() => {
</g> </g>
<!-- A town's palisade or a keep's stone wall along the front of the ring. --> <!-- A town's palisade or a keep's stone wall along the front of the ring. -->
<g v-if="tier === 4"> <g v-if="tier === 4">
<rect v-for="(p, i) in ring" :key="i" :x="p.x - 2" :y="p.y - 9" width="4" height="10" :fill="i % 2 ? '#3f3127' : '#5f4b38'" /> <rect v-for="(p, i) in ring" :key="i" :x="p.x - 2" :y="p.y - 9" width="4" height="10" :fill="i % 2 ? '#574536' : '#7a6249'" />
</g> </g>
<g v-else-if="tier === 5"> <g v-else-if="tier === 5">
<polygon <polygon
v-for="(p, i) in ring.slice(0, -1)" v-for="(p, i) in ring.slice(0, -1)"
:key="i" :key="i"
:points="pts(p.x, p.y, ring[i + 1]!.x, ring[i + 1]!.y, ring[i + 1]!.x, ring[i + 1]!.y - 10, p.x, p.y - 10)" :points="pts(p.x, p.y, ring[i + 1]!.x, ring[i + 1]!.y, ring[i + 1]!.x, ring[i + 1]!.y - 10, p.x, p.y - 10)"
:fill="i % 2 ? '#5f5b55' : '#77736b'" :fill="i % 2 ? '#77736c' : '#928d84'"
/> />
<rect v-for="i in [0, 7, 14]" :key="`t${i}`" :x="ring[i]!.x - 4" :y="ring[i]!.y - 16" width="8" height="16" fill="#5a5751" /> <rect v-for="i in [0, 7, 14]" :key="`t${i}`" :x="ring[i]!.x - 4" :y="ring[i]!.y - 16" width="8" height="16" fill="#74716a" />
</g> </g>
<line :x1="pole.x" :y1="pole.y" :x2="pole.x" :y2="pole.y - 20" stroke="#4a3b2e" stroke-width="2" /> <line :x1="pole.x" :y1="pole.y" :x2="pole.x" :y2="pole.y - 20" stroke="#4a3b2e" stroke-width="2" />
<polygon :points="pts(pole.x, pole.y - 20, pole.x + 15, pole.y - 15, pole.x, pole.y - 10)" :fill="flag" stroke="#2b2118" stroke-width="0.8" /> <polygon :points="pts(pole.x, pole.y - 20, pole.x + 15, pole.y - 15, pole.x, pole.y - 10)" :fill="flag" stroke="#2b2118" stroke-width="0.8" />

View File

@ -40,8 +40,8 @@ const hash = (x: number, y: number) => {
h = Math.imul(h ^ (h >>> 13), 1274126177) h = Math.imul(h ^ (h >>> 13), 1274126177)
return ((h ^ (h >>> 16)) >>> 0) / 4294967296 return ((h ^ (h >>> 16)) >>> 0) / 4294967296
} }
const GRASS = ['#535838', '#4f5435', '#575a3b', '#5a573a'] const GRASS = ['#6b7049', '#676c46', '#6f724c', '#73704b']
const WATER = '#2f3b3c' const WATER = '#4a5b5d'
/** Smooth value noise: neighbouring fields get similar values, so terrain comes in patches. */ /** Smooth value noise: neighbouring fields get similar values, so terrain comes in patches. */
const smooth = (t: number) => t * t * (3 - 2 * t) const smooth = (t: number) => t * t * (3 - 2 * t)
@ -238,7 +238,7 @@ function onKey(e: KeyboardEvent) {
</clipPath> </clipPath>
</defs> </defs>
<rect :width="width" :height="height" fill="#3d4228" /> <rect :width="width" :height="height" fill="#585e3c" />
<g clip-path="url(#map-fields)"> <g clip-path="url(#map-fields)">
<!-- Fields sit at their world position; panning only moves this group. --> <!-- Fields sit at their world position; panning only moves this group. -->
@ -248,24 +248,24 @@ function onKey(e: KeyboardEvent) {
<g v-if="f.ground !== 'grass'" :transform="`translate(${f.x * field} ${f.y * field}) scale(${field / 100})`"> <g v-if="f.ground !== 'grass'" :transform="`translate(${f.x * field} ${f.y * field}) scale(${field / 100})`">
<template v-if="f.shore"> <template v-if="f.shore">
<!-- Sandy shore where the lake meets land, and a ripple. --> <!-- Sandy shore where the lake meets land, and a ripple. -->
<rect v-if="f.shore.top" x="0" y="0" width="100" height="9" fill="#5a4c38" /> <rect v-if="f.shore.top" x="0" y="0" width="100" height="9" fill="#7a6a50" />
<rect v-if="f.shore.bottom" x="0" y="91" width="100" height="9" fill="#5a4c38" /> <rect v-if="f.shore.bottom" x="0" y="91" width="100" height="9" fill="#7a6a50" />
<rect v-if="f.shore.left" x="0" y="0" width="9" height="100" fill="#5a4c38" /> <rect v-if="f.shore.left" x="0" y="0" width="9" height="100" fill="#7a6a50" />
<rect v-if="f.shore.right" x="91" y="0" width="9" height="100" fill="#5a4c38" /> <rect v-if="f.shore.right" x="91" y="0" width="9" height="100" fill="#7a6a50" />
<path :d="`M${28 + hash(f.x, f.y) * 30} 50h18M${40 + hash(f.y, f.x) * 20} 64h12`" stroke="#45545a" stroke-width="3" stroke-linecap="round" /> <path :d="`M${28 + hash(f.x, f.y) * 30} 50h18M${40 + hash(f.y, f.x) * 20} 64h12`" stroke="#6a7a80" stroke-width="3" stroke-linecap="round" />
</template> </template>
<g v-else-if="f.ground === 'hill'"> <g v-else-if="f.ground === 'hill'">
<ellipse cx="52" cy="70" rx="40" ry="16" fill="#464a31" /> <ellipse cx="52" cy="70" rx="40" ry="16" fill="#5d6242" />
<polygon points="18,72 40,30 58,72" fill="#6b675f" /> <polygon points="18,72 40,30 58,72" fill="#8a857c" />
<polygon points="40,30 58,72 64,60" fill="#46443f" /> <polygon points="40,30 58,72 64,60" fill="#5f5c56" />
<polygon points="48,74 68,42 86,74" fill="#7a766e" /> <polygon points="48,74 68,42 86,74" fill="#9a958c" />
<polygon points="68,42 86,74 90,66" fill="#504d47" /> <polygon points="68,42 86,74 90,66" fill="#6c6962" />
</g> </g>
<g v-for="(tr, i) in f.trees" :key="i" :transform="`translate(${tr[0]} ${tr[1]}) scale(${tr[2]})`"> <g v-for="(tr, i) in f.trees" :key="i" :transform="`translate(${tr[0]} ${tr[1]}) scale(${tr[2]})`">
<ellipse cx="4" cy="26" rx="12" ry="4" fill="#3c4128" /> <ellipse cx="4" cy="26" rx="12" ry="4" fill="#4f5535" />
<rect x="-2" y="18" width="4" height="9" fill="#352a21" /> <rect x="-2" y="18" width="4" height="9" fill="#4a3b2e" />
<polygon points="0,-10 -13,20 0,16" fill="#1d271b" /> <polygon points="0,-10 -13,20 0,16" fill="#2b3a27" />
<polygon points="0,-10 13,20 0,16" fill="#2c3925" /> <polygon points="0,-10 13,20 0,16" fill="#3e5034" />
</g> </g>
</g> </g>
</g> </g>

View File

@ -18,22 +18,22 @@ const peck = computed(() => (props.kind === 'chicken' ? 0.7 : 2.2))
<g> <g>
<g :transform="`scale(${size})`"> <g :transform="`scale(${size})`">
<template v-if="kind === 'sheep'"> <template v-if="kind === 'sheep'">
<path d="M-1 -0.9h0.6V0h-0.6zM1.2 -0.9h0.6V0h-0.6z" fill="#211c18" /> <path d="M-1 -0.9h0.6V0h-0.6zM1.2 -0.9h0.6V0h-0.6z" fill="#2e2722" />
<path d="M-2.2 -3.4Q-2.4 -1 -0.6 -0.7H2Q3 -1.6 2.4 -3.4Q0.2 -4.6 -2.2 -3.4z" fill="#9b9483" /> <path d="M-2.2 -3.4Q-2.4 -1 -0.6 -0.7H2Q3 -1.6 2.4 -3.4Q0.2 -4.6 -2.2 -3.4z" fill="#b5ae9c" />
<path d="M0.2 -0.7H2Q3 -1.6 2.4 -3.4Q1.4 -3.9 0.2 -3.9z" fill="#7f796b" /> <path d="M0.2 -0.7H2Q3 -1.6 2.4 -3.4Q1.4 -3.9 0.2 -3.9z" fill="#968f80" />
<g> <g>
<animateTransform attributeName="transform" type="rotate" :values="`0 2.2 -2.6;28 2.2 -2.6;28 2.2 -2.6;0 2.2 -2.6;0 2.2 -2.6`" keyTimes="0;0.15;0.6;0.75;1" :dur="`${peck}s`" :begin="`${begin}s`" repeatCount="indefinite" /> <animateTransform attributeName="transform" type="rotate" :values="`0 2.2 -2.6;28 2.2 -2.6;28 2.2 -2.6;0 2.2 -2.6;0 2.2 -2.6`" keyTimes="0;0.15;0.6;0.75;1" :dur="`${peck}s`" :begin="`${begin}s`" repeatCount="indefinite" />
<path d="M2.1 -3.3L3.7 -3.1L3.6 -1.9L2.3 -2.1z" fill="#211c18" /> <path d="M2.1 -3.3L3.7 -3.1L3.6 -1.9L2.3 -2.1z" fill="#2e2722" />
</g> </g>
</template> </template>
<template v-else> <template v-else>
<path d="M-0.3 -0.8h0.3V0h-0.3zM0.4 -0.8h0.3V0h-0.3z" fill="#8a6c32" /> <path d="M-0.3 -0.8h0.3V0h-0.3zM0.4 -0.8h0.3V0h-0.3z" fill="#a07e3a" />
<path d="M-1.4 -2.6Q-1.2 -0.7 0.4 -0.8Q1.4 -1.2 1.2 -2.2Q0 -3.2 -1.4 -2.6z" fill="#6e5236" /> <path d="M-1.4 -2.6Q-1.2 -0.7 0.4 -0.8Q1.4 -1.2 1.2 -2.2Q0 -3.2 -1.4 -2.6z" fill="#86663f" />
<g> <g>
<animateTransform attributeName="transform" type="rotate" values="0 1 -2.2;40 1 -2.2;0 1 -2.2;0 1 -2.2" keyTimes="0;0.2;0.4;1" :dur="`${peck}s`" :begin="`${begin}s`" repeatCount="indefinite" /> <animateTransform attributeName="transform" type="rotate" values="0 1 -2.2;40 1 -2.2;0 1 -2.2;0 1 -2.2" keyTimes="0;0.2;0.4;1" :dur="`${peck}s`" :begin="`${begin}s`" repeatCount="indefinite" />
<path d="M0.8 -3.4L1.7 -3.2L1.6 -2.2L0.9 -2.3z" fill="#6e5236" /> <path d="M0.8 -3.4L1.7 -3.2L1.6 -2.2L0.9 -2.3z" fill="#86663f" />
<path d="M1.7 -3L2.3 -2.7L1.7 -2.5z" fill="#8a6c32" /> <path d="M1.7 -3L2.3 -2.7L1.7 -2.5z" fill="#a07e3a" />
<path d="M0.9 -3.6L1.4 -3.9L1.4 -3.3z" fill="#6e1c14" /> <path d="M0.9 -3.6L1.4 -3.9L1.4 -3.3z" fill="#7e2218" />
</g> </g>
</template> </template>
</g> </g>

View File

@ -38,7 +38,7 @@ onMounted(() => (motion.value = !window.matchMedia('(prefers-reduced-motion: red
<!-- The building up close, its workers walking between it and where they work. --> <!-- The building up close, its workers walking between it and where they work. -->
<template> <template>
<div ref="stage" class="h-full w-full overflow-hidden bg-[#4f5436]"> <div ref="stage" class="h-full w-full overflow-hidden bg-[#6a7049]">
<svg class="block h-full w-full select-none" :viewBox="scene.viewBox" preserveAspectRatio="xMidYMid slice" aria-hidden="true"> <svg class="block h-full w-full select-none" :viewBox="scene.viewBox" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<g stroke-width="0.6" stroke-linejoin="round"> <g stroke-width="0.6" stroke-linejoin="round">
<polygon v-for="(p, i) in scene.terrain" :key="`t${i}`" :points="p.points" :fill="p.fill" :stroke="p.stroke" /> <polygon v-for="(p, i) in scene.terrain" :key="`t${i}`" :points="p.points" :fill="p.fill" :stroke="p.stroke" />

View File

@ -149,7 +149,7 @@ const timers = computed(() => {
</script> </script>
<template> <template>
<div ref="scroller" class="h-full w-full overflow-y-hidden bg-[#4f5436]" :class="fill ? 'overflow-x-hidden' : 'overflow-x-auto'"> <div ref="scroller" class="h-full w-full overflow-y-hidden bg-[#6a7049]" :class="fill ? 'overflow-x-hidden' : 'overflow-x-auto'">
<div ref="stage" class="h-full" :class="fill ? '' : 'min-w-[640px]'"> <div ref="stage" class="h-full" :class="fill ? '' : 'min-w-[640px]'">
<svg <svg
class="block h-full w-full select-none" class="block h-full w-full select-none"

View File

@ -28,8 +28,8 @@ const toolDur = computed(() => `${props.cycle?.dur ?? props.swing?.dur ?? 1}s`)
/** Rotation values about the shoulder, where the hand holds the tool. */ /** Rotation values about the shoulder, where the hand holds the tool. */
const swingValues = computed(() => toolSwing.value?.values.split(';').map((a) => `${a} 1.1 -6.4`).join(';') ?? '') const swingValues = computed(() => toolSwing.value?.values.split(';').map((a) => `${a} 1.1 -6.4`).join(';') ?? '')
const METAL = '#6e7376' const METAL = '#868b8e'
const HANDLE = '#4a3a2c' const HANDLE = '#5f4c3a'
const HEADS: Record<Tool, string> = { const HEADS: Record<Tool, string> = {
axe: 'M3.3 -11.4L5.5 -10.5L5 -9.3L3.6 -10.1z', axe: 'M3.3 -11.4L5.5 -10.5L5 -9.3L3.6 -10.1z',
pick: 'M2.1 -11.7L5.7 -10.1L5.4 -9.7L3.8 -10.5L2.3 -11.1z', pick: 'M2.1 -11.7L5.7 -10.1L5.4 -9.7L3.8 -10.5L2.3 -11.1z',
@ -67,21 +67,21 @@ const HEADS: Record<Tool, string> = {
:begin="begin" :begin="begin"
repeatCount="indefinite" repeatCount="indefinite"
/> />
<rect x="-1.5" y="-2.4" width="1.2" height="2.4" fill="#2c2620"> <rect x="-1.5" y="-2.4" width="1.2" height="2.4" fill="#3a322a">
<animateTransform v-if="cycle" attributeName="transform" type="translate" :values="cycle.step.values" :keyTimes="cycle.step.keyTimes" :dur="`${cycle.dur}s`" :begin="begin" repeatCount="indefinite" /> <animateTransform v-if="cycle" attributeName="transform" type="translate" :values="cycle.step.values" :keyTimes="cycle.step.keyTimes" :dur="`${cycle.dur}s`" :begin="begin" repeatCount="indefinite" />
</rect> </rect>
<rect x="0.3" y="-2.4" width="1.2" height="2.4" fill="#221d18"> <rect x="0.3" y="-2.4" width="1.2" height="2.4" fill="#2f2822">
<animateTransform v-if="cycle" attributeName="transform" type="translate" :values="cycle.step.mirrored" :keyTimes="cycle.step.keyTimes" :dur="`${cycle.dur}s`" :begin="begin" repeatCount="indefinite" /> <animateTransform v-if="cycle" attributeName="transform" type="translate" :values="cycle.step.mirrored" :keyTimes="cycle.step.keyTimes" :dur="`${cycle.dur}s`" :begin="begin" repeatCount="indefinite" />
</rect> </rect>
<path d="M-1.9 -6.9L0 -7.3V-2.2H-1.7z" :fill="shirt" /> <path d="M-1.9 -6.9L0 -7.3V-2.2H-1.7z" :fill="shirt" />
<path d="M0 -7.3L1.9 -6.9L1.7 -2.2H0z" :fill="shirtShade" /> <path d="M0 -7.3L1.9 -6.9L1.7 -2.2H0z" :fill="shirtShade" />
<circle cy="-8.9" r="1.65" fill="#a98a72" /> <circle cy="-8.9" r="1.65" fill="#be9d82" />
<template v-if="soldier"> <template v-if="soldier">
<path d="M-1.85 -9Q-1.8 -11.2 0 -11.3Q1.8 -11.2 1.85 -9z" :fill="METAL" /> <path d="M-1.85 -9Q-1.8 -11.2 0 -11.3Q1.8 -11.2 1.85 -9z" :fill="METAL" />
<path d="M0 -11.3Q1.8 -11.2 1.85 -9H0z" fill="#4f5356" /> <path d="M0 -11.3Q1.8 -11.2 1.85 -9H0z" fill="#62676a" />
<path d="M0.75 -9H1.15V-7.9H0.75z" fill="#4f5356" /> <path d="M0.75 -9H1.15V-7.9H0.75z" fill="#62676a" />
</template> </template>
<path v-else d="M-1.7 -9.1Q0 -11.5 1.7 -9.1Q0 -9.9 -1.7 -9.1z" fill="#2a211a" /> <path v-else d="M-1.7 -9.1Q0 -11.5 1.7 -9.1Q0 -9.9 -1.7 -9.1z" fill="#3a2e24" />
<g v-if="tool"> <g v-if="tool">
<animateTransform <animateTransform
@ -100,9 +100,9 @@ const HEADS: Record<Tool, string> = {
</g> </g>
<g v-if="soldier"> <g v-if="soldier">
<path d="M-0.1 -6.9H2.5V-4.7Q2.5 -3.1 1.2 -2.1Q-0.1 -3.1 -0.1 -4.7z" fill="#5e1813" /> <path d="M-0.1 -6.9H2.5V-4.7Q2.5 -3.1 1.2 -2.1Q-0.1 -3.1 -0.1 -4.7z" fill="#6e1d16" />
<path d="M1.2 -6.9H2.5V-4.7Q2.5 -3.1 1.2 -2.1z" fill="#3f100d" /> <path d="M1.2 -6.9H2.5V-4.7Q2.5 -3.1 1.2 -2.1z" fill="#4f140f" />
<path d="M1 -6.9H1.4V-2.3L1.2 -2.1L1 -2.3z" fill="#7d735f" /> <path d="M1 -6.9H1.4V-2.3L1.2 -2.1L1 -2.3z" fill="#9a8f78" />
</g> </g>
<g v-if="carry" :visibility="cycle ? 'hidden' : 'visible'"> <g v-if="carry" :visibility="cycle ? 'hidden' : 'visible'">

View File

@ -55,12 +55,12 @@ export interface CloseupState {
type Kind = 'timber' | 'clay' | 'iron' | 'farm' | 'wall' | 'core' type Kind = 'timber' | 'clay' | 'iron' | 'farm' | 'wall' | 'core'
const KIND: Partial<Record<BuildingType, Kind>> = { timber_camp: 'timber', clay_pit: 'clay', iron_mine: 'iron', farm: 'farm', wall: 'wall' } const KIND: Partial<Record<BuildingType, Kind>> = { timber_camp: 'timber', clay_pit: 'clay', iron_mine: 'iron', farm: 'farm', wall: 'wall' }
const GROUND: Record<Kind, string> = { const GROUND: Record<Kind, string> = {
timber: '#554a33', timber: '#716345',
clay: '#5f3f2c', clay: '#7d543b',
iron: '#55524c', iron: '#716d66',
farm: '#4f5436', farm: '#6a7049',
wall: '#463829', wall: '#5e4c38',
core: '#564533', core: '#735e45',
} }
/** What a worker carries home: logs, clay, ore, sheaves; core buildings move crates. */ /** What a worker carries home: logs, clay, ore, sheaves; core buildings move crates. */
const CARRY: Record<Kind, string | null> = { timber: C.wood, clay: C.clay, iron: C.ore, farm: C.wheat, wall: null, core: C.plank } const CARRY: Record<Kind, string | null> = { timber: C.wood, clay: C.clay, iron: C.ore, farm: C.wheat, wall: null, core: C.plank }
@ -100,7 +100,7 @@ export function buildCloseup(type: BuildingType, level: number, workers: number,
objects.push({ key: 'building', depth: 0, polys: toPolys(model.faces) }) objects.push({ key: 'building', depth: 0, polys: toPolys(model.faces) })
const doorFace = model.faces.find((f) => f.color === DOOR) const doorFace = model.faces.find((f) => f.color === DOOR)
if (doorFace) door = [doorFace.pts.reduce((n, p) => n + p[0], 0) / doorFace.pts.length + U * 0.3, doorFace.pts.reduce((n, p) => n + p[1], 0) / doorFace.pts.length] if (doorFace) door = [doorFace.pts.reduce((n, p) => n + p[0], 0) / doorFace.pts.length + U * 0.3, doorFace.pts.reduce((n, p) => n + p[1], 0) / doorFace.pts.length]
shadows.push(shadow(0, 0, S * 0.95, scale(GROUND[kind], 0.68), 3)) shadows.push(shadow(0, 0, S * 0.95, scale(GROUND[kind], 0.8), 3))
} }
if (kind === 'timber') { if (kind === 'timber') {
@ -157,7 +157,7 @@ export function buildCloseup(type: BuildingType, level: number, workers: number,
const size = U * (1.0 + 0.5 * hash(i, j, 65)) const size = U * (1.0 + 0.5 * hash(i, j, 65))
const seed = i * 131 + j const seed = i * 131 + j
const faces = kindRoll < 0.15 ? bush(x, y, size * 0.8, seed) : kindRoll < 0.68 ? conifer(x, y, size, seed) : kindRoll < 0.76 ? deadTree(x, y, size, seed) : broadleaf(x, y, size, seed) const faces = kindRoll < 0.15 ? bush(x, y, size * 0.8, seed) : kindRoll < 0.68 ? conifer(x, y, size, seed) : kindRoll < 0.76 ? deadTree(x, y, size, seed) : broadleaf(x, y, size, seed)
put(`t${i}:${j}`, x, y, faces.map((face) => ({ ...face, color: fade(face.color, r, S * 3, S * 6.5, 0.4) })), size * 0.3) put(`t${i}:${j}`, x, y, faces.map((face) => ({ ...face, color: fade(face.color, r, S * 3, S * 6.5, 0.2) })), size * 0.3)
} }
} }

View File

@ -91,15 +91,15 @@ export function mix(a: string, b: string, t: number): string {
} }
/** What faces turned away from the light sink towards: a cold, overcast dark. */ /** What faces turned away from the light sink towards: a cold, overcast dark. */
const COLD = '#1c2128' const COLD = '#2a3038'
/** /**
* Light from the upper left under an overcast sky: tops keep their colour, faces turned * Daylight from the upper left under an overcast sky: tops keep their colour, faces turned
* away from the light drop to half and go cold, so the shadow side reads hard and grey. * away from the light drop to two thirds and cool a little, so the shadow side reads grey.
*/ */
function shade(color: string, n: V3): string { function shade(color: string, n: V3): string {
const lit = Math.min(1.05, Math.max(0, dot(n, LIGHT)) / LIGHT_TOP) const lit = Math.min(1.05, Math.max(0, dot(n, LIGHT)) / LIGHT_TOP)
return mix(scale(color, 0.5 + 0.5 * lit), COLD, (1 - Math.min(1, lit)) * 0.22) return mix(scale(color, 0.64 + 0.38 * lit), COLD, (1 - Math.min(1, lit)) * 0.12)
} }
/** Deterministic 0..1 noise for stable variety (same input, same output). */ /** Deterministic 0..1 noise for stable variety (same input, same output). */
@ -150,17 +150,17 @@ export function orient(pts: V3[], inside: V3): V3[] {
// Shapes. Bases are counter-clockwise seen from above. // Shapes. Bases are counter-clockwise seen from above.
const STONE = '#6f6a62' const STONE = '#8a857c'
/** Doors are this colour; the scene finds a building's door by it. */ /** Doors are this colour; the scene finds a building's door by it. */
export const DOOR = '#33261c' export const DOOR = '#45342a'
const WINDOW = '#141110' const WINDOW = '#1c1815'
/** Wet earth splashed up the foot of the walls. */ /** Wet earth splashed up the foot of the walls. */
const MUD = '#3b3024' const MUD = '#4f4131'
/** Rot and moss on old roofs. */ /** Rot and moss on old roofs. */
const ROT = '#2c3022' const ROT = '#3a4030'
/** Door and window frames: the wall's wood, worn a little paler. */ /** Door and window frames: the wall's wood, worn a little paler. */
export const trim = (walls: string) => mix(walls, '#958a74', 0.3) export const trim = (walls: string) => mix(walls, '#a89c84', 0.3)
export function rect(cx: number, cy: number, w: number, d: number): V2[] { export function rect(cx: number, cy: number, w: number, d: number): V2[] {
return [ return [
@ -301,7 +301,7 @@ export function framing(cx: number, cy: number, w: number, d: number, z0: number
} }
/** C.stone and C.stoneDark in models.ts, and the plinth: stone walls carry no beams. */ /** C.stone and C.stoneDark in models.ts, and the plinth: stone walls carry no beams. */
const STONE_WALLS = new Set(['#77736b', '#5a5751', STONE]) const STONE_WALLS = new Set(['#928d84', '#74716a', STONE])
/** Mud splashed up the two walls in view, just above the plinth, under the beams. */ /** Mud splashed up the two walls in view, just above the plinth, under the beams. */
export function mudline(cx: number, cy: number, w: number, d: number, z0: number, h: number, walls: string): Face[] { export function mudline(cx: number, cy: number, w: number, d: number, z0: number, h: number, walls: string): Face[] {

View File

@ -12,64 +12,64 @@ import { box, cylinder, DOOR, type Face, framing, gable, gambrel, hash, house, l
* only warm colours are fire and blood. * only warm colours are fire and blood.
*/ */
export const C = { export const C = {
wood: '#5f4b38', wood: '#7a6249',
woodDark: '#3f3127', woodDark: '#574536',
plank: '#746149', plank: '#8f7a5d',
thatch: '#776847', thatch: '#948258',
canvas: '#8f8571', canvas: '#ada38c',
canvasDark: '#73695a', canvasDark: '#8f8572',
roofRed: '#5c3528', roofRed: '#764535',
slate: '#3a3e44', slate: '#545a61',
stone: '#77736b', stone: '#928d84',
stoneDark: '#5a5751', stoneDark: '#74716a',
field: '#474e31', field: '#626b45',
wheat: '#76693f', wheat: '#958653',
furrow: '#43382a', furrow: '#5c4d3b',
soil: '#45372a', soil: '#5e4b39',
leaf: '#3a4429', leaf: '#4d5a37',
leafDark: '#2f3822', leafDark: '#404b2e',
trunk: '#352a21', trunk: '#4a3b2e',
clay: '#7a4d35', clay: '#94603f',
clayDark: '#5a3827', clayDark: '#734a33',
clayWet: '#4f3324', clayWet: '#66432f',
rock: '#57544e', rock: '#75716a',
ore: '#393f45', ore: '#4c535a',
fire: '#c96f26', fire: '#c96f26',
banner: '#5e1813', banner: '#6e1d16',
hay: '#857449', hay: '#a08d5a',
cloth: '#4a3e33', cloth: '#62544a',
skin: '#a98a72', skin: '#be9d82',
dark: '#1b1714', dark: '#241f1b',
grass: '#4f5337', grass: '#6a7049',
conifer: '#243021', conifer: '#33432d',
coniferDark: '#1d271b', coniferDark: '#2b3a27',
broadleaf: '#3b4229', broadleaf: '#525c38',
broadleafDark: '#333a24', broadleafDark: '#465030',
bush: '#373e26', bush: '#4d5636',
barn: '#552f24', barn: '#6e3d2e',
shingle: '#47392d', shingle: '#5f4c3c',
metal: '#6e7376', metal: '#868b8e',
water: '#2f3b3c', water: '#4a5b5d',
chestnut: '#5a3721', chestnut: '#6f4429',
bay: '#3a281b', bay: '#4c3524',
grey: '#7d786f', grey: '#958f85',
/** Dried blood on the ground, and fresh. */ /** Dried blood on the ground, and fresh. */
blood: '#4a1410', blood: '#5a1812',
bloodFresh: '#6b1a12', bloodFresh: '#7a1e14',
/** Burnt timber and the ash round it. */ /** Burnt timber and the ash round it. */
char: '#1f1b18', char: '#2a2521',
ash: '#45413b', ash: '#5f5a53',
/** Bare dead wood and the pale cut of a stump. */ /** Bare dead wood and the pale cut of a stump. */
deadWood: '#4b4239', deadWood: '#655a4e',
cut: '#8a7a5d', cut: '#a8977a',
crow: '#121212', crow: '#121212',
} }
/** What villagers wear: undyed linen, brown and grey wool, faded red and green. Soldiers in dark wool. */ /** What villagers wear: undyed linen, brown and grey wool, faded red and green. Soldiers in dark wool. */
export const SHIRTS = ['#5a4a3a', '#62342a', '#474b36', '#6a6355', '#434548'] export const SHIRTS = ['#73604c', '#7a4436', '#5d6247', '#8a826f', '#5a5d60']
export const UNIFORM = '#3a2f26' export const UNIFORM = '#4e3f33'
/** Smoke from hearths, forges and smouldering ruins: sooty, not white. */ /** Smoke from hearths, forges and smouldering ruins: sooty, not white. */
export const SMOKE = { fill: '#55514c', edge: '#45423e' } export const SMOKE = { fill: '#77736d', edge: '#625e59' }
export interface Model { export interface Model {
faces: Face[] faces: Face[]

View File

@ -30,27 +30,27 @@ type Zone = 'iron' | 'clay' | 'timber' | 'farm'
const ZONE_OF: Partial<Record<BuildingType, Zone>> = { iron_mine: 'iron', clay_pit: 'clay', timber_camp: 'timber', farm: 'farm' } const ZONE_OF: Partial<Record<BuildingType, Zone>> = { iron_mine: 'iron', clay_pit: 'clay', timber_camp: 'timber', farm: 'farm' }
/** Centre angle, half the angle it spans, model scale, and slot spacing in model sizes. */ /** Centre angle, half the angle it spans, model scale, and slot spacing in model sizes. */
const ZONES: Record<Zone, { angle: number; half: number; scale: number; gap: number; ground: string | null }> = { const ZONES: Record<Zone, { angle: number; half: number; scale: number; gap: number; ground: string | null }> = {
iron: { angle: deg(196), half: deg(26), scale: 1.15, gap: 2.5, ground: '#55524c' }, iron: { angle: deg(196), half: deg(26), scale: 1.15, gap: 2.5, ground: '#716d66' },
clay: { angle: deg(102), half: deg(24), scale: 1.1, gap: 2.4, ground: '#5f3f2c' }, clay: { angle: deg(102), half: deg(24), scale: 1.1, gap: 2.4, ground: '#7d543b' },
timber: { angle: deg(8), half: deg(22), scale: 1.1, gap: 2.4, ground: '#554a33' }, timber: { angle: deg(8), half: deg(22), scale: 1.1, gap: 2.4, ground: '#716345' },
farm: { angle: deg(-62), half: deg(27), scale: 1.3, gap: 2.6, ground: null }, farm: { angle: deg(-62), half: deg(27), scale: 1.3, gap: 2.6, ground: null },
} }
const ZONE_NAMES = Object.keys(ZONES) as Zone[] const ZONE_NAMES = Object.keys(ZONES) as Zone[]
/** Tired grass, trodden and yellowed in places; roads and the plaza are mud. */ /** Tired grass, trodden and yellowed in places; roads and the plaza are mud. */
const GRASS = ['#4f5436', '#4b5034', '#535539', '#575438'] const GRASS = ['#6a7049', '#666c46', '#6e714c', '#73704b']
const DIRT = '#4f3f2e' const DIRT = '#6b563f'
const PLAZA = '#564533' const PLAZA = '#735e45'
const VILLAGE_GROUND = '#4f4c33' const VILLAGE_GROUND = '#6a6646'
const WALL_EARTH = '#463829' const WALL_EARTH = '#5e4c38'
/** Ruts cut by cart wheels, and the rain standing in them. */ /** Ruts cut by cart wheels, and the rain standing in them. */
const RUT = '#3a2e22' const RUT = '#4e3f2f'
const PUDDLE = '#2c3233' const PUDDLE = '#59646a'
/** The land darkens towards the edges, into the forest. */ /** The land darkens towards the edges, into the forest. */
const DUSK = '#14170f' const DUSK = '#14170f'
/** A ground colour darkened from `r0` out to `r1`, at most by `max`. */ /** A ground colour darkened from `r0` out to `r1`, at most by `max`. */
export function fade(color: string, r: number, r0: number, r1: number, max = 0.5): string { export function fade(color: string, r: number, r0: number, r1: number, max = 0.25): string {
const k = Math.min(1, Math.max(0, (r - r0) / (r1 - r0))) const k = Math.min(1, Math.max(0, (r - r0) / (r1 - r0)))
return k ? mix(color, DUSK, k * max) : color return k ? mix(color, DUSK, k * max) : color
} }
@ -194,7 +194,7 @@ export function guardSpots(type: BuildingType, [x, y]: V2, n: number, unit: numb
/** Buildings that smoke, from this level on. */ /** Buildings that smoke, from this level on. */
const SMOKY: Partial<Record<BuildingType, number>> = { headquarters: 1, barracks: 1, workshop: 1, academy: 1, clay_pit: 1, iron_mine: 5 } const SMOKY: Partial<Record<BuildingType, number>> = { headquarters: 1, barracks: 1, workshop: 1, academy: 1, clay_pit: 1, iron_mine: 5 }
const WATER = '#2f3b3c' const WATER = '#4a5b5d'
/** A scene object with its painter order (x + y of its ground point). */ /** A scene object with its painter order (x + y of its ground point). */
type Ordered = SceneObject & { depth: number } type Ordered = SceneObject & { depth: number }
@ -591,7 +591,7 @@ export function buildScene(village: VillageState, frame: number | { width: numbe
labelTops.push(label[1]) labelTops.push(label[1])
anchorOfBuilding.set(b.id, label) anchorOfBuilding.set(b.id, label)
const ground = b.type === 'headquarters' ? PLAZA : zone ? (ZONES[zone].ground ?? GRASS[0]!) : VILLAGE_GROUND const ground = b.type === 'headquarters' ? PLAZA : zone ? (ZONES[zone].ground ?? GRASS[0]!) : VILLAGE_GROUND
shadows.push(shadow(slot.x, slot.y, s * (zone ? 1.0 : 0.95), scale(ground, 0.68), b.id)) shadows.push(shadow(slot.x, slot.y, s * (zone ? 1.0 : 0.95), scale(ground, 0.8), b.id))
const smokyFrom = SMOKY[b.type] const smokyFrom = SMOKY[b.type]
if (smokyFrom !== undefined && b.level >= smokyFrom && !upgrading) smoke.push(project([slot.x - s * 0.35, slot.y + s * 0.3, model.height * 0.72])) if (smokyFrom !== undefined && b.level >= smokyFrom && !upgrading) smoke.push(project([slot.x - s * 0.35, slot.y + s * 0.3, model.height * 0.72]))
objects.push({ objects.push({
@ -782,7 +782,7 @@ export function buildScene(village: VillageState, frame: number | { width: numbe
const pondOut = Math.max(Rv + U * 2.6, zoneEnd('clay') * 0.85) const pondOut = Math.max(Rv + U * 2.6, zoneEnd('clay') * 0.85)
const [pondX, pondY] = [Math.cos(deg(150)) * pondOut, Math.sin(deg(150)) * pondOut] const [pondX, pondY] = [Math.cos(deg(150)) * pondOut, Math.sin(deg(150)) * pondOut]
if (!taken.some((t) => Math.hypot(pondX - t.x, pondY - t.y) < t.r + pondR)) { if (!taken.some((t) => Math.hypot(pondX - t.x, pondY - t.y) < t.r + pondR)) {
decalFaces.push(plane(disc(pondX, pondY, pondR * 1.18, 14, 91, 0.9), '#3f3a2a')) decalFaces.push(plane(disc(pondX, pondY, pondR * 1.18, 14, 91, 0.9), '#58513b'))
decalFaces.push(plane(disc(pondX, pondY, pondR, 14, 92, 1.0), WATER)) decalFaces.push(plane(disc(pondX, pondY, pondR, 14, 92, 1.0), WATER))
decalFaces.push(plane(disc(pondX - pondR * 0.25, pondY + pondR * 0.1, pondR * 0.45, 8, 93, 1.1), scale(WATER, 1.12))) decalFaces.push(plane(disc(pondX - pondR * 0.25, pondY + pondR * 0.1, pondR * 0.45, 8, 93, 1.1), scale(WATER, 1.12)))
taken.push({ x: pondX, y: pondY, r: pondR * 1.3 }) taken.push({ x: pondX, y: pondY, r: pondR * 1.3 })
@ -790,7 +790,7 @@ export function buildScene(village: VillageState, frame: number | { width: numbe
const a = (k / 7) * Math.PI * 2 + hash(k, 94) const a = (k / 7) * Math.PI * 2 + hash(k, 94)
const [x, y] = [pondX + Math.cos(a) * pondR * 1.12, pondY + Math.sin(a) * pondR * 1.12] const [x, y] = [pondX + Math.cos(a) * pondR * 1.12, pondY + Math.sin(a) * pondR * 1.12]
const h = U * (0.3 + 0.25 * hash(k, 95)) const h = U * (0.3 + 0.25 * hash(k, 95))
objects.push({ key: `reed-${k}`, depth: x + y, polys: toPolys(prism(ngon(x, y, U * 0.05, 4), 0, h, '#45482c', '#5c5a38')) }) objects.push({ key: `reed-${k}`, depth: x + y, polys: toPolys(prism(ngon(x, y, U * 0.05, 4), 0, h, '#5c6040', '#77744c')) })
} }
} }
const iron = ZONES.iron const iron = ZONES.iron
@ -902,9 +902,9 @@ export function buildScene(village: VillageState, frame: number | { width: numbe
const kind = hash(i, j, 64) const kind = hash(i, j, 64)
const faces = kind < 0.1 ? bush(x, y, size * 0.8, seed) : kind < 0.6 ? conifer(x, y, size, seed) : kind < 0.68 ? deadTree(x, y, size, seed) : broadleaf(x, y, size, seed) const faces = kind < 0.1 ? bush(x, y, size * 0.8, seed) : kind < 0.6 ? conifer(x, y, size, seed) : kind < 0.68 ? deadTree(x, y, size, seed) : broadleaf(x, y, size, seed)
taken.push({ x, y, r: size * 0.3 }) taken.push({ x, y, r: size * 0.3 })
shadows.push(shadow(x, y, size * 0.34, scale(GRASS[3]!, 0.68), seed)) shadows.push(shadow(x, y, size * 0.34, scale(GRASS[3]!, 0.8), seed))
// Further out the forest goes dark. // Further out the forest goes dark.
objects.push({ key: `t${i}:${j}`, depth: x + y, polys: toPolys(faces.map((face) => ({ ...face, color: fade(face.color, r, Rz * 0.8, Rz * 1.7, 0.4) }))) }) objects.push({ key: `t${i}:${j}`, depth: x + y, polys: toPolys(faces.map((face) => ({ ...face, color: fade(face.color, r, Rz * 0.9, Rz * 1.8, 0.2) }))) })
} }
} }
// A few stones in the meadows. // A few stones in the meadows.
@ -1043,7 +1043,7 @@ export function buildScene(village: VillageState, frame: number | { width: numbe
viewBox: `${view.x.toFixed(1)} ${view.y.toFixed(1)} ${w.toFixed(1)} ${h.toFixed(1)}`, viewBox: `${view.x.toFixed(1)} ${view.y.toFixed(1)} ${w.toFixed(1)} ${h.toFixed(1)}`,
width: w, width: w,
height: h, height: h,
terrain: ground(view, { r0: Rz * 0.8, r1: Rz * 1.7 }), terrain: ground(view, { r0: Rz * 0.9, r1: Rz * 1.8 }),
// One at a time, so the layers keep the order they were added in. // One at a time, so the layers keep the order they were added in.
decals: [...decalFaces, ...shadows].flatMap((face) => toPolys([face])), decals: [...decalFaces, ...shadows].flatMap((face) => toPolys([face])),
// Wall segments keep their own outlines; the band below covers the stretches between. // Wall segments keep their own outlines; the band below covers the stretches between.

View File

@ -201,7 +201,7 @@ const continent = computed(() => (rounded.value ? continentOf(rounded.value.x, r
:style="staged ? { top: `${stage!.menuBottom.value}px` } : undefined" :style="staged ? { top: `${stage!.menuBottom.value}px` } : undefined"
> >
<!-- A dark wooden frame around the map on a page; edge to edge on the stage. --> <!-- A dark wooden frame around the map on a page; edge to edge on the stage. -->
<div class="h-full overflow-hidden bg-[#3d4228]" :class="staged ? '' : 'border-2 border-wood-900'"> <div class="h-full overflow-hidden bg-[#585e3c]" :class="staged ? '' : 'border-2 border-wood-900'">
<MapWorldMap <MapWorldMap
v-if="visible" v-if="visible"
:view="view" :view="view"