Merge colony overview with current viewer preferences

This commit is contained in:
coyotte508 2026-10-04 11:33:07 +02:00
commit 8ea842be0f
10 changed files with 1105 additions and 560 deletions

View file

@ -163,3 +163,17 @@ use the native BGS mechanism: declared as `expansions: [{ name, label }]` on the
gameinfo doc, the chosen names arrive in `wrapper.init`'s `expansions: string[]`
param and the wrapper maps `kicker` onto the internal `options.kicker` flag (also
kept working for games created back when it was a checkbox option).
## BGS publication and Git delivery
Whenever changes are published to BGS, commit the corresponding source, tests,
dependency/lockfile changes and version bumps, then push them to this repository's
`main` or `master` release branch in the same task. A BGS upload or a push only to
a feature branch does not complete delivery. This is standing authorization to
commit and push published changes without asking for separate confirmation.
Fetch and integrate the latest release-branch changes, run the relevant repository
checks, and push without force. Update any public mirrors required by this repo's
existing workflow too. Keep credentials, generated artifacts excluded by the repo,
and unrelated unfinished work out of the commit. Verify the remote branch contains
the delivered commit and report any blocker instead of claiming delivery.

View file

@ -0,0 +1,33 @@
<meta charset="utf-8" />
<title>Outpost — colony design preview</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<div id="app" style="max-width: 1200px; margin: 16px auto; padding: 0 16px"></div>
<script type="module">
import { mount } from "svelte";
import ColonyScene from "./src/lib/ColonyScene.svelte";
import { initGame } from "../engine/src/moves.ts";
import "./src/lib/theme.css";
const state = initGame(3, { kicker: true }, "colony-review");
state.round = 14;
state.players[0].name = "Developed colony";
state.players[0].factories = [
{ type: "ore", manned: true },
{ type: "ore", manned: false },
{ type: "water", manned: true },
{ type: "titanium", manned: true },
{ type: "research", manned: true },
{ type: "newChemicals", manned: true },
{ type: "water", manned: false },
{ type: "titanium", manned: true },
];
for (const upgrade of Object.keys(state.players[0].upgrades)) {
state.players[0].upgrades[upgrade] = 1;
}
for (const kicker of Object.keys(state.players[0].kickers)) {
state.players[0].kickers[kicker] = 1;
}
state.players[1].name = "Idle colony";
state.players[2].name = "Starting colony";
state.players[1].factories.forEach((f) => (f.manned = false));
mount(ColonyScene, { target: document.querySelector("#app"), props: { state, playerIndex: 0 } });
</script>

View file

@ -10,6 +10,7 @@
import LogFeed from "./lib/LogFeed.svelte";
import ChatPanel from "./lib/ChatPanel.svelte";
import SpaceScene from "./lib/SpaceScene.svelte";
import ColonyScene from "./lib/ColonyScene.svelte";
interface Props {
store: ViewerStore;
@ -20,7 +21,7 @@
const state = $derived(store.state);
</script>
<SpaceScene gameState={state} {store} />
<SpaceScene />
{#if state}
<div class="board">
@ -57,6 +58,9 @@
<MarketPanel {state} {store} />
</div>
</div>
{#if store.preferences.showColony !== false}
<ColonyScene {state} {store} playerIndex={store.playerIndex} locale={store.preferences.locale} />
{/if}
</div>
</div>
{:else}

View file

@ -18,7 +18,17 @@ if (kicker) {
}
const emitter = window.outpost.launch("#app");
mountSoundTests((sound) => emitter.emit("preferences", { sound }));
const previewPreferences = { sound: true, showColony: true };
mountSoundTests(
(sound) => {
previewPreferences.sound = sound;
emitter.emit("preferences", { ...previewPreferences });
},
(showColony) => {
previewPreferences.showColony = showColony;
emitter.emit("preferences", { ...previewPreferences });
}
);
startDevBackend(emitter, { players, seed, auto, delayMs, gameOptions });
(window as unknown as { outpostDev?: unknown }).outpostDev = {

View file

@ -0,0 +1,313 @@
<script lang="ts">
import type { FactoryType, MarketCard, Resource } from "outpost-engine";
import ResourceIcon from "./ResourceIcon.svelte";
let {
type,
resource,
idle = false,
}: { type: FactoryType | MarketCard; resource?: Resource; idle?: boolean } = $props();
const marks: Partial<Record<FactoryType | MarketCard, string>> = {
ore: "translate(-8 -15)",
water: "translate(2 -18)",
titanium: "translate(-7 -26)",
research: "translate(-9 -20)",
newChemicals: "translate(6 -14)",
scientists: "matrix(.85 -.42 0 1 -1 -6)",
orbitalLab: "translate(-8 -32)",
spaceStation: "translate(-8 -38)",
planetaryCruiser: "matrix(.9 -.45 .6 .3 -2 -17)",
moonBase: "translate(4 -16)",
};
</script>
<g class="model" class:idle data-building-type={type}>
{#if type === "ore"}
<path class="dark" d="M-34-5 0-22 33-6 0 12Z" /><path class="metal" d="M-25-10-7-54 4-49 22 7 12 12-3-33-17-5Z" />
<path class="line" d="M-22-12 13-1M-15-29 7-20M-9-44 2-37M-7-54 20-42 29-11M20-42V-14" />
<path class="light" d="m14-16 14-7 8 10-15 8z" /><path class="body" d="M-13-15 10-4V12L-13 1Z" />
{:else if type === "water"}
<path class="body" d="M-30-9V-36Q-17-49-4-36V-9Q-17 2-30-9" /><ellipse
class="light"
cx="-17"
cy="-36"
rx="13"
ry="6"
/>
<path class="metal" d="M-5 3V-29Q10-43 25-29V3Q10 16-5 3" /><ellipse
class="light"
cx="10"
cy="-29"
rx="15"
ry="7"
/>
<path class="line" d="M-28-21-7-13M-1-2Q10 4 22-2" />
{:else if type === "titanium"}
<path class="dark" d="M-31-2 0-18 32-2 0 15Z" /><path class="body" d="M-20-2-12-55 12-55 21-2 0 9Z" /><ellipse
class="light"
cy="-55"
rx="12"
ry="6"
/>
<path class="metal" d="M21 0V-35L33-41V-57H39V-36L28-30V4Z" /><path class="line" d="M-16-36H16M-19-13 0-5 19-13" />
<path class="glow" d="M-7-1V-8H7V-1Z" />
{:else if type === "research"}
<path class="body" d="M-31-6 0-22 31-6V3L0 17-31 3Z" /><path class="glass" d="M-27-7Q-28-52 0-55Q28-42 27-7L0 6Z" />
<path class="line" d="M0-55V6M-20-34 0-25 23-35M24-15V-67" /><circle class="accent" cx="24" cy="-68" r="2" />
{:else if type === "newChemicals"}
<path class="dark" d="M-33-5 0-21 33-5 0 12Z" />
<path class="body" d="M-29-6V-52Q-23-61-17-52V-6M-12 0V-63Q-6-70 0-63V0M5 4V-43Q12-52 19-43V4" />
<path class="line" d="M-29-38H-17M-12-49H0M-29-23H-17M-12-31H0M-17-46-12-43M0-36 6-32" />
<path class="metal" d="M0-17 24-27 33-21V3L10 13 0 7Z" /><path class="light" d="M0-17 10-11 33-21 24-27Z" />
{:else if type === "dataLibrary"}
<path class="body" d="M-29-31 5-47 30-34V0L-4 16-29 3Z" /><path class="light" d="M-29-31 5-47 30-34-4-18Z" />
<path class="line" d="M-4-18V16M3-15 24-25M3-7 24-17M3 1 24-9" /><path
class="accent"
d="M-22-23-12-18M-22-14-12-9M-22-5-12 0"
/>
<path class="metal" d="M-9-38V-54L5-61 17-54V-43" />
{:else if type === "warehouse"}
<path class="body" d="M-35-9V-22Q-17-52 2-29L34-15V4L-2 20Z" /><path
class="light"
d="M-35-22Q-17-52 2-29L34-15Q15-38-3-15Z"
/>
<path class="dark" d="M4-8 27-18V2L4 13Z" /><path
class="line"
d="M7-4 24-12M7 1 24-7M7 6 24-2M-25-28 6-14M-14-33 17-19"
/>
{:else if type === "heavyEquipment"}
<path class="dark" d="M-34-5 5-23 31-10V1L-8 19-34 7Z" /><path class="line" d="m-29 5 19 8 36-17m-48-6 20 8" />
<path class="metal" d="M-18-20 5-30 20-22V-6L-2 5-18-3Z" /><path class="glass" d="M-12-19 3-26V-12L-12-5Z" />
<path class="light" d="M13-19 20-53 30-57 40-19 33-16 25-43 21-14Z" /><path
class="body"
d="M30-16 43-22 47-6 32 0Z"
/>
{:else if type === "nodule"}
<path class="body" d="M-35-4-27-29-7-38 5-12 35 0 18 15-4 5-16 11Z" />
<path class="light" d="M-27-29-7-38 10-30 5-12Z" /><path class="glass" d="M-24-18-14-22-9-10-19-6Z" />
<path class="metal" d="M3-12 22-22 35 0 18 9Z" /><path class="line" d="M-27-2-13 4M12-9 24-14M20 1 28-3" />
{:else if type === "scientists"}
<path class="body" d="M-13-9 11-20 30-11V6L6 17-13 8Z" /><path class="light" d="M-13-9 11-20 30-11 6 0Z" />
<path class="line" d="M-24 4V-38M1-8V-54M-33-53-13-31M-11-64 13-43" />
<path class="dish" d="M-39-47Q-16-52-11-23Q-33-24-39-47ZM-13-61Q12-66 17-38Q-7-39-13-61Z" />
<circle class="accent" cx="-25" cy="-37" r="2" />
{:else if type === "orbitalLab"}
<path class="line" d="M-15 9 0-19 16 10M0-19V-41" />
<path class="solar" d="M-43-44-16-33-16-17-43-28ZM16-34 43-47V-30L16-17Z" />
<path class="line" d="M-36-41V-25M-27-38V-21M24-38V-21M34-43V-26" />
<path class="metal" d="M-12-36 0-43 13-36V-16L0-9-12-16Z" /><path class="line" d="M0-43V-64M-9-58H9" />
{:else if type === "robots"}
<path class="dark" d="M-33 0 0-17 32 0 0 17Z" /><path class="metal" d="M-29 0V-48L12-67 17-61-23-41V4Z" />
<path class="line" d="M12-65V-28M-23-40 16-21M-4-4V-25L12-38 24-21" /><circle
class="light"
cx="12"
cy="-38"
r="5"
/>
<path class="body" d="M-10-13 1-18 11-13V1L0 6-10 1Z" /><path class="accent" d="M18-21 25-18 30-25" />
{:else if type === "laboratory"}
<path class="body" d="M-35 0-12-51 5-44 35-1 5 15Z" /><path class="glass" d="M-12-51 5-44 35-1 13-7Z" />
<path class="light" d="M-35 0-12-51 13-7 5 15Z" /><path class="glass" d="M-25-4-12-32 2-7-3 4Z" />
<path class="line" d="M-12-32-12-4M-21-12-4-4M12-28 27-13" />
{:else if type === "ecoplants"}
<path class="body" d="M-39-6-5-24 35-7V4L0 22-39 6Z" /><path
class="glass"
d="M-39-6Q-28-42-5-24L35-7Q11-23 0 11Z"
/>
<path class="line" d="M-28-12Q-19-34-8-18M-16-6Q-7-26 5-12M-3 0Q7-19 18-6" />
<path class="green" d="m-24-6 4-12 5 10m5 8 4-12 5 10m6 8 4-12 5 10" />
{:else if type === "outpost"}
<path class="body" d="M-31-3 0-18 32-3V8L0 22-31 8Z" /><path class="metal" d="M-12-6V-48L5-56 19-48V-6L3 2Z" />
<path class="light" d="M-20-45 3-57 28-45 5-32Z" /><path class="glass" d="M-20-45 5-32 28-45V-33L5-20-20-33Z" />
<path class="line" d="M3-57V-77M3-74 20-68 3-62" />
{:else if type === "spaceStation"}
<path class="line" d="M-26 8-15-22M25 8 15-22M0 15V-21" />
<ellipse class="ring" cy="-34" rx="38" ry="20" /><ellipse class="line" cy="-35" rx="30" ry="14" />
<path class="metal" d="M-8-45 3-51 13-45V-23L2-17-8-23Z" /><path class="line" d="M-36-35H-8M13-35H36M2-51V-68" />
{:else if type === "planetaryCruiser"}
<path class="dark" d="M-37 3 12-22 40-8-6 17Z" />
<path class="body" d="M-37-12-17-35-3-31 30-38 44-33 23-13 8-6-9 3Z" />
<path class="light" d="M-37-12-17-35-8-17 30-38 44-33 2-9-9 3-13-14Z" />
<path class="metal" d="M-28-29-19-34-8-13-16-8Z M-13-3-4-8 3 5-6 10Z" />
<path class="glass" d="M16-27 30-33 25-23 10-17Z" /><path class="accent" d="m-26-14 7-4m9 23 7-4" />
<path class="line" d="M-21-6V4M7 0V10M27-22V-10" />
{:else if type === "moonBase"}
<path class="body" d="M-38 0-17-10 33-4 39 5 9 19Z" /><path class="metal" d="M-20-7 4-19 21-11 1 2Z" />
<path class="light" d="M-38-1Q-42-33-22-34Q-2-23-6 2L-20 9Z M0 4Q-1-28 18-28Q37-15 34 5L17 14Z" />
<path class="line" d="M-22-34-20 9M18-28 17 14M-34-11-9-6M3-4 31-2" />
{:else if type === "iceProspector"}
<path class="dark" d="M-29-1 10-20 31-10V2L-8 20-29 10Z" /><path
class="metal"
d="M-22-16 3-28 22-16V0L-4 12-22 1Z"
/>
<path class="glass" d="M-19-15 1-24V-11L-19-2Z" /><path class="light" d="M15-24 24-29 40 1 31 6Z" />
<path class="line" d="M24-22 32-26M28-15 36-19M32-8 40-12M-23 8-6 15 28-1" />
{:else if type === "robotPrototype"}
<path class="metal" d="M-13-28 0-35 14-28V-10L0-3-13-10Z" /><path
class="light"
d="M-10-44 2-50 13-44V-31L1-25-10-31Z"
/>
<path class="glass" d="M-5-40 9-40V-35H-5Z" /><path
class="line thick"
d="M-13-24-26-12-20-3M14-24 27-14 23-5M-7-8-13 8-23 12M7-7 13 10 24 14"
/>
{:else if type === "smelter"}
<path class="body" d="M-33-4V-32L-12-42 7-33V0L-12 10Z" /><path class="light" d="M-33-32-12-42 7-33-13-23Z" />
<path class="dark" d="M-25-10V-23L-14-18V-4Z" /><path
class="metal"
d="M8-13Q21-23 35-13L30 5Q20 13 12 5Z"
/><ellipse class="ember" cx="21" cy="-13" rx="13" ry="6" />
<path class="line" d="M3-16 10-10M-22-37V-62H-14V-37" />
{:else if type === "wilyTrader"}
<path class="body" d="M-35-12-17-29 12-24 35-6 24 7-15 7Z" /><path class="light" d="M-17-29 12-24 22-11-6-7Z" />
<path class="glass" d="M-29-12-16-23-9-12-18-3Z" /><path class="metal" d="M-5-7 21-12V3L-5 9Z" /><path
class="line"
d="M2-7V6M11-9V4M-25 1V11M21 6V15"
/>
{:else if type === "launchFacility"}
<path class="dark" d="M-33 2 0-14 35 2 0 19Z" /><path
class="line"
d="M-26 5V-67H-9M-26-47H-8M-26-27H-8M-26-67-13-47-26-27-13-7"
/>
<path class="light" d="M-5-7V-47Q-5-66 4-76Q14-62 14-47V-7Z" /><path
class="metal"
d="M-5-21-15-5-5-8M14-21 25-5 14-8"
/>
<path class="glass" d="M-3-44H12V-34H-3Z" /><path class="dark" d="M-3-7H12L9 1H0Z" />
{:else if type === "merchantHouse"}
<path class="body" d="M-33-5 0-21 33-5V8L0 23-33 8Z" /><path class="light" d="M-38-28 0-47 39-29 0-10Z" />
<path class="line" d="M-31-25V6M0-11V21M32-25V6" /><path
class="accent"
d="M-30-31-15-23M-14-39 2-31M2-44 18-36M17-37 33-29"
/>
<path class="metal" d="M-22-4-9-10 3-4-10 2ZM4 7 17 1 27 6 14 12Z" />
{:else if type === "ncfPrototype"}
<path class="line" d="M-26 7V-52H23V7M-26-52-9-64H37V-6M23-52 37-64M-26 7 23 7" />
<ellipse class="glass" cx="-1" cy="-27" rx="19" ry="23" /><path class="metal" d="M-20-29 18-29V-23H-20Z" /><path
class="line"
d="M-1-50V-61M-1-4V8"
/>
<circle class="accent" cx="-1" cy="-36" r="4" />
{:else if type === "refinery"}
<path class="body" d="M-32 0V-51H-22V0M-16 6V-69H-6V6M1 10V-43H11V10" />
<path class="light" d="M-34-52-27-56-20-52-27-48ZM-18-70-11-74-4-70-11-66ZM-1-44 6-48 13-44 6-40Z" />
<path class="line" d="M-27-42H-11V-24H6M-29-27H-24M-14-53H-9M-14-36H-9M3-22H8" />
<ellipse class="metal" cx="26" cy="-5" rx="13" ry="17" /><path class="line" d="M15-5H37" />
{:else if type === "biosphere"}
<ellipse class="body" cy="5" rx="40" ry="18" /><path
class="green"
d="M-20 6-16-21-12 6M-3 11 2-24 7 11M16 6 21-14 26 6"
/>
<path class="glass translucent" d="M-40 5Q-42-58 0-65Q43-45 40 5Q0 34-40 5Z" />
<path class="line" d="M0-65-24-32-40 5M0-65 24-32 40 5M-24-32H24L0 16ZM-40 5 0 16 40 5M-24-32-22 20M24-32 22 20" />
{/if}
{#if resource && marks[type]}
<g transform={marks[type]}><g class="factory-mark"><ResourceIcon {resource} size={16} /></g></g>
{/if}
</g>
<style>
.model {
stroke-linejoin: bevel;
}
.body {
fill: #344954;
stroke: #79919e;
stroke-width: 0.9;
}
.metal {
fill: #4b6472;
stroke: #8ca2ad;
stroke-width: 0.9;
}
.light {
fill: #6e8792;
stroke: #a8bbc3;
stroke-width: 0.8;
}
.dark {
fill: #16242e;
stroke: #4d6573;
stroke-width: 0.8;
}
.glass {
fill: #365969;
stroke: #96bcc9;
stroke-width: 1;
}
.line {
fill: none;
stroke: #91a8b5;
stroke-width: 1.3;
}
.thick {
stroke-width: 6;
}
.solar {
fill: #233e55;
stroke: #6c9ab3;
stroke-width: 1;
}
.dish {
fill: #708a97;
stroke: #abc1c9;
stroke-width: 1;
}
.ring {
fill: none;
stroke: #718c9a;
stroke-width: 10;
}
.green {
fill: #477a62;
stroke: #78a18b;
stroke-width: 2;
}
.translucent {
fill: #456e804a;
}
.accent {
fill: var(--resource);
stroke: var(--resource);
stroke-width: 2;
}
.ember,
.glow {
fill: #bb8c55;
}
.factory-mark {
color: var(--resource);
opacity: 0.28;
}
:global(.working) .factory-mark {
opacity: 1;
animation: colony-resource-pulse 3s ease-in-out infinite;
animation-delay: var(--delay, 0s);
}
:global(.paused) .factory-mark {
animation-play-state: paused;
}
:global(.district-preview) .factory-mark {
animation: none;
}
.idle .body,
.idle .metal,
.idle .light,
.idle .glass {
fill: #29353f;
stroke: #4b5b64;
}
.idle .glow,
.idle .ember {
fill: #384149;
}
@keyframes colony-resource-pulse {
50% {
opacity: 0.55;
}
}
@media (prefers-reduced-motion: reduce) {
:global(.working) .factory-mark {
animation: none;
}
}
</style>

View file

@ -0,0 +1,685 @@
<script lang="ts">
import { onMount } from "svelte";
import {
KICKERS,
KICKER_SPECS,
UPGRADE_SPECS,
type GameState,
type Upgrade,
type Resource,
type FactoryType,
type MarketCard,
FACTORIES,
MIN_CARD_VALUE,
MAX_CARD_VALUE,
MEGA_CARDS,
} from "outpost-engine";
import ColonyBuilding from "./ColonyBuilding.svelte";
import CardEffect from "./CardEffect.svelte";
import ResourceIcon from "./ResourceIcon.svelte";
import { RESOURCE_LABELS, type ViewerStore, UPGRADE_EFFECTS, KICKER_EFFECTS, type EffectToken } from "./store.svelte";
let {
state: gameState,
store,
playerIndex,
locale,
}: { state: GameState; store: ViewerStore; playerIndex?: number; locale?: unknown } = $props();
let chosen = $state<number | null>(null);
let page = $state(0);
let selected = $state<string | null>(null);
let paused = $state(false);
let root = $state<HTMLElement | undefined>();
let offscreen = $state(false);
let background = $state(false);
onMount(() => {
const observer = new IntersectionObserver(([entry]) => {
offscreen = !entry?.isIntersecting;
});
if (root) {
observer.observe(root);
}
const visibility = () => {
background = document.hidden;
};
visibility();
document.addEventListener("visibilitychange", visibility);
return () => {
observer.disconnect();
document.removeEventListener("visibilitychange", visibility);
};
});
const seat = $derived(chosen ?? playerIndex ?? 0);
const player = $derived(gameState.players[seat] ?? gameState.players[0]!);
const colors: Record<string, string> = {
ore: "#a8bac6",
water: "#5aa5e0",
titanium: "#dab260",
research: "#a397dc",
newChemicals: "#d095bd",
microbiotics: "#77b989",
orbitalMedicine: "#76c9c0",
ringOre: "#d19a74",
moonOre: "#c6bc83",
};
interface Site {
id: string;
name: string;
type: FactoryType | MarketCard;
color: string;
working: boolean;
factory: boolean;
resource?: Resource;
points: number;
price: number;
effect?: EffectToken[];
}
const sites = $derived.by((): Site[] => {
const result: Site[] = player.factories.map((f, i) => ({
id: `f${i}`,
name: RESOURCE_LABELS[f.type] ?? f.type,
type: f.type,
color: colors[f.type]!,
working: f.manned,
factory: true,
resource: f.type,
points: FACTORIES[f.type].vp,
price: FACTORIES[f.type].cost,
}));
for (const type of Object.keys(player.upgrades) as Upgrade[]) {
for (let n = 0; n < player.upgrades[type]; n++) {
const spec = UPGRADE_SPECS[type];
result.push({
id: `u${type}${n}`,
name: spec.name,
type,
color: colors[spec.produces ?? "ore"]!,
working: !!spec.produces,
resource: spec.produces,
points: spec.vp,
price: spec.price,
effect: UPGRADE_EFFECTS[type],
factory: false,
});
}
}
for (const type of KICKERS) {
for (let n = 0; n < player.kickers[type]; n++) {
result.push({
id: `k${type}${n}`,
name: KICKER_SPECS[type].name,
points: KICKER_SPECS[type].vp,
price: KICKER_SPECS[type].price,
effect: KICKER_EFFECTS[type],
type,
color: "#8daeba",
working: false,
factory: false,
});
}
}
return result;
});
const pages = $derived(Math.max(1, Math.ceil(sites.length / 8)));
const currentPage = $derived(Math.min(page, pages - 1));
const visible = $derived(sites.slice(currentPage * 8, currentPage * 8 + 8));
const focused = $derived(sites.find((s) => s.id === selected));
const working = $derived(player.factories.filter((f) => f.manned).length);
function switchPlayer(value: string) {
chosen = Number(value);
page = 0;
selected = null;
}
</script>
{#snippet building(site: Site, number: number)}
<path class="pad" d="M-48 0 0-23 49 0 0 24Z" />
<path d="M-38-72H38V23H-38Z" fill="transparent" pointer-events="all" />
<path class="shadow" d="M-12-10 48 12 74 0 17-25Z" />
<ColonyBuilding type={site.type} resource={site.resource} idle={site.factory && !site.working} />
<path d="M-36 5-9 18" class="ownership" />
<circle cx="0" cy="23" r="2.5" class="status" />
<text x="-36" y="24">{String(number).padStart(2, "0")}</text>
{/snippet}
<section
class="colony"
style:--owner={store.playerColor(seat)}
bind:this={root}
class:paused={paused || offscreen || background}
>
<header>
<div class="identity">
<span class="signal"></span><span>Colony surface</span><span class="sector"
>{String(seat + 1).padStart(2, "0")}</span
>
</div>
<div class="controls">
<button
class="motion"
aria-pressed={paused}
aria-label={paused ? "Resume motion" : "Pause motion"}
title={paused ? "Resume motion" : "Pause motion"}
onclick={() => (paused = !paused)}
>
<svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true"
>{#if paused}<path d="m8 5 11 7-11 7z" fill="currentColor" />{:else}<path
d="M8 5v14M16 5v14"
stroke="currentColor"
stroke-width="4"
/>{/if}</svg
>
</button>
</div>
</header>
<nav class="player-tabs" aria-label="View colony">
{#each gameState.players as p, i}
<button
class="player-tab"
style:--player={store.playerColor(i)}
aria-pressed={seat === i}
onclick={() => switchPlayer(String(i))}
title={p.name}
>
<span class="player-number">{i + 1}</span><span class="player-name">{p.name}</span>
</button>
{/each}
</nav>
<div class="colony-frame">
<div class="viewport">
<div class="telemetry">
<span>{player.name}</span>
<span
class="staffing"
role="img"
aria-label={`${working}/${player.factories.length} factories staffed`}
title="Staffed factories"
>
<svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true"
><path d="M3 20V10l6-4v5l6-4v6h6v7Z" /><path d="M17 13V3h3v10M7 16v2m5-2v2m5-2v2" /></svg
>
{working}/{player.factories.length}
</span>
</div>
<svg viewBox="0 0 900 430" role="group" aria-label="Colony buildings">
<defs>
<radialGradient id="colony-haze"
><stop stop-color="#334f60" stop-opacity=".45" /><stop
offset="1"
stop-color="#13202a"
stop-opacity="0"
/></radialGradient
>
<linearGradient id="colony-ground" x2="0.7" y2="1"
><stop stop-color="#303e47" /><stop offset="1" stop-color="#19252d" /></linearGradient
>
<pattern id="colony-grain" width="37" height="29" patternUnits="userSpaceOnUse"
><circle cx="7" cy="13" r=".8" fill="#80939b" opacity=".25" /><path
d="m20 22 3 -1 2 2"
fill="none"
stroke="#0d1922"
/></pattern
>
</defs>
<ellipse cx="450" cy="225" rx="420" ry="195" fill="url(#colony-haze)" />
<path d="M65 217 388 55 836 244 498 417Z" fill="#091219" />
<path d="M65 202 388 40 836 229 498 402 65 220Z" fill="#111e27" stroke="#3d515f" />
<path d="M65 202 388 40 836 229 498 387Z" fill="url(#colony-ground)" stroke="#627481" stroke-opacity=".5" />
<path d="M65 202 388 40 836 229 498 387Z" fill="url(#colony-grain)" />
<path
d="m155 239 319-160m-251 190 319-161m-250 190 320-161m-251 190 320-161m-250 190 318-160M134 167l433 185M204 132l433 185M273 97l433 185M342 62l433 185"
fill="none"
stroke="#72899a"
stroke-opacity=".12"
/>
{#each visible as site, i (site.id)}
{@const x = 345 + (i % 4) * 91 - Math.floor(i / 4) * 155}
{@const y = 119 + (i % 4) * 39 + Math.floor(i / 4) * 80}
<g
transform="translate({x} {y})"
style:--resource={site.color}
style:--delay="{-i * 0.6}s"
class:working={site.working}
class:idle={site.factory && !site.working}
class:chosen={selected === site.id}
class="site"
role="button"
tabindex="0"
aria-label={`${site.name}${site.factory ? ` (${site.working ? "manned" : "unmanned"})` : ""}`}
aria-pressed={selected === site.id}
onclick={() => (selected = site.id)}
onkeydown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
selected = site.id;
}
}}
>
{@render building(site, currentPage * 8 + i + 1)}
</g>
{/each}
</svg>
<div class="coordinate">OUTPOST / {String(gameState.round).padStart(3, "0")}</div>
</div>
{#if pages > 1}
<nav class="district-strip" aria-label="Colony districts">
{#each Array.from({ length: pages }, (_, i) => i) as district}
{@const contents = sites.slice(district * 8, district * 8 + 8)}
<button
class="district-card"
aria-label={`District ${district + 1}`}
aria-pressed={currentPage === district}
title={contents.map((site) => site.name).join(", ")}
onclick={() => {
page = district;
selected = null;
}}
>
<svg class="district-preview" viewBox="80 15 750 390" aria-hidden="true" focusable="false">
<path d="M65 202 388 40 836 229 498 387Z" fill="#24343f" stroke="#5e7482" stroke-width="3" />
{#each contents as site, i}
<g
transform="translate({345 + (i % 4) * 91 - Math.floor(i / 4) * 155} {119 +
(i % 4) * 39 +
Math.floor(i / 4) * 80})"
style:--resource={site.color}
class:working={site.working}
class:idle={site.factory && !site.working}
>
{@render building(site, district * 8 + i + 1)}
</g>
{/each}
</svg>
<span class="district-label"
><span>District {district + 1}</span><span class="district-range"
>{district * 8 + 1}–{district * 8 + contents.length}</span
></span
>
</button>
{/each}
</nav>
{/if}
</div>
<footer>
<div class="readout" aria-live="polite">
{#if focused}
<span class="building-name" style:color={focused.color}>
{#if focused.resource}<ResourceIcon resource={focused.resource} size={18} />{:else}<svg
class="ui-icon"
viewBox="0 0 24 24"
aria-hidden="true"><path d="m3 8 9-5 9 5v10l-9 4-9-4Zm0 0 9 5 9-5M12 13v9" /></svg
>{/if}
<strong>{focused.name}</strong>
</span>
{#if focused.factory}
<span
class="operation"
class:operating={focused.working}
title={focused.working ? "Factory operating" : "Factory idle"}
>
<svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true">
<circle cx="12" cy="12" r="9" />
{#if focused.working}<path d="m9 7 8 5-8 5z" fill="currentColor" stroke="none" />{:else}<path
d="M9 8v8m6-8v8"
stroke-width="2.5"
/>{/if}
</svg>
{focused.working ? "Operating" : "Idle"}
</span>
{/if}
<span class="building-stat">{focused.points} VP{focused.factory ? " when staffed" : ""}</span>
<span class="building-stat">{focused.factory ? "Build cost" : "Minimum bid"}: ◈ {focused.price}</span>
<div class="building-details">
{#if focused.factory}
{@const type = focused.type as FactoryType}
{@const spec = FACTORIES[type]}
<p class="production-detail">
<ResourceIcon resource={type} size={16} />
<span
>Produces 1 {focused.name} card per round when staffed, worth ◈ {MIN_CARD_VALUE[type]}–{MAX_CARD_VALUE[
type
]}.</span
>
</p>
<p>
{focused.working
? "Operated by one colonist or robot."
: "No operator assigned. This factory produces no cards and scores no VP until staffed."}
</p>
{#if MEGA_CARDS[type]}<p>
Every 4 staffed {focused.name} factories can produce one Mega card worth ◈ {MEGA_CARDS[type]!.value} instead
of 4 singles.
</p>{/if}
{#if spec.requires}<p>
Building this factory requires <strong>{UPGRADE_SPECS[spec.requires].name}</strong>.
</p>{/if}
{#if spec.needsResearchCard}<p>
Building this factory requires at least one Research card in the payment.
</p>{/if}
{:else if focused.effect}
<p><CardEffect tokens={focused.effect} {locale} /></p>
{#if focused.resource}<p>Production is automatic; no colonist or robot is needed.</p>{/if}
{/if}
</div>
{:else}<span>Select a building to inspect it.</span>{/if}
</div>
</footer>
</section>
<style>
.colony {
border-top: 1px solid var(--line);
margin-top: 10px;
color: var(--text-mid);
}
header,
footer,
.controls,
.identity,
nav {
display: flex;
align-items: center;
gap: 12px;
}
header {
justify-content: space-between;
padding: 12px 0;
flex-wrap: wrap;
}
.identity {
text-transform: uppercase;
font: 11px var(--font-console);
letter-spacing: 1.5px;
}
.signal {
width: 6px;
height: 6px;
background: var(--owner);
box-shadow: 0 0 10px var(--owner);
}
.sector {
color: var(--owner);
}
.controls {
flex-wrap: wrap;
gap: 6px;
}
button {
color: var(--text-mid);
background: #14202a;
border: 1px solid var(--line);
border-radius: 2px;
padding: 7px 10px;
font: 11px var(--font-console);
min-height: 32px;
color-scheme: dark;
}
button {
cursor: pointer;
}
button:disabled {
opacity: 0.35;
cursor: default;
}
.player-tabs {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-bottom: 8px;
}
.player-tab {
display: flex;
align-items: center;
gap: 8px;
max-width: 200px;
min-width: 0;
background: transparent;
border-color: transparent;
border-bottom: 2px solid transparent;
}
.player-tab[aria-pressed="true"] {
color: var(--text);
border-bottom-color: var(--player);
background: color-mix(in srgb, var(--player) 10%, transparent);
}
.player-number {
color: var(--player);
font-size: 10px;
}
.player-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.colony-frame {
border: 1px solid #2b3b47;
background: #0c131d;
}
.district-strip {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(104px, 132px));
gap: 8px;
padding: 10px;
border-top: 1px solid #2b3b47;
}
.district-card {
padding: 4px;
text-align: left;
background: #101c26;
border: 1px solid #2b3b47;
min-width: 0;
}
.district-card[aria-pressed="true"] {
border-color: var(--owner);
background: color-mix(in srgb, var(--owner) 10%, #101c26);
box-shadow: inset 0 -2px var(--owner);
color: var(--text);
}
.district-card:focus-visible {
outline: 2px solid var(--text);
outline-offset: 2px;
}
.district-preview {
display: block;
width: 100%;
height: 62px;
pointer-events: none;
}
.district-preview text {
display: none;
}
.district-preview .status {
animation: none;
}
.district-label {
display: flex;
justify-content: space-between;
align-items: center;
gap: 4px;
padding: 4px;
font-size: 10px;
}
.district-range {
color: var(--text-dim);
font-size: 9px;
}
.viewport {
position: relative;
overflow: hidden;
background: radial-gradient(ellipse at 50% 70%, #172735, #0c131d 70%);
}
.viewport > svg {
display: block;
width: 100%;
max-height: 440px;
}
.telemetry {
position: absolute;
top: 16px;
left: 18px;
display: grid;
gap: 8px;
font: 11px var(--font-console);
z-index: 1;
pointer-events: none;
}
.telemetry > span:first-child {
color: var(--owner);
font-size: 14px;
}
.coordinate {
position: absolute;
bottom: 12px;
right: 16px;
color: #69818f;
font: 10px var(--font-console);
letter-spacing: 2px;
}
.site {
cursor: pointer;
outline: none;
}
.pad {
fill: #22343f;
stroke: #49606e;
stroke-width: 0.7;
}
.site:hover .pad,
.site:focus-visible .pad,
.site.chosen .pad {
fill: #344d5c;
stroke: var(--resource);
stroke-width: 2;
}
.shadow {
fill: #050c12;
opacity: 0.38;
}
.ownership {
stroke: var(--owner);
stroke-width: 2;
opacity: 0.65;
}
.status {
fill: #50616c;
}
.working .status {
fill: var(--resource);
animation: pulse 3s ease-in-out infinite;
animation-delay: var(--delay);
}
text {
fill: #9bb0bc;
font: 8px var(--font-console);
}
footer {
justify-content: space-between;
min-height: 48px;
padding: 8px 0;
font-size: 11px;
}
.building-stat {
color: var(--text-mid);
padding-left: 10px;
border-left: 1px solid var(--line);
}
.building-details {
flex-basis: 100%;
max-width: 760px;
font-size: 12px;
line-height: 1.6;
}
.building-details p {
margin: 4px 0;
}
.production-detail {
display: flex;
align-items: center;
gap: 6px;
color: var(--text);
}
.readout {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.ui-icon {
width: 16px;
height: 16px;
flex-shrink: 0;
display: inline-block;
fill: none;
stroke: currentColor;
stroke-width: 1.5;
stroke-linecap: round;
stroke-linejoin: round;
}
.building-name,
.operation,
.staffing {
display: inline-flex;
align-items: center;
gap: 6px;
}
.operation {
border-left: 1px solid var(--line);
padding-left: 10px;
}
.operating {
color: #8dbdad;
}
.motion {
display: grid;
place-items: center;
min-width: 32px;
}
.readout strong {
color: var(--text);
}
nav {
flex-shrink: 0;
font-family: var(--font-console);
gap: 8px;
}
.paused .status {
animation-play-state: paused;
}
@keyframes pulse {
50% {
opacity: 0.4;
}
}
@media (max-width: 600px) {
.district-strip {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.telemetry {
top: 10px;
left: 10px;
font-size: 9px;
gap: 4px;
}
.telemetry > span:first-child {
font-size: 11px;
}
.viewport > svg {
width: 135%;
max-width: none;
margin-left: -17.5%;
margin-top: 36px;
}
.controls {
width: 100%;
}
.coordinate {
font-size: 8px;
}
}
@media (prefers-reduced-motion: reduce) {
.working .status {
animation: none;
}
}
</style>

View file

@ -1,245 +1,5 @@
<script lang="ts">
import { onMount } from "svelte";
import {
FACTORIES,
KICKERS,
KICKER_SPECS,
type Kicker,
FACTORY_TYPES,
UPGRADE_SPECS,
upgradeNumber,
type FactoryType,
type GameState,
type Resource,
type Upgrade,
} from "outpost-engine";
import { RESOURCE_LABELS, type ViewerStore } from "./store.svelte";
const RESOURCE_COLORS: Record<Resource, string> = {
ore: "#a8b4c0",
water: "#5aa5e0",
titanium: "#d9a53a",
research: "#9a86e8",
microbiotics: "#5cbd62",
newChemicals: "#e082c2",
orbitalMedicine: "#55ccc6",
ringOre: "#f08c48",
moonOre: "#e8c550",
};
// A decorative space backdrop: a few asteroids drifting at different speeds,
// a space station slowly crossing, and an occasional comet. Fixed behind the
// board (z-index 0); the board sits above it. Asteroids/station are pure CSS;
// the comet is launched by JS at random intervals/positions/angles so it
// feels organic rather than a fixed loop. Honors prefers-reduced-motion.
// The moon surface shows per-player clusters of buildings: one shape per
// factory type, special structures for upgrades, colored by owner.
interface Props {
gameState: GameState | null;
store: ViewerStore;
}
let { gameState, store }: Props = $props();
interface Building {
x: number;
y: number;
color: string;
kind: "factory" | "upgrade" | "kicker";
type: FactoryType | Upgrade | Kicker;
resource: Resource;
manned: boolean;
label: string;
}
interface Cluster {
color: string;
name: string;
biosphere: boolean;
buildings: Omit<Building, "x" | "y">[];
}
// The rim path is: M0 70 Q 200 40 420 58 T 820 52 T 1220 62 T 1600 48
// Piecewise quadratic bezier segments. Compute the exact y for a given x
// by finding the segment and evaluating the quadratic at parameter t.
interface Seg {
x0: number;
y0: number;
cx: number;
cy: number;
x1: number;
y1: number;
}
const RIM_SEGMENTS: Seg[] = [
{ x0: 0, y0: 70, cx: 200, cy: 40, x1: 420, y1: 58 },
{ x0: 420, y0: 58, cx: 640, cy: 76, x1: 820, y1: 52 },
{ x0: 820, y0: 52, cx: 1000, cy: 28, x1: 1220, y1: 62 },
{ x0: 1220, y0: 62, cx: 1440, cy: 96, x1: 1600, y1: 48 },
];
function surfaceY(x: number): number {
for (const s of RIM_SEGMENTS) {
if (x >= s.x0 && x <= s.x1) {
// Solve quadratic bezier for t given x (x is monotonic in t here).
// x(t) = (1-t)²x0 + 2(1-t)t·cx + t²x1
// Rearranged: (x0 - 2cx + x1)t² + 2(cx - x0)t + (x0 - x) = 0
const a = s.x0 - 2 * s.cx + s.x1;
const b = 2 * (s.cx - s.x0);
const c = s.x0 - x;
let t: number;
if (Math.abs(a) < 1e-9) {
t = -c / b;
} else {
const disc = b * b - 4 * a * c;
t = (-b + Math.sqrt(Math.max(0, disc))) / (2 * a);
if (t < 0 || t > 1) {
t = (-b - Math.sqrt(Math.max(0, disc))) / (2 * a);
}
}
t = Math.max(0, Math.min(1, t));
const mt = 1 - t;
return mt * mt * s.y0 + 2 * mt * t * s.cy + t * t * s.y1;
}
}
return 60;
}
const clusters = $derived.by((): Cluster[] => {
if (!gameState) {
return [];
}
return gameState.players
.map((p, i) => {
const buildings: Omit<Building, "x" | "y">[] = [];
for (const f of p.factories) {
buildings.push({
color: store.playerColor(i),
kind: "factory",
type: f.type,
resource: f.type,
manned: f.manned,
label: `${p.name}: ${RESOURCE_LABELS[f.type]} factory (${f.manned ? "manned" : "unmanned"})`,
});
}
for (const u of Object.keys(p.upgrades) as Upgrade[]) {
const count = p.upgrades[u];
if (count <= 0) {
continue;
}
const spec = UPGRADE_SPECS[u];
for (let n = 0; n < count; n++) {
buildings.push({
color: store.playerColor(i),
kind: "upgrade",
type: u,
resource: spec.produces ?? (spec.freeFactory as Resource) ?? "ore",
manned: true,
label: `${p.name}: ${spec.name}${count > 1 ? ` ×${count}` : ""}`,
});
}
}
for (const k of KICKERS) {
if (k === "biosphere") {
continue;
}
for (let n = 0; n < p.kickers[k]; n++) {
buildings.push({
color: store.playerColor(i),
kind: "kicker",
type: k,
resource: "ore",
manned: true,
label: `${p.name}: ${KICKER_SPECS[k].name} (Kicker)`,
});
}
}
return { color: store.playerColor(i), name: p.name, biosphere: p.kickers.biosphere > 0, buildings };
})
.filter((c) => c.buildings.length > 0);
});
// Order buildings so same-family ones sit together: factories first (by
// resource type), then upgrades (by card number). Within a family, manned
// before unmanned.
function familyKey(b: Omit<Building, "x" | "y">): number {
if (b.kind === "factory") {
return FACTORY_TYPES.indexOf(b.type as FactoryType);
}
if (b.kind === "kicker") {
return 200 + KICKERS.indexOf(b.type as Kicker);
}
return 100 + upgradeNumber(b.type as Upgrade);
}
const positioned = $derived.by((): Building[] => {
const result: Building[] = [];
const n = clusters.length;
if (n === 0) {
return [];
}
const margin = 35;
const usableWidth = 1470;
const spacing = 24;
const rowGap = 27;
for (let ci = 0; ci < n; ci++) {
const cluster = clusters[ci]!;
const areaWidth = usableWidth / n;
const cx = margin + areaWidth * (ci + 0.5);
const columns = Math.max(2, Math.floor((areaWidth - 32) / spacing));
const families = new Map<number, Omit<Building, "x" | "y">[]>();
for (const b of cluster.buildings) {
const key = familyKey(b);
const family = families.get(key) ?? [];
family.push(b);
families.set(key, family);
}
const groups = [...families.entries()].sort((a, b) => a[0] - b[0]).map(([, members]) => members);
const rows: Omit<Building, "x" | "y">[][] = [];
for (const kind of ["factory", "upgrade", "kicker"] as const) {
let row: Omit<Building, "x" | "y">[] = [];
for (const group of groups.filter((g) => g[0]!.kind === kind)) {
for (let offset = 0; offset < group.length; offset += columns) {
const chunk = group.slice(offset, offset + columns);
if (row.length && row.length + chunk.length > columns) {
rows.push(row);
row = [];
}
row.push(...chunk);
}
}
if (row.length) {
rows.push(row);
}
}
for (let ri = 0; ri < rows.length; ri++) {
const row = rows[ri]!;
row.forEach((b, col) =>
result.push({ ...b, x: cx + (col - (row.length - 1) / 2) * spacing, y: surfaceY(cx) + 24 + ri * rowGap })
);
}
}
// SVG paints in document order: sort by y so lower (closer) buildings
// render on top of higher ones.
return result.sort((a, b) => a.y - b.y);
});
const biospheres = $derived(
clusters
.filter((c) => c.biosphere)
.map((c) => {
const buildings = positioned.filter((b) => b.color === c.color);
const left = Math.min(...buildings.map((b) => b.x)) - 23;
const right = Math.max(...buildings.map((b) => b.x)) + 23;
const bottom = Math.max(...buildings.map((b) => b.y)) + 7;
const top = Math.min(...buildings.map((b) => b.y)) - 40;
return { ...c, left, right, bottom, top, cx: (left + right) / 2 };
})
);
const groundHeight = $derived(Math.max(160, ...positioned.map((b) => b.y + 18)));
let cometEl = $state<HTMLDivElement | null>(null);
onMount(() => {
@ -292,212 +52,6 @@
<!-- An occasional comet with a fading tail, launched at random intervals. -->
<div class="comet" bind:this={cometEl}><span class="head"></span><span class="tail"></span></div>
<!-- The outpost's moon: a cratered limb along the bottom with player buildings. -->
<svg
class="moon"
viewBox="0 0 1600 {groundHeight}"
style:height="{groundHeight}px"
preserveAspectRatio="xMidYMax slice"
aria-hidden="true"
>
<defs>
<linearGradient id="moonbody" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#434c54" />
<stop offset="0.45" stop-color="#303841" />
<stop offset="1" stop-color="#1f262e" />
</linearGradient>
</defs>
<path
class="surface"
fill="url(#moonbody)"
d="M0 70 Q 200 40 420 58 T 820 52 T 1220 62 T 1600 48 L1600 {groundHeight} L0 {groundHeight} Z"
/>
<path class="rim" d="M0 70 Q 200 40 420 58 T 820 52 T 1220 62 T 1600 48" />
<g class="craters">
<ellipse class="crater" cx="300" cy="95" rx="34" ry="9" />
<ellipse class="crater-hi" cx="300" cy="92" rx="34" ry="8" />
<ellipse class="crater" cx="620" cy="108" rx="22" ry="6" />
<ellipse class="crater-hi" cx="620" cy="105" rx="22" ry="5" />
<ellipse class="crater" cx="980" cy="92" rx="28" ry="8" />
<ellipse class="crater-hi" cx="980" cy="89" rx="28" ry="7" />
<ellipse class="crater" cx="1330" cy="104" rx="18" ry="5" />
<ellipse class="crater" cx="90" cy="112" rx="20" ry="6" />
</g>
{#each biospheres as dome}
<g class="biosphere" style="--bc: {dome.color}">
<title>{dome.name}: Biosphere</title>
<path
class="glass"
d="M{dome.left} {dome.bottom} C{dome.left} {dome.top}, {dome.left} {dome.top}, {dome.cx} {dome.top} S{dome.right} {dome.top}, {dome.right} {dome.bottom} Z"
/>
<path
class="rib"
d="M{dome.cx} {dome.top} Q{dome.left + 12} {dome.top} {dome.left +
18} {dome.bottom} M{dome.cx} {dome.top} Q{dome.right - 12} {dome.top} {dome.right - 18} {dome.bottom}"
/>
<ellipse class="seal" cx={dome.cx} cy={dome.bottom} rx={(dome.right - dome.left) / 2} ry="5" />
</g>
{/each}
{#each positioned as b, i (i)}
<g
class="bldg"
class:manned={b.manned}
class:upgrade={b.kind !== "factory"}
style="--bc: {b.color}; --rc: {RESOURCE_COLORS[b.resource]}"
transform="translate({b.x} {b.y})"
>
<title>{b.label}</title>
<ellipse class="footprint" cx="2" cy="1.5" rx="11" ry="2.5" />
{#if b.type === "ore"}
<path class="body" d="M-8 0v-6h6v6M0 0l3-17h2L8 0z" /><path
class="detail"
d="M2-12h4M1-7h6M3-17l4 5-5 5 6 6"
/><path class="roof" d="M-9-6l3-3 5 3z" /><path class="signal" d="M-6-4h2" />
{:else if b.type === "water"}
<rect class="body" x="-8" y="-13" width="7" height="12" rx="3" /><rect
class="body"
x="2"
y="-17"
width="6"
height="16"
rx="3"
/><path class="roof" d="M-8-10h7M2-14h6" /><path class="detail" d="M-4-1v-2H5v-2M-8-6h7M2-7h6" /><path
class="signal"
d="M4-11h2"
/>
{:else if b.type === "titanium"}
<path class="body" d="M-8 0v-9l5-4 6 4v9zM4 0v-17h4V0" /><path class="roof" d="M-8-9l5-4 6 4M3-17h6" /><path
class="signal"
d="M-5-6h5v4h-5z"
/><path class="detail" d="M5-12h2M5-8h2" />
{:else if b.type === "research"}
<path class="body" d="M-8 0v-5a8 8 0 0 1 16 0v5z" /><path class="roof" d="M-8-5h16M-2-12v7" /><path
class="body"
d="M-1-13l7-6 2 3-7 6z"
/><path class="signal" d="M-5-3h3M2-3h3" />
{:else if b.type === "newChemicals"}
<path class="body" d="M-8 0v-11l2-2v-4h3v4l2 2V0M2 0v-8l2-3v-3h3v3l2 3v8z" /><path
class="roof"
d="M-8-8h7M2-5h7"
/><path class="detail" d="M-1-5H2M-6-14h3" /><path class="signal" d="M-6-5v3M5-3h2" />
{:else if b.type === "dataLibrary"}
<path class="body" d="M-8 0v-12h5V0M-2 0v-16h5V0M4 0v-10h4V0" /><path
class="roof"
d="M-8-12h5M-2-16h5M4-10h4"
/><path class="signal" d="M-6-9h1M-6-6h1M0-12h1M0-9h1M0-6h1M6-7h1" />
{:else if b.type === "warehouse"}
<path class="body" d="M-9 0v-10l9-5 9 5V0z" /><path class="roof" d="M-9-10h18L0-15z" /><path
class="detail"
d="M-5 0v-7H5v7M-5-4H5M-5-2H5"
/><path class="signal" d="M-3-9H3" />
{:else if b.type === "heavyEquipment"}
<rect class="body" x="-9" y="-4" width="18" height="4" rx="2" /><path
class="body"
d="M-6-4v-7h6v7M0-10l5-8 3 1 1 10-3 2-2-2h4L6-14l-4 6z"
/><path class="signal" d="M-4-9h2v3h-2z" /><path class="detail" d="M-6-2H6" />
{:else if b.type === "nodule"}
<path class="body" d="M-8-3v-9l4-4h8l4 4v9L4 0h-8z" /><path class="roof" d="M-8-12h16M-4-16v4M4-16v4" /><path
class="detail"
d="M-3 0v-5h6v5"
/><path class="signal" d="M-5-9h3M2-9h3" />
{:else if b.type === "scientists"}
<path class="body" d="M-8 0v-7h12v7" /><path class="body" d="M-3-15a7 7 0 0 0 10 7z" /><path
class="detail"
d="M2-10l6-7M7-18l2 2M1-7v-2"
/><path class="roof" d="M-8-7h12" /><path class="signal" d="M-5-4h5" />
{:else if b.type === "orbitalLab"}
<path class="body" d="M-3-3v-13l3-3 3 3v10L0-1z" /><path class="panel" d="M-9-13h5v8h-5zM4-13h5v8H4z" /><path
class="detail"
d="M-9-9h5M4-9h5M-3-8h-1M3-8h1M0-1v2"
/><path class="signal" d="M0-12v5" />
{:else if b.type === "robots"}
<path class="body" d="M-6-13v-6H6v6zM-5-11H5v7H-5z" /><path
class="detail"
d="M-2-13v2M2-13v2M-5-9h-3v5M5-9h3v5M-3-4v4h-3M3-4v4h3"
/><path class="signal" d="M-3-16h1M2-16h1" />
{:else if b.type === "laboratory"}
<path class="body" d="M-9 0v-6h5v-5h8v5h5v6z" /><path
class="body"
d="M0-11v-8M-4-15a4 4 0 1 1 8 0 4 4 0 1 1-8 0z"
/><path class="detail" d="M-4-15h8M0-19v8" /><path class="signal" d="M-6-3h3M3-3h3" />
{:else if b.type === "ecoplants"}
<path class="body" d="M-9 0v-4a9 10 0 0 1 18 0v4z" /><path
class="roof"
d="M-9-4H9M0-14C-5-10-5-4-5 0M0-14C5-10 5-4 5 0"
/><path class="signal" d="M0-2v-7M0-5q-5 0-3-4 3 0 3 4M0-7q0-4 3-4 2 4-3 4" />
{:else if b.type === "outpost"}
<path class="body" d="M-5 0v-12H5V0M-8-12v-5H8v5z" /><path class="roof" d="M-9-17l4-3H5l4 3z" /><path
class="detail"
d="M0-20v-4M0-23h4M-2 0v-5h4v5"
/><path class="signal" d="M-5-15H5" />
{:else if b.type === "spaceStation"}
<path class="body" d="M-2 0v-20h4V0" /><ellipse class="body" cx="0" cy="-11" rx="9" ry="6" /><ellipse
class="panel"
cx="0"
cy="-11"
rx="5"
ry="3"
/><path class="detail" d="M0-17v3M0-8v3M-9-11h4M5-11h4" /><path class="signal" d="M-6-15l2-1M4-6l2-1" />
{:else if b.type === "planetaryCruiser"}
<path class="body" d="M-3-5v-10l3-7 3 7v10l5 4v-8l-5-5M-3-14l-5 5v8z" /><path
class="roof"
d="M-3-5h6M-3-15h6"
/><path class="signal" d="M0-17v3M-1-3v3M2-3v3" />
{:else if b.type === "moonBase"}
<path class="body" d="M-9 0v-5a4 4 0 0 1 8 0v5M1 0v-5a4 4 0 0 1 8 0v5" /><path
class="body"
d="M-5-4v-7a5 5 0 0 1 10 0v7z"
/><path class="roof" d="M-5-10H5M-9-4h8M1-4h8" /><path class="detail" d="M0-16v-4l4 1-4 2" /><path
class="signal"
d="M-7-2h3M4-2h3M-2-7h4"
/>
{:else if b.type === "iceProspector"}
<path class="body" d="M-8-2v-6h9v6M1-6l4-8h3L5-2" /><path
class="detail"
d="M-6 0h6M-3-8v-5l-3-3M5-7l3 2-3 3"
/><path class="signal" d="M-6-5h3" />
{:else if b.type === "robotPrototype"}
<path class="body" d="M-7 0v-17h14V0M-3-10v-4h6v4z" /><path
class="detail"
d="M-7-5H7M-3-9h6v4M-1-5v3M2-5v3"
/><path class="signal" d="M-1-12h2" /><path class="roof" d="M-8-17H8" />
{:else if b.type === "smelter"}
<path class="body" d="M-8 0v-7h5l2-7h7l2 14z" /><path class="roof" d="M-2-14h9M-1-10h7" /><path
class="signal"
d="M0-6h5v4H0z"
/><path class="detail" d="M-6-4h2" />
{:else if b.type === "wilyTrader"}
<path class="body" d="M-8 0v-8H8V0" /><path class="roof" d="M-9-8l3-5H6l3 5z" /><path
class="detail"
d="M-6-13l-1 5M0-13v5M6-13l1 5"
/><path class="signal" d="M-4-5H4" />
{:else if b.type === "launchFacility"}
<path class="body" d="M-9 0v-20h4V0M0-3v-9l3-7 3 7v9z" /><path
class="detail"
d="M-9-15h9M-9-9h8M-7-20v20M0-3l-2 3M6-3l2 3"
/><path class="signal" d="M3-11v3" />
{:else if b.type === "merchantHouse"}
<path class="body" d="M-8 0v-12h16V0" /><path class="roof" d="M-9-12l9-6 9 6z" /><path
class="detail"
d="M-5-10v8M5-10v8M-2 0v-5h4v5"
/><path class="signal" d="M-1-10h2" />
{:else if b.type === "ncfPrototype"}
<path class="body" d="M-8 0v-15h16V0M-3-12v4l-2 5H5L3-8v-4z" /><path class="roof" d="M-9-15H9" /><path
class="signal"
d="M-2-5h4"
/>
{:else if b.type === "refinery"}
<path class="body" d="M-8 0v-17h4V0M0 0v-12h4V0M5 0v-7h4v7" /><path
class="detail"
d="M-8-13h4M-8-8h4M-4-5h4M0-9h4M4-3h1"
/><path class="signal" d="M-6-3v-2M2-5v-2" />
{/if}
<path class="base" d="M-10 0H10l-2 2H-8z" />
</g>
{/each}
</svg>
</div>
<style>
@ -630,118 +184,11 @@
}
}
.moon {
position: absolute;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 160px;
display: block;
}
.moon .rim {
fill: none;
stroke: #76848e;
stroke-width: 2;
opacity: 0.7;
}
.moon .crater {
fill: #202830;
}
.moon .crater-hi {
fill: none;
stroke: #53616b;
stroke-width: 1.2;
opacity: 0.6;
}
/* Player buildings: factories and upgrades clustered per player.
Player color marks the foundations and upgrade lights; unmanned factories are dimmer. */
.bldg {
pointer-events: all;
}
.biosphere .glass {
fill: color-mix(in srgb, var(--bc) 8%, transparent);
stroke: color-mix(in srgb, var(--bc) 65%, #e0fff5);
stroke-width: 0.9;
}
.biosphere .rib {
fill: none;
stroke: var(--bc);
stroke-width: 0.6;
opacity: 0.3;
}
.biosphere .seal {
fill: none;
stroke: var(--bc);
stroke-width: 1;
opacity: 0.55;
}
.bldg {
stroke-linecap: square;
stroke-linejoin: bevel;
}
.bldg .footprint {
fill: #17191c;
opacity: 0.4;
}
.bldg .body {
fill: #29343d;
stroke: #526674;
stroke-width: 0.85;
}
.bldg .roof {
fill: #414e57;
stroke: #8295a1;
stroke-width: 0.8;
}
.bldg .base {
fill: #263038;
stroke: color-mix(in srgb, var(--bc) 65%, #637079);
stroke-width: 0.6;
}
.bldg .detail {
fill: none;
stroke: #81929c;
stroke-width: 0.8;
}
.bldg .panel {
fill: #182c3f;
stroke: #6c8390;
stroke-width: 0.7;
}
.bldg .signal {
fill: #34424b;
stroke: #34424b;
stroke-width: 1;
}
.bldg.manned .body {
fill: #31434f;
stroke: #8295a1;
}
.bldg.manned .roof {
fill: #485c68;
}
.bldg.manned .signal {
fill: var(--rc);
stroke: var(--rc);
}
.bldg.upgrade .signal {
fill: color-mix(in srgb, var(--bc) 65%, #c5d3d7);
stroke: color-mix(in srgb, var(--bc) 65%, #c5d3d7);
}
.bldg:hover {
filter: brightness(1.35);
}
@media (prefers-reduced-motion: reduce) {
.rock,
.station,
.comet {
animation: none;
}
.comet {
display: none;
}
}
</style>

View file

@ -137,12 +137,15 @@ export function createActionSounds() {
};
}
export function mountSoundTests(onPreferenceChange: (sound: boolean) => void): void {
export function mountSoundTests(
onPreferenceChange: (sound: boolean) => void,
onColonyPreferenceChange?: (visible: boolean) => void
): void {
const panel = document.createElement("details");
panel.style.cssText =
"position:relative;z-index:5;padding:10px 16px;margin:8px;background:#172638;color:#f0f4f8;border:1px solid #56718a;border-radius:8px;font:14px system-ui";
const summary = document.createElement("summary");
summary.textContent = "Playtest tools · sounds";
summary.textContent = "Playtest tools · preferences and sounds";
panel.append(summary);
const label = document.createElement("label");
label.style.margin = "10px";
@ -164,6 +167,25 @@ export function mountSoundTests(onPreferenceChange: (sound: boolean) => void): v
button.onclick = () => playSound(name);
panel.append(button);
}
if (onColonyPreferenceChange) {
const colonyLabel = document.createElement("label");
colonyLabel.style.margin = "10px";
const colonyToggle = document.createElement("input");
colonyToggle.type = "checkbox";
colonyToggle.checked = true;
try {
colonyToggle.checked = localStorage.getItem("outpost.showColony") !== "false";
} catch {}
colonyToggle.onchange = () => {
try {
localStorage.setItem("outpost.showColony", String(colonyToggle.checked));
} catch {}
onColonyPreferenceChange(colonyToggle.checked);
};
colonyLabel.append(colonyToggle, " Show colony surface");
panel.append(colonyLabel);
onColonyPreferenceChange(colonyToggle.checked);
}
document.body.prepend(panel);
}
function cueForEntry(entry: any): string | undefined {

View file

@ -1,5 +1,7 @@
Local review controls and BGS release metadata.
`viewer-preferences.json` is a merge patch for BGS releases: enable the embedded chat and add/update the sound preference while preserving all other preferences and viewer fields. Do not PUT this partial file as a full game-info document.
`viewer-preferences.json` is a merge patch for BGS releases: enable the embedded chat and add/update the sound and colony visibility preferences while preserving all other preferences and viewer fields. Do not PUT this partial file as a full game-info document.
The local viewer has a Playtest tools panel with individual sound buttons and a mute toggle. Chat messages entered in the local preview stay local.
The local playtest tools include a persisted Show colony surface checkbox. Production uses the host preference `showColony`; register the declaration in `viewer-preferences.json` when the colony design is approved for release.

View file

@ -1,4 +1,19 @@
{
"viewer": { "chat": true },
"preferences": [{ "name": "sound", "label": "Game action sounds", "type": "checkbox", "default": true }]
"viewer": {
"chat": true
},
"preferences": [
{
"name": "sound",
"label": "Game action sounds",
"type": "checkbox",
"default": true
},
{
"name": "showColony",
"label": "Show colony surface",
"type": "checkbox",
"default": true
}
]
}