feat: larger text and buttons instead of text links, the village bar split left and right, buildings clickable on their whole outline

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fabian @ Blax Software 2026-10-29 14:09:03 +01:00
parent 5da7c1f512
commit 8da574292d
24 changed files with 223 additions and 140 deletions

View File

@ -7,11 +7,11 @@ This is the Nuxt client for a browser strategy game in the style of Tribal Wars.
- **The client is a view.** It sends intents over WS and renders what the server returns. It never computes costs, durations, combat, or loot. The only computation it does is projecting resources (`stored + rate × elapsed`) and countdowns from server timestamps. It refetches when a countdown reaches zero or a `village:updated` push arrives.
- **`ssr: false` for every target**, so one static build serves both the web and Steam. Code must not rely on Nuxt server routes or SSR-only APIs.
- **Transport** is WS-first through the `ws` singleton from `@blax-software/networking`, the same as learn-atc. HTTP is only for login and register, which return the bearer token. Load the `blax-websockets` skill before you write `ws.send` or `ws.listen` code.
- **Dense and plain, like the old browser strategy games** (the reference is Die Stämme; notes and screenshots in the sibling repo `game-village-politics-research` (`../game-village-politics-research/die-staemme/`), kept out of this repo). A 14 px base, square frames with thin lines, tan header bands, tight table rows (`.grid-table`), small squared buttons (`.btn-primary` dark wood, `.btn-attack` red for attacks only), thin notice bars. No rounded cards, pills, big padding or decorative icons: an icon only where it carries meaning. Theme and component classes live in `app/assets/css/main.css`; hand-written inline SVG graphics in `app/components/icon/`, colours in `app/utils/palette.ts`. No paid, hosted or licensed assets: no icon packs, web fonts or images from outside the repo, and nothing copied from Die Stämme.
- **The village is a ground-level land view** (`app/components/village/Diorama.vue`, geometry in `app/diorama/`): isometric low-poly, drawn as inline SVG, no WebGL. The land fills the frame edge to edge (no island, no sky), cut to the container's shape; narrow screens scroll sideways. There are no tiles or positions: the server only sends each building's `space` and the village's `space.used/max`, and the client lays everything out deterministically in id order. The village core sits in the middle (headquarters on the plaza, storage, hiding places and rally point around it, inside the wall ring when there is one, a dirt edge without). Resource sites stand outside in their zones: iron mines at the rocky hill (upper left), clay pits on clay ground (lower left), timber camps at the forest edge (lower right), farms with fields (right); dirt roads lead from the gates to each zone and forest fills the rest. Levels start at 1. Each type has a model per level tier (1–4, 5–14, 15+); the wall goes stakes → timber → stone with towers. Buildings are focusable buttons that open their details card; a type that doesn't stand yet keeps an invisible empty plot that opens its build card. Buildings never move or light up on hover: only a click outlines the ground under them. Ambient life is welcome and stays out of the way: flat ground shadows, smoke from chimneys, forges and kilns, villagers walking the roads to the zones they work in; all motion stops under `prefers-reduced-motion`. The same models draw the building portraits on screen headers, the HQ list and the building cards (`VillageBuildingPortrait`). The world map groups forests, lakes and rocky hills by smooth noise of the coordinates, and village markers grow in five sizes with points. Map coordinates run around 0|0, negative included (−500 to 499 on a 1000-field map, lowest value from `map.view`'s `min`); continents are named from the top-left like Die Stämme, so 0|0 is the corner of K44, K45, K54 and K55. Use `app/utils/map.ts` for bounds and continents, never `0` or `500` literals.
- **Dense and plain, like the old browser strategy games** (the reference is Die Stämme; notes and screenshots in the sibling repo `game-village-politics-research` (`../game-village-politics-research/die-staemme/`), kept out of this repo). A 16 px root (17 px from 1800 px wide; rem sizes only, `text-sm` for body text, no fixed `text-[13px]`), square frames with thin lines, tan header bands, tight table rows (`.grid-table`), small squared buttons (`.btn-primary` dark wood, `.btn-attack` red for attacks only), thin notice bars. Actions are buttons, not text links: `.btn` for screen links and commands, `.btn-fill` for the "(20)" that fills an amount field; names inside lists and tables stay links. Bigger text must not add line wraps: keep rows `whitespace-nowrap` where they were one line. No rounded cards, pills, big padding or decorative icons: an icon only where it carries meaning. Theme and component classes live in `app/assets/css/main.css`; hand-written inline SVG graphics in `app/components/icon/`, colours in `app/utils/palette.ts`. No paid, hosted or licensed assets: no icon packs, web fonts or images from outside the repo, and nothing copied from Die Stämme.
- **The village is a ground-level land view** (`app/components/village/Diorama.vue`, geometry in `app/diorama/`): isometric low-poly, drawn as inline SVG, no WebGL. The land fills the frame edge to edge (no island, no sky), cut to the container's shape; narrow screens scroll sideways. There are no tiles or positions: the server only sends each building's `space` and the village's `space.used/max`, and the client lays everything out deterministically in id order. The village core sits in the middle (headquarters on the plaza, storage, hiding places and rally point around it, inside the wall ring when there is one, a dirt edge without). Resource sites stand outside in their zones: iron mines at the rocky hill (upper left), clay pits on clay ground (lower left), timber camps at the forest edge (lower right), farms with fields (right); dirt roads lead from the gates to each zone and forest fills the rest. Levels start at 1. Each type has a model per level tier (1–4, 5–14, 15+); the wall goes stakes → timber → stone with towers. Buildings are focusable buttons that open their details card, clickable anywhere on their outline (`hit`, a convex hull round their polygons and ground ring), the thin wall also along a wide band on its ring, and their level badges and countdowns as well; a type that doesn't stand yet keeps an invisible empty plot that opens its build card. Buildings never move or light up on hover: only a click outlines the ground under them. Ambient life is welcome and stays out of the way: flat ground shadows, smoke from chimneys, forges and kilns, villagers walking the roads to the zones they work in; all motion stops under `prefers-reduced-motion`. The same models draw the building portraits on screen headers, the HQ list and the building cards (`VillageBuildingPortrait`). The world map groups forests, lakes and rocky hills by smooth noise of the coordinates, and village markers grow in five sizes with points. Map coordinates run around 0|0, negative included (−500 to 499 on a 1000-field map, lowest value from `map.view`'s `min`); continents are named from the top-left like Die Stämme, so 0|0 is the corner of K44, K45, K54 and K55. Use `app/utils/map.ts` for bounds and continents, never `0` or `500` literals.
- **Flat medieval colours only**, in the diorama and everywhere else: no gradients (CSS or SVG), no blur or backdrop-blur, no SVG filters or glows, no translucent overlays. Depth comes from the three flat shades per face in `app/diorama/iso.ts`, solid borders and hard shadows. Keep components small and typed, with state in composables (`useVillage`, `useWorld`).
- **The village fills the screen.** On the village's own screens (`/village/<id>/…`) `GameVillageFrame` draws the diorama fixed across the whole browser window and docks everything over it, solid and opaque: the menu and the village bar along the top, the overview boxes in a right column (on phones a bottom sheet on the overview), and the open screen (headquarters, recruit, rally point, workforce) in a `UiWindow` on the left that folds and closes back to the overview; on the overview the left slot holds the card of the building picked in the village (`useVillageSelection`). Screen grids inside a window use container queries (`@4xl:`), not viewport breakpoints. The village scales to fit, no pan: the frame measures what the bars, the right column, the phone tab bar and the bottom sheet cover (`inset`), `buildScene` fits the whole village into the rest, and ground and forest are generated for the whole stage, so nothing of the village is ever cut off. Windows are docked now and meant to become draggable later, so `UiWindow` holds no position logic. This is where the game deliberately leaves Die Stämme's look behind.
- **One game shell for the rest.** The map and reports sit in one centred column (1100 px). All world pages use `layouts/game.vue` (on village screens `GameVillageFrame` draws the same parts over the village): the dark main menu (`GameMenuBar`: village, map, reports with its count inline, each with a hover dropdown of its sub-pages; server clock; account dropdown), then the village header (`GameVillageBar`: a quick bar with the village's screens, and one row with the village, its stock in thin cells and incoming troops), thin notices, and the content in a `.frame`. On phones the screens move to a bottom tab bar (`GameTabBar`). The header's village is the URL's on village screens and the last opened one elsewhere; `GameVillageFrame` holds its one `useVillage()` and shares it through `useVillageContext()`. Pages outside a world use `layouts/default.vue` (menu only). A page has one of two shapes: a title with box tabs (`UiSubTabs`: buildings like the rally point) or a title with a sub-menu on the left (`UiSideMenu`: lists like reports). One key per screen (`useShortcuts`): V overview, H headquarters, T recruit, P rally point, W workforce, M map, R reports. The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. The map shows a popup over a hovered village and actions under a clicked one. The village row starts with the quest book (`QuestBook`, a native `<dialog>` without a veil): it opens by itself when `quests.claimable` goes up, and a goal's "show me" opens its screen, a building goal the headquarters with `?hint=<type>` marking that row.
- **One game shell for the rest.** The map and reports sit in one centred column (1100 px). All world pages use `layouts/game.vue` (on village screens `GameVillageFrame` draws the same parts over the village): the dark main menu (`GameMenuBar`: village, map, reports with its count inline, each with a hover dropdown of its sub-pages; server clock; account dropdown), then the village header (`GameVillageBar`, in two pieces with the village showing between them: on the left the quick bar with the village's screens over the village row, on the right the stock in thin cells and incoming troops; the space between lets clicks through), thin notices, and the content in a `.frame`. On phones the screens move to a bottom tab bar (`GameTabBar`). The header's village is the URL's on village screens and the last opened one elsewhere; `GameVillageFrame` holds its one `useVillage()` and shares it through `useVillageContext()`. Pages outside a world use `layouts/default.vue` (menu only). A page has one of two shapes: a title with box tabs (`UiSubTabs`: buildings like the rally point) or a title with a sub-menu on the left (`UiSideMenu`: lists like reports). One key per screen (`useShortcuts`): V overview, H headquarters, T recruit, P rally point, W workforce, M map, R reports. The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. The map shows a popup over a hovered village and actions under a clicked one. The village row starts with the quest book (`QuestBook`, a native `<dialog>` without a veil): it opens by itself when `quests.claimable` goes up, and a goal's "show me" opens its screen, a building goal the headquarters with `?hint=<type>` marking that row.
- All user-facing text goes through i18n keys, with `en` as the first locale. Sources are `i18n/locales/` and `i18n/pages/` (`@blax-software/i18n` layout); register a new page file in `i18n/messageloader.ts`. vue-i18n reads a bare `|` as a plural separator and drops what follows, so coordinates in messages are written `"{x}{'|'}{y}"` inside a double-quoted string.
## Mock server

View File

@ -46,13 +46,19 @@
}
/*
* Dense on purpose, like the old browser strategy games: a 14 px base (every rem
* shrinks with it), square frames, thin lines, tan header bands, tight table rows.
* Dense on purpose, like the old browser strategy games, but readable: a 16 px root
* (17 px on wide screens; every rem grows with it, text-sm for body text), square frames,
* thin lines, tan header bands, tight table rows.
* No rounded cards, no pills, no big padding; icons only where they carry meaning.
*/
@layer base {
html {
font-size: 14px;
font-size: 16px;
}
@media (min-width: 1800px) {
html {
font-size: 17px;
}
}
body {
@apply bg-[#cdb488] font-sans text-ink-900 antialiased;
@ -77,7 +83,7 @@
@apply flex flex-wrap items-center justify-between gap-2 border-b border-wood-700 bg-parchment-300 px-2 py-1;
}
.panel-title {
@apply font-display text-[15px] leading-snug font-semibold text-wood-950;
@apply font-display text-base leading-snug font-semibold text-wood-950;
font-variant: small-caps;
letter-spacing: 0.02em;
}
@ -86,7 +92,7 @@
}
.btn {
@apply inline-flex items-center justify-center gap-1 rounded-[2px] border px-2.5 py-1 text-[13px] leading-tight font-semibold focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-gold-500 disabled:cursor-not-allowed disabled:opacity-45;
@apply inline-flex items-center justify-center gap-1 rounded-[2px] border px-2.5 py-1 text-sm leading-tight font-semibold focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-gold-500 disabled:cursor-not-allowed disabled:opacity-45;
}
/* The everyday button: dark wood with light text. */
.btn-primary {
@ -105,16 +111,20 @@
.btn-danger {
@apply border-transparent text-blood-700 hover:bg-parchment-200;
}
/* Fills an amount field with the most there is: "(20)" as a small button, not a text link. */
.btn-fill {
@apply inline-flex min-w-10 items-center justify-center border border-wood-600 bg-parchment-100 px-1 py-0.5 text-xs font-semibold text-blood-700 tabular-nums hover:bg-parchment-200 disabled:cursor-not-allowed disabled:border-parchment-300 disabled:bg-transparent disabled:text-ink-400;
}
.input {
@apply w-full rounded-none border border-wood-600 bg-[#fbf3df] px-1.5 py-1 text-[13px] text-ink-900 outline-none placeholder:text-ink-400 focus:border-wood-900;
@apply w-full rounded-none border border-wood-600 bg-[#fbf3df] px-1.5 py-1 text-sm text-ink-900 outline-none placeholder:text-ink-400 focus:border-wood-900;
}
.label {
@apply mb-0.5 block text-[13px] font-semibold text-ink-700;
@apply mb-0.5 block text-sm font-semibold text-ink-700;
}
.badge {
@apply inline-flex items-center gap-1 border px-1 text-[11px] leading-4 font-semibold whitespace-nowrap;
@apply inline-flex items-center gap-1 border px-1 text-xs leading-4 font-semibold whitespace-nowrap;
}
.badge-plain {
@apply border-wood-600/50 bg-parchment-200 text-ink-700;
@ -131,7 +141,7 @@
/* A thin full-width notice with an (i) and a close cross. */
.alert {
@apply border border-blood-700 bg-[#f0d6c8] px-2 py-1 text-[13px] text-blood-800;
@apply border border-blood-700 bg-[#f0d6c8] px-2 py-1 text-sm text-blood-800;
}
/* The framed content column on the backdrop. */
@ -140,7 +150,7 @@
}
/* A data table: tan header band, tight rows, thin lines. */
.grid-table {
@apply w-full border-collapse text-[13px];
@apply w-full border-collapse text-sm;
}
.grid-table th {
@apply border-b border-wood-700 bg-parchment-200 px-1.5 py-0.5 text-left text-xs font-semibold text-ink-700;

View File

@ -79,13 +79,13 @@ watch(() => route.fullPath, () => menuKey.value++)
<!-- The main menu on every page: one dark bar, every section with its dropdown, the server clock and the account. -->
<template>
<header class="border-b-2 border-wood-950 bg-wood-900 text-[13px] text-parchment-100">
<header class="border-b-2 border-wood-950 bg-wood-900 text-sm text-parchment-100">
<div :key="menuKey" class="mx-auto flex h-9 items-stretch px-1 sm:px-2" :class="wide ? '' : 'max-w-[1100px]'">
<NuxtLink :to="home" class="mr-1 shrink-0 items-center gap-1.5 px-1.5" :class="entries.length ? 'hidden sm:flex' : 'flex'" :title="t('app.title')">
<span class="grid size-6 place-items-center border border-gold-600 bg-blood-700 text-gold-400">
<IconBuilding type="headquarters" class="size-4" />
</span>
<span class="hidden font-display text-[15px] font-semibold text-gold-400 lg:inline" style="font-variant: small-caps">{{ t('app.title') }}</span>
<span class="hidden font-display text-base font-semibold text-gold-400 lg:inline" style="font-variant: small-caps">{{ t('app.title') }}</span>
</NuxtLink>
<nav v-if="entries.length" class="flex items-stretch" :aria-label="t('app.menu')">

View File

@ -29,7 +29,7 @@ const left = computed(() => props.secondsUntil(props.until))
<!-- A thin notice under the village header while beginner protection lasts, with its countdown and a close cross. -->
<template>
<div v-if="!hidden && left > 0" class="border border-wood-700 bg-parchment-50" role="status">
<div class="flex items-center gap-2 px-2 py-0.5 text-[13px]">
<div class="flex items-center gap-2 px-2 py-0.5 text-sm">
<IconUi name="support" class="size-4 shrink-0 text-moss-700" />
<p class="min-w-0 flex-1">
{{ $t('village.protection.ends_in') }}

View File

@ -15,7 +15,7 @@ const isActive = (path: string) => route.path === `${base.value}${path}`
v-for="s in VILLAGE_SCREENS"
:key="s.name"
:to="`${base}${s.path}`"
class="flex flex-col items-center gap-0.5 px-1 py-1 text-[11px] leading-tight font-semibold"
class="flex flex-col items-center gap-0.5 px-1 py-1 text-xs leading-tight font-semibold"
:class="isActive(s.path) ? 'bg-wood-800 text-gold-400' : 'text-parchment-200'"
:aria-current="isActive(s.path) ? 'page' : undefined"
>

View File

@ -36,12 +36,13 @@ async function rename() {
</script>
<!--
Above the content, like the header of Die Stämme: the quick bar with the village's
screens, then one row with the village and its stock. Plain numbers in thin cells;
each resource leads to the workforce, where it is made.
Above the village, in two pieces with the village showing between them: on the left the
quick bar with the village's screens and the village itself, on the right its stock in
thin cells (each leads to the workforce, where it is made) and incoming troops.
-->
<template>
<div class="space-y-1 text-[13px]">
<div class="pointer-events-none flex flex-wrap items-start justify-between gap-1 text-sm">
<div class="pointer-events-auto flex max-w-full min-w-0 flex-col items-start gap-1">
<nav class="hidden border border-wood-700 bg-parchment-200 md:flex" :aria-label="$t('village.screens.label')">
<NuxtLink
v-for="s in VILLAGE_SCREENS"
@ -57,11 +58,11 @@ async function rename() {
</NuxtLink>
</nav>
<div class="flex flex-wrap items-stretch border border-wood-700 bg-parchment-200">
<div class="flex max-w-full min-w-0 items-stretch border border-wood-700 bg-parchment-200">
<!-- The quest book, with what waits in it. -->
<button
type="button"
class="flex items-center gap-1 border-r border-wood-700 px-2 py-1 font-semibold text-wood-900 hover:bg-parchment-100 hover:text-blood-700"
class="flex shrink-0 items-center gap-1 border-r border-wood-700 px-2 py-1 font-semibold text-wood-900 hover:bg-parchment-100 hover:text-blood-700"
:class="questsWaiting ? 'bg-gold-400' : ''"
:title="$t('quests.open')"
@click="questBook = true"
@ -72,7 +73,7 @@ async function rename() {
</button>
<!-- Which village. -->
<div class="flex min-w-0 flex-1 items-center gap-1.5 px-2 py-1">
<div class="flex min-w-0 items-center gap-1.5 px-2 py-1 whitespace-nowrap">
<form v-if="renaming !== null" class="flex items-center gap-1" @submit.prevent="rename">
<input v-model="renaming" type="text" maxlength="32" class="input w-40" :aria-label="$t('village.rename')" @keydown.esc="renaming = null" />
<button type="submit" class="btn btn-primary" :disabled="v.busy.value || !renaming.trim()">{{ $t('village.rename_save') }}</button>
@ -80,16 +81,20 @@ async function rename() {
</form>
<template v-else>
<span v-if="others.length > 1" class="inline-flex shrink-0 items-center">
<button type="button" class="btn btn-ghost px-1" :title="$t('village.switcher.prev')" @click="step(-1)">‹<span class="sr-only">{{ $t('village.switcher.prev') }}</span></button>
<button type="button" class="btn btn-ghost px-1.5" :title="$t('village.switcher.prev')" @click="step(-1)">
‹<span class="sr-only">{{ $t('village.switcher.prev') }}</span>
</button>
<select
class="input w-auto max-w-48 py-0 font-bold"
class="input w-auto max-w-48 py-0.5 font-bold"
:value="village.id"
:aria-label="$t('village.switcher.label')"
@change="switchTo(Number(($event.target as HTMLSelectElement).value))"
>
<option v-for="o in others" :key="o.id" :value="o.id">{{ o.name }}</option>
</select>
<button type="button" class="btn btn-ghost px-1" :title="$t('village.switcher.next')" @click="step(1)">›<span class="sr-only">{{ $t('village.switcher.next') }}</span></button>
<button type="button" class="btn btn-ghost px-1.5" :title="$t('village.switcher.next')" @click="step(1)">
›<span class="sr-only">{{ $t('village.switcher.next') }}</span>
</button>
</span>
<NuxtLink v-else :to="base" class="truncate font-bold text-wood-950 hover:text-blood-700">{{ village.name }}</NuxtLink>
<NuxtLink
@ -100,15 +105,18 @@ async function rename() {
({{ village.x }}|{{ village.y }}) {{ village.continent }}
</NuxtLink>
<span class="hidden shrink-0 text-ink-500 tabular-nums sm:inline">{{ $t('village.points', { points: village.points }) }}</span>
<button type="button" class="shrink-0 text-ink-400 hover:text-blood-700" :title="$t('village.rename')" @click="renaming = village.name">
<IconUi name="edit" class="size-3.5" />
<button type="button" class="btn btn-ghost shrink-0 px-1 text-ink-500" :title="$t('village.rename')" @click="renaming = village.name">
<IconUi name="edit" class="size-4" />
<span class="sr-only">{{ $t('village.rename') }}</span>
</button>
</template>
</div>
</div>
</div>
<div class="pointer-events-auto flex w-full items-stretch border border-wood-700 bg-parchment-200 sm:w-auto">
<!-- The stock: four resources, the storage cap and the villagers, each in its own cell. -->
<div class="grid w-full grid-cols-5 border-t border-parchment-300 sm:flex sm:w-auto sm:border-t-0">
<div class="grid flex-1 grid-cols-5 sm:flex">
<NuxtLink v-for="r in (['wood', 'clay', 'iron', 'food'] as const)" :key="r" :to="`${base}/workforce`" class="cell flex hover:bg-parchment-100">
<GameResource :resource="r" :amount="resources[r]" :cap="village.storage_cap" :rate="village.rates[r]" />
</NuxtLink>
@ -122,7 +130,7 @@ async function rename() {
<NuxtLink
:to="`${base}/workforce`"
class="cell flex hover:bg-parchment-100"
:title="`${$t('village.population.villagers')}: ${village.population.villagers} · ${$t('village.population.upkeep')}: ${village.population.upkeep}/${village.population.food_budget}`"
:title="`${$t('village.population.villagers')}: ${village.population.villagers} · ${$t('village.population.upkeep')}: ${village.population.upkeep}/${village.population.food_budget}`"
>
<IconUi name="users" class="size-4 text-wood-800" />
<span class="tabular-nums">{{ village.population.villagers }}</span>
@ -149,12 +157,12 @@ async function rename() {
@reference "~/assets/css/main.css";
.quick {
@apply flex items-center gap-1.5 border-r border-parchment-300 px-3 py-1 font-semibold text-wood-900 last:border-r-0 hover:bg-parchment-100 hover:text-blood-700;
@apply flex items-center gap-1.5 border-r border-parchment-300 px-3 py-1.5 font-semibold text-wood-900 last:border-r-0 hover:bg-parchment-100 hover:text-blood-700;
}
.quick-active {
@apply bg-parchment-50 text-blood-700;
}
.cell {
@apply items-center justify-center gap-1 border-l border-parchment-300 px-2 py-1 first:border-l-0 sm:first:border-l;
@apply items-center justify-center gap-1 border-l border-parchment-300 px-2 py-1 first:border-l-0;
}
</style>

View File

@ -114,23 +114,21 @@ useShortcuts(() => {
/>
</div>
<div class="pointer-events-none fixed inset-0 z-10 flex flex-col">
<div ref="topBars" class="pointer-events-auto shrink-0">
<GameMenuBar in-world wide />
<div ref="topBars" class="shrink-0">
<GameMenuBar class="pointer-events-auto" in-world wide />
<div class="space-y-1 px-1 pt-1 sm:px-2">
<GameVillageBar v-if="v.village.value && v.resources.value" :village="v.village.value" :resources="v.resources.value" />
<GameProtectionBar
v-if="v.village.value?.rally.protected_until"
class="pointer-events-auto"
:until="v.village.value.rally.protected_until"
:village-id="villageId"
:seconds-until="v.secondsUntil"
/>
<VillageFoodWarning
v-if="v.village.value"
:starvation="v.village.value.starvation"
:levy="v.village.value.levy"
:seconds-until="v.secondsUntil"
/>
<p v-if="v.error.value" class="alert" role="alert">{{ v.error.value }}</p>
<div v-if="v.village.value" class="pointer-events-auto space-y-1 empty:hidden">
<VillageFoodWarning :starvation="v.village.value.starvation" :levy="v.village.value.levy" :seconds-until="v.secondsUntil" />
</div>
<p v-if="v.error.value" class="alert pointer-events-auto" role="alert">{{ v.error.value }}</p>
</div>
</div>
@ -147,7 +145,7 @@ useShortcuts(() => {
<div
v-if="v.village.value"
ref="sideColumn"
class="pointer-events-auto ml-auto max-h-full w-60 shrink-0 overflow-y-auto"
class="pointer-events-auto ml-auto max-h-full w-64 shrink-0 overflow-y-auto"
:class="overview && !picked ? 'max-lg:w-full max-lg:self-end max-lg:max-h-[45dvh]' : 'hidden lg:block'"
>
<VillageOverviewSidebar :village="v.village.value" :base="base" :seconds-until="v.secondsUntil" />

View File

@ -107,7 +107,7 @@ async function go(goal: QuestGoal) {
<p v-if="q.error.value" class="alert" role="alert">{{ q.error.value }}</p>
<div v-if="tab === 'quests'" class="grid gap-2 sm:grid-cols-[12rem_minmax(0,1fr)]">
<nav class="self-start border border-wood-700 bg-parchment-200 text-[13px]" :aria-label="$t('quests.lines_label')">
<nav class="self-start border border-wood-700 bg-parchment-200 text-sm" :aria-label="$t('quests.lines_label')">
<button
v-for="l in lines"
:key="l.line"
@ -131,7 +131,7 @@ async function go(goal: QuestGoal) {
<span class="font-bold text-wood-950">{{ title(line.quest.key) }}</span>
<span class="text-xs text-ink-500 tabular-nums">{{ $t('quests.step', { n: line.done + 1, total: line.total }) }}</span>
</div>
<div class="panel-body space-y-2.5 text-[13px]">
<div class="panel-body space-y-2.5 text-sm">
<p v-if="story(line.quest.key)" class="text-ink-700">{{ story(line.quest.key) }}</p>
<table class="grid-table">
@ -177,11 +177,11 @@ async function go(goal: QuestGoal) {
<p v-if="line.quest.complete && overflows(line.quest.reward)" class="text-xs text-blood-700">{{ $t('quests.overflow') }}</p>
</div>
</template>
<p v-else class="panel-body text-[13px] text-ink-500">{{ $t('quests.line_done') }}</p>
<p v-else class="panel-body text-sm text-ink-500">{{ $t('quests.line_done') }}</p>
</section>
</div>
<div v-else class="space-y-2 text-[13px]">
<div v-else class="space-y-2 text-sm">
<p class="text-ink-700">{{ $t('quests.rewards_about', { share: Math.round((q.book.value?.share ?? 0) * 100) }) }}</p>
<section class="panel overflow-x-auto">
<table class="grid-table min-w-[28rem]">

View File

@ -6,7 +6,7 @@ defineProps<{ items: { key: string; label: string; to: RouteLocationRaw; active:
<!-- A list page's sub-menu on the left, like the report and message folders in Die Stämme. -->
<template>
<nav class="border border-wood-700 bg-parchment-200 text-[13px]">
<nav class="border border-wood-700 bg-parchment-200 text-sm">
<NuxtLink
v-for="item in items"
:key="item.key"

View File

@ -8,7 +8,7 @@ const current = defineModel<K>({ required: true })
<!-- A screen's own sections as a row of small boxes, like the tabs under a Die Stämme building header. -->
<template>
<nav class="flex flex-wrap gap-0.5 text-[13px]" role="tablist">
<nav class="flex flex-wrap gap-0.5 text-sm" role="tablist">
<button
v-for="tab in tabs"
:key="tab.key"

View File

@ -106,7 +106,7 @@ const demolishable = computed(() =>
type="button"
role="tab"
:aria-selected="tab === name"
class="inline-flex items-center gap-1 border border-wood-800 px-2 py-0.5 text-[13px] font-semibold"
class="inline-flex items-center gap-1 border border-wood-800 px-2 py-0.5 text-sm font-semibold"
:class="tab === name ? 'bg-wood-800 text-gold-400' : 'bg-parchment-200 text-wood-950 hover:bg-parchment-100'"
@click="tab = name"
>
@ -198,7 +198,7 @@ const demolishable = computed(() =>
</table>
<template v-if="locked.length">
<h3 class="border-y border-wood-700 bg-parchment-300 px-2 py-0.5 text-[13px] font-bold text-wood-950">
<h3 class="border-y border-wood-700 bg-parchment-300 px-2 py-0.5 text-sm font-bold text-wood-950">
{{ $t('village.build.not_available') }}
</h3>
<table class="w-full border-collapse text-sm">

View File

@ -18,7 +18,7 @@ const affordable = computed(() =>
<span class="panel-title">{{ $t('village.conquest.title') }}</span>
<span class="badge badge-plain tabular-nums">{{ $t('village.conquest.slots', { used: conquest.used, slots: conquest.slots }) }}</span>
</div>
<div class="panel-body space-y-2 text-[13px]">
<div class="panel-body space-y-2 text-sm">
<p class="text-ink-700">{{ $t('village.conquest.about') }}</p>
<table class="grid-table">
<tbody>

View File

@ -72,7 +72,7 @@ const k = computed(() => (scene.value.width / Math.max(1, size.value.w)) * (size
// Badges that would overlap move up above the one in front, nearest buildings first.
const badges = computed(() => {
const list = scene.value.objects.flatMap((o) => (o.building?.focusable ? [o.building] : []))
const r = 11 * k.value
const r = 13 * k.value
const placed: { b: SceneBuilding; x: number; y: number }[] = []
for (const b of [...list].sort((p, q) => q.label[1] - p.label[1])) {
const [x] = b.label
@ -88,15 +88,15 @@ const badges = computed(() => {
// A timer that would cover another timer or a level badge moves up until it is clear.
const timers = computed(() => {
const K = k.value
const half = { w: 36 * K, h: 11 * K }
const half = { w: 41 * K, h: 12.5 * K }
const placed: { x: number; y: number }[] = []
const hits = (x: number, y: number) =>
placed.some((p) => Math.abs(p.x - x) < half.w * 2 && Math.abs(p.y - y) < half.h * 2) ||
badges.value.some((p) => Math.abs(p.x - x) < half.w + 11 * K && Math.abs(p.y - y) < half.h + 11 * K)
badges.value.some((p) => Math.abs(p.x - x) < half.w + 13 * K && Math.abs(p.y - y) < half.h + 13 * K)
return scene.value.timers
.map((tm) => {
const badge = tm.buildingId !== null ? badges.value.find((p) => p.b.id === tm.buildingId) : undefined
const lift = badge ? 25 : 2
const lift = badge ? 29 : 2
return { ...tm, x: badge?.x ?? tm.at[0], y: (badge?.y ?? tm.at[1]) - lift * K }
})
.sort((a, b) => b.y - a.y)
@ -165,6 +165,16 @@ const timers = computed(() => {
<title>{{ plotLabel(p) }}</title>
</ellipse>
<!-- The wall is thin: a wide band along its ring opens it too. -->
<ellipse
v-if="scene.wallBand"
class="band"
v-bind="scene.wallBand.ring"
:stroke-width="scene.wallBand.width"
aria-hidden="true"
@click.stop="toggle(scene.wallBand.id)"
/>
<template v-for="obj in scene.objects" :key="obj.key">
<g
v-if="obj.building"
@ -182,6 +192,7 @@ const timers = computed(() => {
@keydown.enter.prevent="toggle(obj.building.id)"
@keydown.space.prevent="toggle(obj.building.id)"
>
<polygon v-if="obj.building.hit" class="hit" :points="obj.building.hit" />
<ellipse v-if="obj.building.ring.rx" class="ring" v-bind="obj.building.ring" />
<polygon v-for="(p, i) in obj.polys" :key="i" :points="p.points" :fill="p.fill" :stroke="p.stroke" />
<title>{{ label(obj.building) }}</title>
@ -201,23 +212,35 @@ const timers = computed(() => {
<!-- Level badges and countdowns. Flat colours only. -->
<g class="pointer-events-none" font-family="ui-sans-serif, system-ui, sans-serif" text-anchor="middle">
<g v-for="{ b, x, y } in badges" :key="`badge-${b.id}`" :transform="`translate(${x} ${y})`">
<g
v-for="{ b, x, y } in badges"
:key="`badge-${b.id}`"
class="pointer-events-auto cursor-pointer"
:transform="`translate(${x} ${y})`"
@click.stop="toggle(b.id)"
>
<circle
:r="10 * k"
:r="12 * k"
:fill="b.upgrading ? '#c49a2c' : '#f3e7c9'"
:stroke="selected === b.id ? '#7b1e16' : '#57391f'"
:stroke-width="1.6 * k"
/>
<text :y="4 * k" :font-size="11 * k" font-weight="700" :fill="b.upgrading ? '#1f150c' : '#2f2013'">{{ b.level }}</text>
<text :y="4.6 * k" :font-size="13 * k" font-weight="700" :fill="b.upgrading ? '#1f150c' : '#2f2013'">{{ b.level }}</text>
</g>
<g v-for="tm in timers" :key="`timer-${tm.orderId}`" :transform="`translate(${tm.x} ${tm.y})`">
<rect :x="-34 * k" :y="-10 * k" :width="68 * k" :height="19 * k" :rx="2 * k" fill="#2f2013" stroke="#c49a2c" :stroke-width="1.2 * k" />
<g :transform="`translate(${-24 * k} ${-0.5 * k}) scale(${k})`" fill="none" stroke="#d9b44a" stroke-width="1.4" stroke-linecap="round">
<g
v-for="tm in timers"
:key="`timer-${tm.orderId}`"
:class="tm.buildingId ? 'pointer-events-auto cursor-pointer' : ''"
:transform="`translate(${tm.x} ${tm.y})`"
@click.stop="tm.buildingId && toggle(tm.buildingId)"
>
<rect :x="-39 * k" :y="-11.5 * k" :width="78 * k" :height="22 * k" :rx="2 * k" fill="#2f2013" stroke="#c49a2c" :stroke-width="1.2 * k" />
<g :transform="`translate(${-27.5 * k} ${-0.5 * k}) scale(${1.15 * k})`" fill="none" stroke="#d9b44a" stroke-width="1.4" stroke-linecap="round">
<circle r="5" />
<path d="M0 -3v3l2 1.5" />
</g>
<text :x="6 * k" :y="4 * k" :font-size="11.5 * k" font-weight="700" fill="#f3e7c9" class="tabular-nums">
<text :x="7 * k" :y="4.6 * k" :font-size="13 * k" font-weight="700" fill="#f3e7c9" class="tabular-nums">
{{ formatDuration(secondsUntil(tm.finishesAt)) }}
</text>
</g>
@ -236,10 +259,17 @@ const timers = computed(() => {
outline: none;
}
.ring,
.plot {
.plot,
.hit {
fill: transparent;
stroke: transparent;
}
.band {
fill: none;
stroke: transparent;
pointer-events: stroke;
cursor: pointer;
}
.bld.is-selected .ring,
.plot.is-selected {
stroke: #7b1e16;

View File

@ -12,7 +12,7 @@ defineProps<{
<template>
<div
v-if="starvation.since"
class="flex flex-wrap items-center gap-x-3 gap-y-0.5 border border-blood-800 bg-blood-700 px-2 py-0.5 text-[13px] text-parchment-50"
class="flex flex-wrap items-center gap-x-3 gap-y-0.5 border border-blood-800 bg-blood-700 px-2 py-0.5 text-sm text-parchment-50"
role="alert"
>
<IconResource resource="food" class="size-5" />
@ -27,7 +27,7 @@ defineProps<{
</div>
<div
v-else-if="starvation.food_empty_at"
class="flex flex-wrap items-center gap-x-3 gap-y-0.5 border border-gold-600 bg-gold-400 px-2 py-0.5 text-[13px] text-ink-900"
class="flex flex-wrap items-center gap-x-3 gap-y-0.5 border border-gold-600 bg-gold-400 px-2 py-0.5 text-sm text-ink-900"
role="status"
>
<IconResource resource="food" class="size-5" />

View File

@ -25,7 +25,7 @@ function order(o: BuildOrder) {
<!-- The column beside the village: small boxes with the numbers that matter at a glance. -->
<template>
<aside class="space-y-2 p-2 text-[13px]">
<aside class="space-y-2 p-2 text-sm">
<section v-if="incoming.length" class="side-box border-blood-700">
<h2 class="side-title bg-blood-700 text-parchment-50">{{ $t('village.side.incoming') }}</h2>
<ul class="side-body">
@ -68,8 +68,10 @@ function order(o: BuildOrder) {
<p v-else class="text-ink-500">{{ $t('village.troops.none') }}</p>
<p v-if="village.population.training" class="text-xs text-ink-500">{{ $t('village.troops.training', { count: village.population.training }) }}</p>
<p v-if="commands" class="text-xs text-ink-500">{{ $t('village.side.commands') }}: {{ commands }}</p>
<NuxtLink :to="`${base}/recruit`" class="side-link">» {{ $t('village.side.recruit') }}</NuxtLink>
<NuxtLink :to="`${base}/rally`" class="side-link">» {{ $t('village.side.rally') }}</NuxtLink>
<div class="side-actions">
<NuxtLink :to="`${base}/recruit`" class="btn btn-outline">{{ $t('village.side.recruit') }}</NuxtLink>
<NuxtLink :to="`${base}/rally`" class="btn btn-outline">{{ $t('village.side.rally') }}</NuxtLink>
</div>
</div>
</section>
@ -107,7 +109,9 @@ function order(o: BuildOrder) {
</div>
<UiBar :value="spaceShare" :tone="spaceShare >= 1 ? 'rose' : 'emerald'" />
</div>
<NuxtLink :to="`${base}/build`" class="side-link">» {{ $t('village.screens.build') }}</NuxtLink>
<div class="side-actions">
<NuxtLink :to="`${base}/build`" class="btn btn-outline">{{ $t('village.screens.build') }}</NuxtLink>
</div>
</div>
</section>
</aside>
@ -120,12 +124,13 @@ function order(o: BuildOrder) {
@apply border border-wood-700 bg-parchment-50;
}
.side-title {
@apply border-b border-wood-700 bg-parchment-300 px-1.5 py-0.5 text-[13px] font-bold text-wood-950;
@apply border-b border-wood-700 bg-parchment-300 px-1.5 py-0.5 text-sm font-bold text-wood-950;
}
.side-body {
@apply space-y-0.5 px-1.5 py-1;
}
.side-link {
@apply block font-semibold text-blood-700 hover:underline;
/* Links to the screens as small buttons on one line, never wrapped. */
.side-actions {
@apply flex flex-nowrap gap-1 pt-1 whitespace-nowrap;
}
</style>

View File

@ -61,7 +61,7 @@ const reason = computed(() => {
</button>
<p v-else class="text-center text-xs font-semibold text-blood-700">{{ reason }}</p>
</div>
<NuxtLink :to="allLink" class="block text-sm font-semibold text-blood-700 hover:underline">» {{ $t('village.plot.all') }}</NuxtLink>
<NuxtLink :to="allLink" class="btn btn-outline w-full">{{ $t('village.plot.all') }}</NuxtLink>
</div>
</section>
</template>

View File

@ -74,7 +74,7 @@ function progress(o: RecruitOrder) {
type="button"
role="tab"
:aria-selected="m === current"
class="inline-flex items-center gap-1 border border-wood-800 px-2 py-0.5 text-[13px] font-semibold"
class="inline-flex items-center gap-1 border border-wood-800 px-2 py-0.5 text-sm font-semibold"
:class="m === current ? 'bg-wood-800 text-gold-400' : 'bg-parchment-200 text-wood-950 hover:bg-parchment-100'"
@click="selected = m.building_id"
>
@ -171,8 +171,7 @@ function progress(o: RecruitOrder) {
/>
<button
type="button"
class="w-12 text-left text-xs font-semibold tabular-nums"
:class="max(o) ? 'text-blood-700 hover:underline' : 'text-ink-400'"
class="btn-fill"
:title="$t('village.recruit.max_title')"
:disabled="!max(o)"
@click="amounts[o.unit] = max(o)"

View File

@ -19,7 +19,7 @@ defineProps<{
{{ title }}
<span v-if="level !== null" class="font-normal">({{ $t('village.buildings.level_n', { level }) }})</span>
</h1>
<p class="mt-0.5 max-w-[60rem] text-[13px] text-ink-700">{{ description }}</p>
<p class="mt-0.5 max-w-[60rem] text-sm text-ink-700">{{ description }}</p>
<slot />
</div>
</header>

View File

@ -82,7 +82,7 @@ function modeHint(m: VillageState['rally']['modes'][number]) {
<section class="panel">
<div class="panel-head">
<h2 class="panel-title">{{ $t('village.rally.send') }}</h2>
<button v-if="hasTroops" type="button" class="text-sm font-semibold text-blood-700 hover:underline" @click="all">
<button v-if="hasTroops" type="button" class="btn btn-outline" @click="all">
{{ $t('village.rally.all') }}
</button>
</div>
@ -112,7 +112,7 @@ function modeHint(m: VillageState['rally']['modes'][number]) {
/>
<button
type="button"
class="text-xs font-semibold tabular-nums text-blood-700 hover:underline disabled:text-ink-400 disabled:no-underline"
class="btn-fill"
:disabled="!home(unit)"
@click="amounts[unit] = home(unit)"
>

View File

@ -75,7 +75,7 @@ function submitLevy() {
/>
<button
type="button"
class="w-12 text-left text-xs font-semibold tabular-nums text-blood-700 hover:underline disabled:text-ink-400 disabled:no-underline"
class="btn-fill"
:title="$t('village.levy.all')"
:disabled="!villagers"
@click="draft = villagers"

View File

@ -53,6 +53,8 @@ export interface SceneBuilding {
ring: { cx: number; cy: number; rx: number; ry: number }
/** Only one part of the wall takes keyboard focus. */
focusable: boolean
/** Click target: the outline round everything drawn for it and its ground, a little wider. */
hit?: string
}
export interface SceneObject {
@ -99,6 +101,8 @@ export interface Scene {
smoke: V2[]
/** Roads villagers walk to work and back: a screen path, how many walk it, seconds per round trip. */
walks: { d: string; count: number; seconds: number }[]
/** A wide click band along the wall ring, so the thin wall is easy to hit. */
wallBand: { id: number; ring: { cx: number; cy: number; rx: number; ry: number }; width: number } | null
}
/** Buildings that smoke, from this level on. */
@ -128,6 +132,27 @@ function rayDistance(x: number, y: number, a: number) {
return along < 0 ? Math.hypot(x, y) : Math.abs(x * dy - y * dx)
}
/** Convex outline round a building's polygons and ground ring, grown by `grow` around its middle. */
function hitOutline(polys: Poly[], ring: { cx: number; cy: number; rx: number; ry: number }, grow = 1.12): string {
const pts: V2[] = polys.flatMap((p) => p.points.split(' ').map((xy) => xy.split(',').map(Number) as V2))
if (ring.rx) pts.push([ring.cx - ring.rx, ring.cy], [ring.cx + ring.rx, ring.cy], [ring.cx, ring.cy - ring.ry], [ring.cx, ring.cy + ring.ry])
if (pts.length < 3) return ''
pts.sort((a, b) => a[0] - b[0] || a[1] - b[1])
const cross = (o: V2, a: V2, b: V2) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0])
const half = (list: V2[]) => {
const out: V2[] = []
for (const p of list) {
while (out.length >= 2 && cross(out[out.length - 2]!, out[out.length - 1]!, p) <= 0) out.pop()
out.push(p)
}
return out.slice(0, -1)
}
const hull = [...half(pts), ...half([...pts].reverse())]
const cx = hull.reduce((n, p) => n + p[0], 0) / hull.length
const cy = hull.reduce((n, p) => n + p[1], 0) / hull.length
return hull.map(([x, y]) => `${(cx + (x - cx) * grow).toFixed(1)},${(cy + (y - cy) * grow).toFixed(1)}`).join(' ')
}
function screenRing(x: number, y: number, r: number) {
const [cx, cy] = project([x, y, 0])
return { cx, cy, rx: r * Math.SQRT2, ry: r * Math.SQRT1_2 }
@ -650,7 +675,15 @@ export function buildScene(village: VillageState, frame: number | { width: numbe
terrain: ground(view),
// One at a time, so the layers keep the order they were added in.
decals: [...decalFaces, ...shadows].flatMap((face) => toPolys([face])),
objects: objects.map(({ key, polys, building, planned }) => ({ key, polys, building, planned })),
// Wall segments keep their own outlines; the band below covers the stretches between.
objects: objects.map(({ key, polys, building, planned }) => ({
key,
polys,
building: building ? { ...building, hit: hitOutline(polys, building.ring) } : undefined,
planned,
})),
// Centred halfway up the palisade, so the band covers the wall itself, not only its foot.
wallBand: wall ? { id: wall.id, ring: { ...screenRing(0, 0, Rv), cy: -wallTop / 2 }, width: U * 1.6 + wallTop } : null,
plots,
timers,
smoke,

View File

@ -27,7 +27,7 @@ const subject = computed(() => {
<template>
<div class="p-2.5">
<NuxtLink :to="`/reports/${worldId}`" class="mb-3 inline-block text-sm font-semibold text-blood-700 hover:underline">‹ {{ $t('reports.back') }}</NuxtLink>
<NuxtLink :to="`/reports/${worldId}`" class="btn btn-outline mb-3">‹ {{ $t('reports.back') }}</NuxtLink>
<p v-if="error" class="alert mb-3" role="alert">{{ error }}</p>
<section v-if="report" class="panel">
<div class="panel-head">

View File

@ -54,8 +54,8 @@ const DOT = { won: 'bg-moss-600', losses: 'bg-gold-500', lost: 'bg-blood-700', i
<section class="panel min-w-0">
<p v-if="error" class="alert m-2" role="alert">{{ error }}</p>
<p v-if="!page" class="py-6 text-center text-[13px] text-ink-500">{{ $t('common.loading') }}</p>
<p v-else-if="!page.reports.length" class="py-6 text-center text-[13px] text-ink-500">{{ $t('reports.none') }}</p>
<p v-if="!page" class="py-6 text-center text-sm text-ink-500">{{ $t('common.loading') }}</p>
<p v-else-if="!page.reports.length" class="py-6 text-center text-sm text-ink-500">{{ $t('reports.none') }}</p>
<template v-else>
<table class="grid-table">
<thead>
@ -82,13 +82,13 @@ const DOT = { won: 'bg-moss-600', losses: 'bg-gold-500', lost: 'bg-blood-700', i
</table>
<div class="flex flex-wrap items-center gap-2 bg-parchment-200 px-1.5 py-1">
<label class="flex items-center gap-1 text-[13px]">
<label class="flex items-center gap-1 text-sm">
<input type="checkbox" :checked="allSelected" @change="toggleAll" />
{{ $t('reports.select_all') }}
</label>
<button type="button" class="btn btn-primary" :disabled="busy || !selected.length" @click="remove(selected)">{{ $t('reports.delete') }}</button>
<button v-if="page.unread" type="button" class="btn btn-outline" :disabled="busy" @click="readAll()">{{ $t('reports.read_all') }}</button>
<div v-if="page.pages > 1" class="ml-auto flex items-center gap-1 text-[13px]">
<div v-if="page.pages > 1" class="ml-auto flex items-center gap-1 text-sm">
<button type="button" class="btn btn-ghost" :disabled="busy || page.page <= 1" @click="load(page.page - 1)">‹ {{ $t('reports.prev') }}</button>
<span class="tabular-nums text-ink-700">{{ $t('reports.page', { page: page.page, pages: page.pages }) }}</span>
<button type="button" class="btn btn-ghost" :disabled="busy || page.page >= page.pages" @click="load(page.page + 1)">{{ $t('reports.next') }} ›</button>

View File

@ -60,7 +60,7 @@ async function resetMock() {
</div>
<!-- The start direction: a small compass of five buttons. -->
<div v-if="choosing === w.id && !w.village_id" class="w-full border border-wood-700 bg-parchment-200 p-2">
<p class="text-[13px] font-semibold">{{ $t('worlds.start') }}</p>
<p class="text-sm font-semibold">{{ $t('worlds.start') }}</p>
<p class="mb-2 text-xs text-ink-500">{{ $t('worlds.start_hint') }}</p>
<div class="grid w-64 grid-cols-2 gap-1">
<button