mirror of
https://github.com/db9979/tidefront.git
synced 2026-12-05 12:24:13 +01:00
Karte 2: Farbsatz „Seekarte 2.0“ hell/dunkel, Leistung (Zeichnen nach Bedarf, ohne Masken, Linienkacheln, Gelände in Schritten), Inselküsten-Fix, Testlagen an genauere Küsten angepasst
This commit is contained in:
1 parent
568245dda1
commit
902d0e3189
25 files changed
+258
-139
No files matched your search
@@ -67,3 +67,23 @@ Hafenmeisterei; Bericht (Markdown); idempotent.
|
||||
Häfen auf jetzt ungültigen Feldern funktionieren weiter, wirken aber auf der Karte im Land/See.
|
||||
3. Mögliche Betroffene: 106 Felder waren bis 0.50 Küste und sind jetzt See (67) oder Binnenland (39); dazu 5 neue
|
||||
Handelshafenfelder. Testwelt (Kopie der E2E-Datenbank, 8 Häfen): 1 Hafen, 11 Nester, 1 Feld.
|
||||
|
||||
## 5. Leistung (Hinweis 29-huelle) – Messung
|
||||
|
||||
Test `32-karte-darstellung.spec.ts` › „Leistung Desktop 1440 × 900 @2“ (150 Wracks, alle Nester, 8 Ansichten,
|
||||
Schwenken, 6× Mausrad; Long-Task-Observer). Kopfloses Chromium zeichnet WebGL ohne Grafikkarte (SwiftShader).
|
||||
|
||||
| Stand | Bild beim Zoomen/Schwenken | im Stillstand | längste Blockade beim Aufbau |
|
||||
|---|---|---|---|
|
||||
| vorher (40 Bilder/s dauernd, Masken, Dichte 2) | 300–900 ms | 300–500 ms je Bild, dauernd | 1,6 s |
|
||||
| nachher, Dichte 2 erzwungen | 130–210 ms | 2 Bilder/s | ~1,0–1,3 s (Grafiktreiber) |
|
||||
| nachher, Standard (ohne Grafikkarte Dichte 1) | 50–85 ms | 2 Bilder/s | ~0,9–1,0 s (Grafiktreiber) |
|
||||
|
||||
Maßnahmen: Zeichnen nach Bedarf (render-loop.ts), keine Masken (Land als Vektorfläche mit Textur, Linien zugeschnitten),
|
||||
Linienkacheln mit Ausblenden und Vereinfachung je Zoom, abgeschrägte Ecken, Geländebild in Schritten, Dichte 1 ohne
|
||||
Grafikkarte. CPU-Profil des Aufbaus: JS-Anteil klein (Gelände ~0,2 s verteilt), der Rest ist natives Zeichnen.
|
||||
|
||||
## 6. „Seekarte 2.0“ hell/dunkel
|
||||
|
||||
Farben aus `lib/theme-map.ts` (map/palette.ts → symbols.ts, terrain-raster.ts); Moduswechsel baut die Karte neu
|
||||
(LazyHexMap `key`). Fotos: `/tmp/tf-karte2/nachher-hell-*` und `nachher-dunkel-*` (Handy 390 @3, Desktop 1440 @2).
|
||||
@@ -2,13 +2,14 @@
|
||||
// schon (mit Quelle). Planung gegen das unbekannte Nest: „Lage unbekannt“, kein Probekampf.
|
||||
import { COLS, hexDistanceKm } from "@tidefront/world";
|
||||
import { awayFromEdge, expect, expectNoHorizontalOverflow, tapHex, test } from "./fixtures.ts";
|
||||
import { setBuildings, setUnits } from "./game.ts";
|
||||
import { setBuildings, setResources, setUnits } from "./game.ts";
|
||||
|
||||
test("Fremdes Nest: ohne Sicht keine Stufe, in Radarreichweite schon", async ({ page, player, seed }) => {
|
||||
test.slow(); // ~20 s allein, unter voller Parallel-Last sonst über 60 s
|
||||
// Radarstation 10 (550 km, bei dichtem Nebel mindestens 385 km) mit genug Strom.
|
||||
await setBuildings(seed.sql, player.baseId, { radarstation: 10, kraftwerk: 3, werft: 3, kommandozentrale: 4 });
|
||||
await setUnits(seed.sql, player.baseId, { korvette: 4 });
|
||||
await setResources(seed.sql, player.baseId, { treibstoff: 20000 }); // Karte 2: Seeweg zum fernen Nest kann um Halbinseln führen
|
||||
const taken = new Set((await seed.sql`select col, row from nest union all select col, row from base`).map((r) => `${r.col},${r.row}`));
|
||||
/** Freies Feld in derselben Zeile, `minKm`–`maxKm` vom Hafen entfernt, abseits des Kartenrands. */
|
||||
const spot = (minKm: number, maxKm: number) => {
|
||||
|
||||
@@ -52,7 +52,7 @@ test.describe("Handy 390 × 844", () => {
|
||||
await page.goto("/");
|
||||
await page.getByRole("navigation").getByRole("button", { name: "Karte" }).click();
|
||||
await tapHex(page, player, nest);
|
||||
await page.getByRole("button", { name: "Mission planen" }).click();
|
||||
await page.getByRole("button", { name: "Planen", exact: true }).click();
|
||||
await expect(page.getByRole("heading", { name: "Mission planen" })).toBeVisible();
|
||||
// Ziel gewählt: Art eingeklappt (Überfall), Schnellwahl daneben, das Raster erst nach „Ändern“.
|
||||
await expect(page.getByRole("button", { name: "Ändern" })).toBeVisible();
|
||||
|
||||
@@ -6,6 +6,8 @@ import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures.ts";
|
||||
|
||||
const PREFIX = process.env.TF_KARTE2_SHOTS ?? null;
|
||||
/** „Seekarte 2.0“: Modus der Fotos (TF_KARTE2_THEME=dark für dunkel). */
|
||||
const THEME = process.env.TF_KARTE2_THEME === "dark" ? "dark" : "light";
|
||||
|
||||
/** Regionen für die Fotos: Name, Länge, Breite, Maßstab (Bildschirmpixel je km; 0 = kleinste Stufe). */
|
||||
const REGIONS: [string, number, number, number][] = [
|
||||
@@ -27,7 +29,7 @@ async function shots(page: Page, device: string): Promise<void> {
|
||||
mkdirSync("/tmp/tf-karte2", { recursive: true });
|
||||
for (const [name, lon, lat, scale] of REGIONS) {
|
||||
await view(page, lon, lat, scale);
|
||||
await page.locator("canvas").first().screenshot({ path: `/tmp/tf-karte2/${PREFIX}-${device}-${name}.png` });
|
||||
await page.locator("canvas").first().screenshot({ path: `/tmp/tf-karte2/${PREFIX}-${THEME === "dark" ? "dunkel" : "hell"}-${device}-${name}.png` });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@ test.describe("Handy 390 × 844 @3", () => {
|
||||
test.setTimeout(PREFIX ? 400_000 : 120_000); // Fotos in vielen Regionen; DPR 2–3 im kopflosen Chromium langsam
|
||||
void player;
|
||||
// Kopfloses Chromium zeichnet WebGL ohne Grafikkarte – dort deckelt die Karte sonst auf Dichte 2 (map/density.ts).
|
||||
await page.addInitScript(() => localStorage.setItem("tf-karte-dichte", "voll"));
|
||||
await page.addInitScript((t) => { localStorage.setItem("tf-karte-dichte", "voll"); if (t === "dark") localStorage.setItem("tf-theme", "dark"); }, THEME);
|
||||
await page.goto("/?tab=karte");
|
||||
await expectFullDensity(page, 3);
|
||||
await shots(page, "handy");
|
||||
@@ -60,7 +62,7 @@ test.describe("Desktop 1440 × 900 @2", () => {
|
||||
test.setTimeout(PREFIX ? 400_000 : 120_000); // Fotos in vielen Regionen; DPR 2–3 im kopflosen Chromium langsam
|
||||
void player;
|
||||
// Kopfloses Chromium zeichnet WebGL ohne Grafikkarte – dort deckelt die Karte sonst auf Dichte 2 (map/density.ts).
|
||||
await page.addInitScript(() => localStorage.setItem("tf-karte-dichte", "voll"));
|
||||
await page.addInitScript((t) => { localStorage.setItem("tf-karte-dichte", "voll"); if (t === "dark") localStorage.setItem("tf-theme", "dark"); }, THEME);
|
||||
await page.goto("/?tab=karte");
|
||||
await expectFullDensity(page, 2);
|
||||
await shots(page, "desktop");
|
||||
|
||||
+32
-32
@@ -27,8 +27,8 @@ const GROUPS: { title: string; items: Item[] }[] = [
|
||||
{ icon: <TacticalIcon kind="wreck" />, text: "Wrackfeld, bergbar" },
|
||||
{ icon: <TacticalIcon kind="port" />, text: "Handelshafen der Börse" },
|
||||
{ icon: <><TacticalIcon kind="ship" size={22} /><TacticalIcon kind="shipBack" size={22} /></>, text: "Eigener Verband: Hinfahrt, Rückfahrt – antippen für Details" },
|
||||
{ icon: <><ConvoyMark fill="#2d5b7a" /><ConvoyMark fill="#a8331f" /></>, text: "Konvoi (Börse, Vertrag, Handel, Transport, Feldertrag) mit gestrichelter Route über Wasser: blau eigener, rot Kriegsgegner (abfangbar), dunkel mit Geleit – antippen für Details" },
|
||||
{ icon: <ConvoyMark fill="#fbf8f0" />, text: "Heller Konvoi mit Schild „Konvoi · klein/mittel/groß“: fremder Konvoi in Sensorreichweite, ohne Route; Ladung genau erst mit Lagebild" },
|
||||
{ icon: <><ConvoyMark fill="var(--tf-art-see)" /><ConvoyMark fill="var(--tf-art-siegel)" /></>, text: "Konvoi (Börse, Vertrag, Handel, Transport, Feldertrag) mit gestrichelter Route über Wasser: blau eigener, rot Kriegsgegner (abfangbar), dunkel mit Geleit – antippen für Details" },
|
||||
{ icon: <ConvoyMark fill="var(--tf-art-paper)" />, text: "Heller Konvoi mit Schild „Konvoi · klein/mittel/groß“: fremder Konvoi in Sensorreichweite, ohne Route; Ladung genau erst mit Lagebild" },
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -37,8 +37,8 @@ const GROUPS: { title: string; items: Item[] }[] = [
|
||||
items: [
|
||||
{ icon: <><Icon id="oelfeld" size={22} /><Icon id="erzbucht" size={22} /></>, text: "Ölfeld (Treibstoff), Erzbucht (Stahl); Punkte darunter: Stufe 1–3" },
|
||||
{ icon: <><Icon id="fischgrund" size={22} /><Icon id="elektronikwrack" size={22} /></>, text: "Fischgrund (Proviant), Elektronik-Wrack (Elektronik)" },
|
||||
{ icon: <FieldRing dashed color="#a8331f" />, text: "Rot gestrichelt: vom Kartell bewacht; grau: frei" },
|
||||
{ icon: <><FieldRing color="#18273a" /><FieldRing color="#3d6b4f" /></>, text: "Ring in Besitzerfarbe wie die Häfen; Linien und Hof: Einflusszone einer Allianz" },
|
||||
{ icon: <FieldRing dashed color="var(--tf-art-siegel)" />, text: "Rot gestrichelt: vom Kartell bewacht; grau: frei" },
|
||||
{ icon: <><FieldRing color="var(--tf-art-ink)" /><FieldRing color="var(--tf-art-moos)" /></>, text: "Ring in Besitzerfarbe wie die Häfen; Linien und Hof: Einflusszone einer Allianz" },
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -79,8 +79,8 @@ const GROUPS: { title: string; items: Item[] }[] = [
|
||||
{ icon: <VaneIcon pennant={false} />, text: "Windfahne: Pfeil zeigt, wohin der Wind weht; je Strich stärker, zwei Striche ab 6 Bft (Schiffe langsamer)" },
|
||||
{ icon: <VaneIcon pennant />, text: "Wimpel an der Windfahne: Sturm ab 9 Bft" },
|
||||
{ icon: <StormFlag />, text: "Sturmwimpel: Schiffe langsamer, Flugzeuge schwächer, am eigenen Hafen bleiben sie am Boden; rötlicher Ton: Schiffe gebremst" },
|
||||
{ icon: <Hatch d="M2 14 L14 2 M7 16 L16 7 M0 9 L9 0" color="#8c96a3" />, text: "Wolken, Striche darunter: Regen; Wolken schwächen den Luftschlag" },
|
||||
{ icon: <Hatch d="M1 6 H4 M7 6 H10 M13 6 H16 M1 11 H4 M7 11 H10 M13 11 H16" color="#2d5b7a" />, text: "Nebel: Aufklärung ungenau, Radar am eigenen Hafen kürzer" },
|
||||
{ icon: <Hatch d="M2 14 L14 2 M7 16 L16 7 M0 9 L9 0" color="var(--tf-art-luft)" />, text: "Wolken, Striche darunter: Regen; Wolken schwächen den Luftschlag" },
|
||||
{ icon: <Hatch d="M1 6 H4 M7 6 H10 M13 6 H16 M1 11 H4 M7 11 H10 M13 11 H16" color="var(--tf-art-see)" />, text: "Nebel: Aufklärung ungenau, Radar am eigenen Hafen kürzer" },
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -88,14 +88,14 @@ const GROUPS: { title: string; items: Item[] }[] = [
|
||||
function PressureIcon() {
|
||||
return (
|
||||
<svg width="34" height="18" viewBox="0 0 34 18" aria-hidden="true">
|
||||
<ellipse cx="17" cy="9" rx="15" ry="7.5" fill="none" stroke="#18273a" strokeOpacity={0.5} strokeWidth={1} />
|
||||
<ellipse cx="17" cy="9" rx="9" ry="4.5" fill="none" stroke="#18273a" strokeOpacity={0.5} strokeWidth={1} />
|
||||
<text x="17" y="12.5" textAnchor="middle" fontSize="10" fontWeight="700" fill="#a8331f" fontFamily="Fraunces, Georgia, serif">T</text>
|
||||
<ellipse cx="17" cy="9" rx="15" ry="7.5" fill="none" stroke="var(--tf-art-ink)" strokeOpacity={0.5} strokeWidth={1} />
|
||||
<ellipse cx="17" cy="9" rx="9" ry="4.5" fill="none" stroke="var(--tf-art-ink)" strokeOpacity={0.5} strokeWidth={1} />
|
||||
<text x="17" y="12.5" textAnchor="middle" fontSize="10" fontWeight="700" fill="var(--tf-art-siegel)" fontFamily="Fraunces, Georgia, serif">T</text>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
const FRONT_HEX = { kalt: "#2f5fa3", warm: "#a8331f", okklusion: "#6b4a7a" } as const;
|
||||
const FRONT_HEX = { kalt: "var(--tf-art-see)", warm: "var(--tf-art-siegel)", okklusion: "#6b4a7a" } as const;
|
||||
|
||||
/** Frontzeichen wie auf der Karte: Linie mit Dreiecken, Halbkreisen oder beidem im Wechsel. */
|
||||
function FrontIcon({ kind }: { kind: keyof typeof FRONT_HEX }) {
|
||||
@@ -114,8 +114,8 @@ function FrontIcon({ kind }: { kind: keyof typeof FRONT_HEX }) {
|
||||
function VaneIcon({ pennant }: { pennant: boolean }) {
|
||||
return (
|
||||
<svg width="30" height="18" viewBox="0 0 30 18" aria-hidden="true">
|
||||
<path d="M3 12 H27 M22 8.5 L27 12 L22 15.5" fill="none" stroke="#18273a" strokeWidth={1.3} strokeLinecap="round" strokeLinejoin="round" />
|
||||
{pennant ? <path d="M3 12 L5 3 L8 12 Z" fill="#18273a" /> : <path d="M4 12 L6 4 M8 12 L10 4 M12 12 L13 8" fill="none" stroke="#18273a" strokeWidth={1.3} strokeLinecap="round" />}
|
||||
<path d="M3 12 H27 M22 8.5 L27 12 L22 15.5" fill="none" stroke="var(--tf-art-ink)" strokeWidth={1.3} strokeLinecap="round" strokeLinejoin="round" />
|
||||
{pennant ? <path d="M3 12 L5 3 L8 12 Z" fill="var(--tf-art-ink)" /> : <path d="M4 12 L6 4 M8 12 L10 4 M12 12 L13 8" fill="none" stroke="var(--tf-art-ink)" strokeWidth={1.3} strokeLinecap="round" />}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -123,29 +123,29 @@ function VaneIcon({ pennant }: { pennant: boolean }) {
|
||||
function StormFlag() {
|
||||
return (
|
||||
<svg width="22" height="18" viewBox="0 0 22 18" aria-hidden="true">
|
||||
<path d="M6 1 V17" stroke="#18273a" strokeWidth={1.3} />
|
||||
<path d="M6 1.5 L17 4 L6 6.5 Z M6 8.5 L17 11 L6 13.5 Z" fill="#a8331f" />
|
||||
<path d="M6 1 V17" stroke="var(--tf-art-ink)" strokeWidth={1.3} />
|
||||
<path d="M6 1.5 L17 4 L6 6.5 Z M6 8.5 L17 11 L6 13.5 Z" fill="var(--tf-art-siegel)" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function FieldRing({ color, dashed }: { color: string; dashed?: boolean }) {
|
||||
return <svg width="20" height="20" viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="8" fill="#fbf8f0" stroke={color} strokeWidth={1.8} strokeDasharray={dashed ? "3 2" : undefined} /></svg>;
|
||||
return <svg width="20" height="20" viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="8" fill="var(--tf-art-paper)" stroke={color} strokeWidth={1.8} strokeDasharray={dashed ? "3 2" : undefined} /></svg>;
|
||||
}
|
||||
|
||||
function FogSwatch() {
|
||||
return <svg width="22" height="18" viewBox="0 0 22 18" aria-hidden="true"><rect x="1" y="2" width="20" height="14" fill="#5d6f82" fillOpacity={0.3} stroke="#5d6f82" strokeOpacity={0.5} /></svg>;
|
||||
return <svg width="22" height="18" viewBox="0 0 22 18" aria-hidden="true"><rect x="1" y="2" width="20" height="14" fill="var(--tf-art-luft)" fillOpacity={0.3} stroke="var(--tf-art-luft)" strokeOpacity={0.5} /></svg>;
|
||||
}
|
||||
|
||||
function SensorRing() {
|
||||
return <svg width="22" height="22" viewBox="0 0 22 22" aria-hidden="true"><circle cx="11" cy="11" r="9" fill="none" stroke="#2d5b7a" strokeWidth={1.3} strokeDasharray="3 3" /></svg>;
|
||||
return <svg width="22" height="22" viewBox="0 0 22 22" aria-hidden="true"><circle cx="11" cy="11" r="9" fill="none" stroke="var(--tf-art-see)" strokeWidth={1.3} strokeDasharray="3 3" /></svg>;
|
||||
}
|
||||
|
||||
function UnknownNest() {
|
||||
return (
|
||||
<svg width="22" height="22" viewBox="-12 -12 24 24" aria-hidden="true">
|
||||
<polygon points="0,-10 10,0 0,10 -10,0" fill="#fbf8f0" stroke="#18273a" strokeOpacity={0.7} strokeWidth={1.2} />
|
||||
<text x="0" y="3.5" textAnchor="middle" fontSize="10" fontWeight="600" fill="#18273a" fontFamily="Fraunces, Georgia, serif">?</text>
|
||||
<polygon points="0,-10 10,0 0,10 -10,0" fill="var(--tf-art-paper)" stroke="var(--tf-art-ink)" strokeOpacity={0.7} strokeWidth={1.2} />
|
||||
<text x="0" y="3.5" textAnchor="middle" fontSize="10" fontWeight="600" fill="var(--tf-art-ink)" fontFamily="Fraunces, Georgia, serif">?</text>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -153,9 +153,9 @@ function UnknownNest() {
|
||||
function FleetArrow() {
|
||||
return (
|
||||
<svg width="24" height="26" viewBox="-12 -12 24 26" aria-hidden="true">
|
||||
<circle r="10" fill="#fbf8f0" stroke="#18273a" strokeWidth={1.2} />
|
||||
<polygon points="0,-8 5,5 0,2 -5,5" fill="#18273a" transform="rotate(45)" />
|
||||
<text x="0" y="13" textAnchor="middle" fontSize="7" fontWeight="600" fill="#18273a" fontFamily="'IBM Plex Mono', monospace">M</text>
|
||||
<circle r="10" fill="var(--tf-art-paper)" stroke="var(--tf-art-ink)" strokeWidth={1.2} />
|
||||
<polygon points="0,-8 5,5 0,2 -5,5" fill="var(--tf-art-ink)" transform="rotate(45)" />
|
||||
<text x="0" y="13" textAnchor="middle" fontSize="7" fontWeight="600" fill="var(--tf-art-ink)" fontFamily="'IBM Plex Mono', monospace">M</text>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -164,8 +164,8 @@ function FleetArrow() {
|
||||
export function UnknownNestMark({ size = 24 }: { size?: number }) {
|
||||
return (
|
||||
<svg width={size} height={size} viewBox="-13 -13 26 26" aria-hidden="true">
|
||||
<path d="M0 -12 L12 0 L0 12 L-12 0 Z" fill="#fbf8f0" fillOpacity={0.85} stroke="#18273a" strokeOpacity={0.7} strokeWidth={1.2} />
|
||||
<text x="0" y="4" textAnchor="middle" fontSize="11" fontFamily="Fraunces, serif" fontWeight="600" fill="#18273a">?</text>
|
||||
<path d="M0 -12 L12 0 L0 12 L-12 0 Z" fill="var(--tf-art-paper)" fillOpacity={0.85} stroke="var(--tf-art-ink)" strokeOpacity={0.7} strokeWidth={1.2} />
|
||||
<text x="0" y="4" textAnchor="middle" fontSize="11" fontFamily="Fraunces, serif" fontWeight="600" fill="var(--tf-art-ink)">?</text>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -173,10 +173,10 @@ export function UnknownNestMark({ size = 24 }: { size?: number }) {
|
||||
function ConvoyMark({ fill }: { fill: string }) {
|
||||
return (
|
||||
<svg width="22" height="16" viewBox="-11 -8 22 16" aria-hidden="true">
|
||||
<path d="M-9 0 H9 L6 4.5 H-7 Z" fill={fill} stroke="#18273a" strokeWidth={1} />
|
||||
<rect x="-5" y="-4" width="4" height="4" fill="#fbf8f0" stroke="#18273a" strokeWidth={0.9} />
|
||||
<rect x="0" y="-3" width="3.5" height="3" fill="#fbf8f0" stroke="#18273a" strokeWidth={0.9} />
|
||||
<path d="M5.5 0 V-6" stroke="#18273a" strokeWidth={1} />
|
||||
<path d="M-9 0 H9 L6 4.5 H-7 Z" fill={fill} stroke="var(--tf-art-ink)" strokeWidth={1} />
|
||||
<rect x="-5" y="-4" width="4" height="4" fill="var(--tf-art-paper)" stroke="var(--tf-art-ink)" strokeWidth={0.9} />
|
||||
<rect x="0" y="-3" width="3.5" height="3" fill="var(--tf-art-paper)" stroke="var(--tf-art-ink)" strokeWidth={0.9} />
|
||||
<path d="M5.5 0 V-6" stroke="var(--tf-art-ink)" strokeWidth={1} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -210,16 +210,16 @@ export function LegendBody() {
|
||||
function PostMark() {
|
||||
return (
|
||||
<svg width="22" height="22" viewBox="-11 -11 22 22" aria-hidden="true">
|
||||
<circle r="9" fill="#fbf8f0" stroke="#2d5b7a" strokeWidth={1.3} />
|
||||
<path d="M0 5 V-3 M-4 -6 Q0 -1 4 -6" fill="none" stroke="#2d5b7a" strokeWidth={1.5} />
|
||||
<circle r="9" fill="var(--tf-art-paper)" stroke="var(--tf-art-see)" strokeWidth={1.3} />
|
||||
<path d="M0 5 V-3 M-4 -6 Q0 -1 4 -6" fill="none" stroke="var(--tf-art-see)" strokeWidth={1.5} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function StripMark() {
|
||||
return <svg width="22" height="22" viewBox="0 0 22 22" aria-hidden="true"><path d="M5 1 V21 M17 1 V21" stroke="#18273a" strokeWidth={1.3} strokeDasharray="3 2" /><rect x="5" y="1" width="12" height="20" fill="#18273a" fillOpacity={0.06} /></svg>;
|
||||
return <svg width="22" height="22" viewBox="0 0 22 22" aria-hidden="true"><path d="M5 1 V21 M17 1 V21" stroke="var(--tf-art-ink)" strokeWidth={1.3} strokeDasharray="3 2" /><rect x="5" y="1" width="12" height="20" fill="var(--tf-art-ink)" fillOpacity={0.06} /></svg>;
|
||||
}
|
||||
|
||||
function SonarRing() {
|
||||
return <svg width="22" height="22" viewBox="0 0 22 22" aria-hidden="true"><circle cx="11" cy="11" r="9" fill="none" stroke="#3d6b4f" strokeWidth={1.3} strokeDasharray="3 3" /></svg>;
|
||||
return <svg width="22" height="22" viewBox="0 0 22 22" aria-hidden="true"><circle cx="11" cy="11" r="9" fill="none" stroke="var(--tf-art-moos)" strokeWidth={1.3} strokeDasharray="3 3" /></svg>;
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
// SVG-Nachbildungen der Kartenzeichen (für Legende und Info-Blatt), im Stil der Seekarte.
|
||||
const INK = "#18273a";
|
||||
const PAPER = "#fbf8f0";
|
||||
const SIEGEL = "#a8331f";
|
||||
const SEE = "#2d5b7a";
|
||||
const ALLY = "#3d6b4f";
|
||||
const PAKT = "#9a7424";
|
||||
const INK = "var(--tf-art-ink)";
|
||||
const PAPER = "var(--tf-art-paper)";
|
||||
const SIEGEL = "var(--tf-art-siegel)";
|
||||
const SEE = "var(--tf-art-see)";
|
||||
const ALLY = "var(--tf-art-moos)";
|
||||
const PAKT = "var(--tf-art-messing)";
|
||||
const ROMAN = ["", "I", "II", "III", "IV", "V", "VI"];
|
||||
|
||||
/** Farben der Verhältnisse (wie map/symbols.ts). */
|
||||
@@ -23,7 +23,7 @@ export function relationKind(relation: string | undefined): TacticalKind {
|
||||
function Dot({ color, r = 7, hollow = false }: { color: string; r?: number; hollow?: boolean }) {
|
||||
return hollow
|
||||
? <circle r={r} fill={PAPER} stroke={color} strokeWidth="1.6" />
|
||||
: <><circle r={r + 1.6} fill={PAPER} stroke="#c9c2b0" strokeWidth="0.6" /><circle r={r} fill={color} /></>;
|
||||
: <><circle r={r + 1.6} fill={PAPER} stroke="var(--tf-rule)" strokeWidth="0.6" /><circle r={r} fill={color} /></>;
|
||||
}
|
||||
|
||||
function Anchor({ color, k = 1 }: { color: string; k?: number }) {
|
||||
@@ -65,8 +65,8 @@ export function TacticalIcon({ kind, level = 1, size = 28 }: { kind: TacticalKin
|
||||
)}
|
||||
{kind === "nestEmpty" && (
|
||||
<>
|
||||
<polygon points="0,-13 13,0 0,13 -13,0" fill="none" stroke="#59636f" strokeWidth="1.4" strokeDasharray="3 3" />
|
||||
<text x="0" y="3.5" textAnchor="middle" fontSize="9" fontFamily="Fraunces, Georgia, serif" fontWeight="600" fill="#59636f">{roman}</text>
|
||||
<polygon points="0,-13 13,0 0,13 -13,0" fill="none" stroke="var(--tf-art-luft)" strokeWidth="1.4" strokeDasharray="3 3" />
|
||||
<text x="0" y="3.5" textAnchor="middle" fontSize="9" fontFamily="Fraunces, Georgia, serif" fontWeight="600" fill="var(--tf-art-luft)">{roman}</text>
|
||||
</>
|
||||
)}
|
||||
{kind === "wreck" && (
|
||||
|
||||
@@ -60,9 +60,16 @@ export function contourLines(f: Float32Array, w: number, h: number, th: number):
|
||||
|
||||
const edge = (a: number, b: number) => (a < b ? `${a}-${b}` : `${b}-${a}`);
|
||||
|
||||
/** Douglas-Peucker: Punkte mit Abweichung unter tol weglassen. */
|
||||
/** Douglas-Peucker: Punkte mit Abweichung unter tol weglassen (geschlossene Züge am fernsten Punkt geteilt). */
|
||||
export function simplify(p: Poly, tol: number): Poly {
|
||||
if (p.length < 3) return p;
|
||||
const a = p[0], z = p[p.length - 1];
|
||||
if (a.x === z.x && a.y === z.y) {
|
||||
let m = 1, md = -1;
|
||||
for (let i = 1; i < p.length - 1; i++) { const d = Math.hypot(p[i].x - a.x, p[i].y - a.y); if (d > md) { md = d; m = i; } }
|
||||
if (md <= 0) return p;
|
||||
return [...simplify(p.slice(0, m + 1), tol), ...simplify(p.slice(m), tol).slice(1)];
|
||||
}
|
||||
const keep = new Uint8Array(p.length);
|
||||
keep[0] = keep[p.length - 1] = 1;
|
||||
const stack: [number, number][] = [[0, p.length - 1]];
|
||||
|
||||
@@ -6,10 +6,10 @@ import { TEXT_RESOLUTION } from "./density.ts"; // Karte 2: Schrift in Gerätepi
|
||||
import { LAT1, LON0 } from "@tidefront/world";
|
||||
import { xyOf } from "./terrain.ts";
|
||||
import { fmtLat, fmtLon } from "./coords.ts";
|
||||
import { PAPER } from "./symbols.ts";
|
||||
import { INK, MUTED, PAPER } from "./symbols.ts";
|
||||
|
||||
const LON_MIN = -90, LON_MAX = 50, LAT_MIN = 20, LAT_MAX = 76;
|
||||
const STYLE = { fontFamily: "'IBM Plex Mono', ui-monospace, Menlo, monospace", fontSize: 9.5, fill: 0x4f5b69, fontWeight: "500" as const };
|
||||
const style = () => ({ fontFamily: "'IBM Plex Mono', ui-monospace, Menlo, monospace", fontSize: 9.5, fill: MUTED, fontWeight: "500" as const });
|
||||
const STEPS = [5, 10, 20];
|
||||
/** Mindestabstand der Beschriftungen in Bildschirm-Pixeln (Länge: Textbreite plus Luft). */
|
||||
const MIN_LON_PX = 62;
|
||||
@@ -30,10 +30,10 @@ export class Graticule {
|
||||
|
||||
private text(s: string): Container {
|
||||
const c = new Container();
|
||||
const t = new Text({ text: s, style: STYLE });
|
||||
const t = new Text({ text: s, style: style() });
|
||||
t.resolution = TEXT_RESOLUTION;
|
||||
t.position.set(3, 1);
|
||||
const bg = new Graphics().roundRect(0, 0, t.width + 6, t.height + 2, 1.5).fill({ color: PAPER, alpha: 0.88 }).stroke({ color: 0x4f5b69, width: 0.6, alpha: 0.45 });
|
||||
const bg = new Graphics().roundRect(0, 0, t.width + 6, t.height + 2, 1.5).fill({ color: PAPER, alpha: 0.88 }).stroke({ color: MUTED, width: 0.6, alpha: 0.45 });
|
||||
c.addChild(bg, t);
|
||||
c.visible = false;
|
||||
this.labels.addChild(c);
|
||||
@@ -60,7 +60,7 @@ export class Graticule {
|
||||
const x = xyOf(lon, LAT1).x;
|
||||
if (x >= m.x0 && x <= m.x1) g.moveTo(x, m.y0).lineTo(x, m.y1);
|
||||
}
|
||||
g.stroke({ color: 0x18273a, width: 1, pixelLine: true, alpha: scale < 0.3 ? 0.18 : 0.26 });
|
||||
g.stroke({ color: INK, width: 1, pixelLine: true, alpha: scale < 0.3 ? 0.18 : 0.26 });
|
||||
}
|
||||
|
||||
/** Beschriftungen an den Bildrand legen (Bildschirmkoordinaten; die Ebene liegt außerhalb der Welt). */
|
||||
|
||||
@@ -10,7 +10,7 @@ import { TEXT_RESOLUTION } from "./density.ts"; // Karte 2: Schrift in Gerätepi
|
||||
import { COLS, ROWS, HEX_SIZE_KM, hexAtXY, hexCenterXY } from "@tidefront/world";
|
||||
import { liveLevelAt, type SensorCircle, type SensorKind } from "@tidefront/game-core";
|
||||
import { hexPoints } from "./terrain.ts";
|
||||
import { INK, PAPER, RELATION_COLOR, SEE, SIEGEL, type Relation } from "./symbols.ts";
|
||||
import { ALLY, INK, PAPER, RELATION_COLOR, SEE, SIEGEL, type Relation } from "./symbols.ts";
|
||||
import { sensorRing } from "./sensor-ring.ts";
|
||||
import { fmtAt } from "../lib/time.ts";
|
||||
|
||||
@@ -162,7 +162,7 @@ export function buildIntelLayer(intel: MapIntel, clip: () => Graphics, showSenso
|
||||
// Eigene Verbände auf See zeichnet movers.ts mit wanderndem Kreis; hier nur Häfen, Posten und Fremde der Allianz.
|
||||
const c = hexCenterXY(s.col, s.row);
|
||||
const radar = s.kind === "radar" || s.kind === "posten";
|
||||
const color = radar ? SEE : s.kind === "sonar" ? 0x3d6b4f : INK;
|
||||
const color = radar ? SEE : s.kind === "sonar" ? ALLY : INK;
|
||||
const faint = s.kind === "sonar" || s.kind === "flug" ? 0.7 : 1;
|
||||
sensorRing(rings, c.x, c.y, s.km, sc, { color, alpha: (s.own ? 0.85 : 0.55) * faint, fill: s.own ? 0.045 : 0.025, dash: s.own ? 12 : 6 });
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Container, Graphics } from "pixi.js";
|
||||
import { hexCenterXY, routePointsXY, routePrefixXY } from "@tidefront/world";
|
||||
import { fleetPosition, patrolPoints, type MissionRoute, type PatrolPlan, type RoutedPlan, type SightTurn } from "@tidefront/game-core";
|
||||
import { serverNow } from "../lib/time.ts";
|
||||
import { INK, SIEGEL, alertRing, planeSymbol, shipSymbol } from "./symbols.ts";
|
||||
import { HALO, INK, SIEGEL, alertRing, planeSymbol, shipSymbol } from "./symbols.ts";
|
||||
import { sensorRing } from "./sensor-ring.ts";
|
||||
import { pinScale } from "./lod.ts";
|
||||
import type { Scene } from "../screens/HexMap.tsx";
|
||||
@@ -148,7 +148,7 @@ export function drawMovers(s: Scene, live: { home?: { col: number; row: number }
|
||||
const path = pathOf(m, plan, home, tgt);
|
||||
routePoints += path.length;
|
||||
polyline(s.routes, path);
|
||||
s.routes.stroke({ color: 0xf4f1e7, width: 5 / sc, alpha: 0.8, cap: "round", join: "round" });
|
||||
s.routes.stroke({ color: HALO, width: 5 / sc, alpha: 0.8, cap: "round", join: "round" });
|
||||
for (let i = 1; i < path.length; i++) dashed(s.routes, path[i - 1], path[i], 6 / sc);
|
||||
s.routes.stroke({ color, width: 1.8 / sc, alpha: 0.95 });
|
||||
s.routes.moveTo(tgt.x - 8 / sc, tgt.y).lineTo(tgt.x + 8 / sc, tgt.y).moveTo(tgt.x, tgt.y - 8 / sc).lineTo(tgt.x, tgt.y + 8 / sc);
|
||||
@@ -211,7 +211,7 @@ export function buildRouteLayer(hexes: readonly (readonly [number, number])[], c
|
||||
const pts = routePointsXY({ hexes });
|
||||
if (pts.length >= 2) {
|
||||
polyline(g, pts);
|
||||
g.stroke({ color: 0xf4f1e7, width: 9, alpha: 0.8, cap: "round", join: "round" });
|
||||
g.stroke({ color: HALO, width: 9, alpha: 0.8, cap: "round", join: "round" });
|
||||
for (let i = 1; i < pts.length; i++) dashed(g, pts[i - 1], pts[i], 14);
|
||||
g.stroke({ color: SIEGEL, width: 4, alpha: 0.9 });
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TEXT_RESOLUTION } from "./density.ts"; // Karte 2: Schrift in Gerätepi
|
||||
import { hexCenterXY, routePointsXY } from "@tidefront/world";
|
||||
import { convoyXY, type MapConvoy } from "../lib/convoy.ts";
|
||||
import { fmtDuration, serverNow } from "../lib/time.ts";
|
||||
import { INK, PAPER, SIEGEL, SEE } from "./symbols.ts";
|
||||
import { ALLY, INK, PAPER, SIEGEL, SEE } from "./symbols.ts";
|
||||
|
||||
export interface MapNaval {
|
||||
minefields: { id: number; col: number; row: number; strength: number; own: boolean; allied: boolean }[];
|
||||
@@ -18,7 +18,7 @@ export interface MapNaval {
|
||||
}
|
||||
|
||||
const SERIF = "Fraunces, Georgia, 'Times New Roman', serif";
|
||||
const ALLY = 0x3d6b4f;
|
||||
|
||||
|
||||
function tag(text: string, color: number, y: number): Container {
|
||||
const c = new Container();
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// „Seekarte 2.0“: Farbsatz der Pixi-Karte für hell/dunkel setzen (Symbole und Gelände). Aufruf vor dem Aufbau der
|
||||
// Karte; bei einem Moduswechsel baut LazyHexMap die Karte neu auf (key = Modus).
|
||||
import type { Theme } from "../lib/theme.ts";
|
||||
import { setMapTheme } from "./symbols.ts";
|
||||
import { setTerrainTheme } from "./terrain-raster.ts";
|
||||
|
||||
let current: Theme | null = null;
|
||||
|
||||
export function applyMapTheme(theme: Theme): void {
|
||||
if (current === theme) return;
|
||||
current = theme;
|
||||
setMapTheme(theme);
|
||||
setTerrainTheme(theme);
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
// Karte 2: Zeichnen nach Bedarf statt in jedem Bild. Pixi zeichnet sonst 40-mal je Sekunde die ganze Karte – auch
|
||||
// wenn sich nichts bewegt. Auf Geräten ohne Grafikbeschleunigung (kopflose Browser, ältere Rechner) blockierte das den
|
||||
// Hauptthread (je Bild 300 ms bei 1440 × 900 @2), auf Handys kostet es Akku. Jetzt: volle Bildrate nach Eingaben und
|
||||
// solange sich Ausschnitt, Zoom oder Überblendungen ändern (1,5 s nachlaufend), sonst 4 Bilder je Sekunde (die
|
||||
// Verbände, das Wetter und neue Daten aktualisieren ohnehin nur alle 250 ms).
|
||||
// solange sich Ausschnitt, Zoom oder Überblendungen ändern (1,5 s nachlaufend), sonst 2 Bilder je Sekunde (die
|
||||
// Verbände fahren langsam, Wetter und neue Daten ändern sich selten).
|
||||
import type { Application } from "pixi.js";
|
||||
|
||||
const HOT_MS = 1500;
|
||||
const IDLE_MS = 250;
|
||||
const IDLE_MS = 500;
|
||||
|
||||
export interface RenderLoop {
|
||||
/** Am Ende jedes Ticks: zeichnet, wenn nötig. `changed`: Ausschnitt/Zoom/Überblendung hat sich geändert. */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type { Graphics } from "pixi.js";
|
||||
import { HEX_SIZE_KM, hexCenter, hexCenterXY } from "@tidefront/world";
|
||||
import { hexPoints, xyOf } from "./terrain.ts";
|
||||
import { INK, SIEGEL } from "./symbols.ts";
|
||||
import { BRASS as MESSING, INK, SIEGEL } from "./symbols.ts";
|
||||
|
||||
export interface HarborOverlay {
|
||||
/** Aktiver Hafen (Doppelring, nur bei mehreren eigenen Häfen). */
|
||||
@@ -14,7 +14,7 @@ export interface HarborOverlay {
|
||||
rangeKm: number | null;
|
||||
}
|
||||
|
||||
const MESSING = 0x8a6424;
|
||||
|
||||
|
||||
/** Punkte im Abstand km um (lat, lon) auf der Kugel, in Kartenkoordinaten (Kreis bleibt im Kartenbild korrekt verzerrt). */
|
||||
function rangeRing(lat: number, lon: number, km: number, steps = 96): number[] {
|
||||
|
||||
+36
-16
@@ -2,17 +2,27 @@
|
||||
// In Bildschirm-Pixeln um (0, 0); der Aufrufer setzt Position und Gegenskalierung.
|
||||
import { Container, Graphics, Text } from "pixi.js";
|
||||
import { TEXT_RESOLUTION } from "./density.ts"; // Karte 2: Schrift in Gerätepixeldichte
|
||||
import { mapColors, pixi } from "../lib/theme-map.ts";
|
||||
import type { Theme } from "../lib/theme.ts";
|
||||
|
||||
export const INK = 0x18273a;
|
||||
export const PAPER = 0xfbf8f0;
|
||||
export const SIEGEL = 0xa8331f;
|
||||
export const SEE = 0x2d5b7a;
|
||||
// Karte 2 / „Seekarte 2.0“: Farben folgen hell/dunkel (lib/theme-map.ts). Veränderliche Exporte (live bindings):
|
||||
// setMapTheme() setzt sie, bevor die Karte (neu) aufgebaut wird; alle Zeichenfunktionen lesen sie beim Zeichnen.
|
||||
export let INK = 0x14243a;
|
||||
export let PAPER = 0xfffaf0;
|
||||
export let SIEGEL = 0xa8321f;
|
||||
export let SEE = 0x1e3a5f;
|
||||
/** Gedämpfte Schrift und Konturen (unbekannt, verlassen, Gradnetz). */
|
||||
export let MUTED = 0x4a5568;
|
||||
/** Hof um Schrift und Routen in Meeresfarbe. */
|
||||
export let HALO = 0xd6e3e6;
|
||||
export let SEA_LABEL = 0x4f6f7c;
|
||||
export let LAND_LABEL = 0x7a6c4f;
|
||||
export let BRASS = 0xa37f2c;
|
||||
/** Farben für Verbände: Hinfahrt Siegelrot, Rückfahrt Tinte. Namen bleiben für ältere Aufrufer. */
|
||||
export const FRIEND = SIEGEL;
|
||||
export const NEUTRAL = SEE;
|
||||
export const HOSTILE = SIEGEL;
|
||||
export let FRIEND = SIEGEL;
|
||||
export let NEUTRAL = SEE;
|
||||
export let HOSTILE = SIEGEL;
|
||||
const SERIF = "Fraunces, Georgia, 'Times New Roman', serif";
|
||||
const SANS = "'IBM Plex Sans', system-ui, sans-serif";
|
||||
const ROMAN = ["", "I", "II", "III", "IV", "V", "VI"];
|
||||
|
||||
function txt(s: string, size: number, fill: number, family = SERIF, weight = "600", spacing = 0): Text {
|
||||
@@ -53,10 +63,20 @@ export function ownBaseSymbol(): Container {
|
||||
/** Verhältnis eines fremden Hafens zum Betrachter (aus der Kartenansicht). */
|
||||
export type Relation = "allianz" | "pakt" | "krieg" | "neutral";
|
||||
/** Grünspan für die eigene Allianz, Ocker für Paktpartner, Siegelrot für Kriegsgegner, Seeblau neutral. */
|
||||
export const ALLY = 0x3d6b4f;
|
||||
export const PAKT = 0x9a7424;
|
||||
export let ALLY = 0x2f6b4f;
|
||||
export let PAKT = 0xa37f2c;
|
||||
export const RELATION_COLOR: Record<Relation, number> = { allianz: ALLY, pakt: PAKT, krieg: SIEGEL, neutral: SEE };
|
||||
|
||||
/** Farbsatz der Karte setzen (vor dem Aufbau; bei Moduswechsel wird die Karte neu aufgebaut). */
|
||||
export function setMapTheme(theme: Theme): void {
|
||||
const c = mapColors(theme);
|
||||
INK = pixi(c.symbolInk); PAPER = pixi(c.symbolFill); SIEGEL = pixi(c.alarm); SEE = pixi(c.accent);
|
||||
MUTED = pixi(c.muted); HALO = pixi(c.sea); SEA_LABEL = pixi(c.seaLabel); LAND_LABEL = pixi(c.landLabel); BRASS = pixi(c.brass);
|
||||
ALLY = pixi(c.good); PAKT = pixi(c.brass);
|
||||
FRIEND = SIEGEL; NEUTRAL = SEE; HOSTILE = SIEGEL;
|
||||
Object.assign(RELATION_COLOR, { allianz: ALLY, pakt: PAKT, krieg: SIEGEL, neutral: SEE });
|
||||
}
|
||||
|
||||
/**
|
||||
* Fremder Spielerhafen: Papierkreis mit Anker in der Farbe des Verhältnisses; Allianz mit innerem Doppelring,
|
||||
* Krieg mit vier Peilstrichen, geschützt mit gestricheltem Außenring.
|
||||
@@ -126,14 +146,14 @@ export function nestSymbol(level: number | null, empty: boolean | null): Contain
|
||||
g.moveTo(ax + (bx - ax) * t, ay + (by - ay) * t).lineTo(ax + (bx - ax) * t2, ay + (by - ay) * t2);
|
||||
}
|
||||
}
|
||||
g.stroke({ color: 0x59636f, width: 1.4 });
|
||||
g.stroke({ color: MUTED, width: 1.4 });
|
||||
} else {
|
||||
if (level >= 6) g.poly([0, -r - 3.5, r + 3.5, 0, 0, r + 3.5, -r - 3.5, 0]).stroke({ color: SIEGEL, width: 1.2 }); // Stufe VI: Außenraute
|
||||
g.poly([0, -r, r, 0, 0, r, -r, 0]).fill({ color: SIEGEL });
|
||||
g.poly([0, -r + 3.5, r - 3.5, 0, 0, r - 3.5, -r + 3.5, 0]).stroke({ color: PAPER, width: 0.8 });
|
||||
}
|
||||
c.addChild(g);
|
||||
const t = txt(roman, roman.length > 2 ? 7.5 : 9, empty ? 0x59636f : PAPER, SERIF, "600");
|
||||
const t = txt(roman, roman.length > 2 ? 7.5 : 9, empty ? MUTED : PAPER, SERIF, "600");
|
||||
t.anchor.set(0.5, 0.5);
|
||||
t.position.set(0, 0.5);
|
||||
c.addChild(t);
|
||||
@@ -229,7 +249,7 @@ export function compassRose(): Container {
|
||||
|
||||
/** Lotung (Wassertiefe in Metern): kleine kursive Zahl. */
|
||||
export function sounding(m: number): Text {
|
||||
const t = new Text({ text: String(m), style: { fontFamily: SERIF, fontStyle: "italic", fontWeight: "600", fontSize: 9, fill: 0x5b7486 } });
|
||||
const t = new Text({ text: String(m), style: { fontFamily: SERIF, fontStyle: "italic", fontWeight: "600", fontSize: 9, fill: SEA_LABEL } });
|
||||
t.resolution = TEXT_RESOLUTION;
|
||||
t.anchor.set(0.5);
|
||||
return t;
|
||||
@@ -240,13 +260,13 @@ export function mapLabel(name: string, kind: "sea" | "region", size: number): Te
|
||||
const t = new Text({
|
||||
text: sea ? name : name.toUpperCase(),
|
||||
style: {
|
||||
fontFamily: sea ? SERIF : SANS,
|
||||
fontFamily: SERIF, // „Seekarte 2.0“: Landnamen Fraunces-Versalien gesperrt, Meere Fraunces kursiv
|
||||
fontStyle: sea ? "italic" : "normal",
|
||||
fontWeight: "600",
|
||||
fontSize: Math.round((sea ? 12 : 10.5) * size),
|
||||
letterSpacing: sea ? 1.5 : 3.5,
|
||||
fill: sea ? SEE : 0x4f5b69,
|
||||
stroke: { color: 0xf4f1e7, width: 3, alpha: 0.85 },
|
||||
fill: sea ? SEA_LABEL : LAND_LABEL,
|
||||
stroke: { color: HALO, width: sea ? 3 : 0, alpha: 0.85 },
|
||||
},
|
||||
});
|
||||
t.resolution = TEXT_RESOLUTION;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
import { COLS, HEX_SIZE_KM, HEX_W, KM_PER_DEG_LAT, KM_PER_DEG_LON, LAT1, LON0, ROWS, ROW_H } from "@tidefront/world";
|
||||
import { coastGeometry, type XY } from "./coastline.ts";
|
||||
import { contourLines, simplify, smoothOpen } from "./contours.ts";
|
||||
import { mapColors, pixi } from "../lib/theme-map.ts";
|
||||
import type { Theme } from "../lib/theme.ts";
|
||||
|
||||
/** Rasterauflösung: Kilometer je Pixel (weiche Flächen; Kanten kommen aus Vektoren). */
|
||||
export const KM_PX = 5;
|
||||
@@ -81,13 +83,28 @@ const lerp = (a: RGB, b: RGB, t: number): RGB => [a[0] + (b[0] - a[0]) * t, a[1]
|
||||
const clamp01 = (v: number) => (v < 0 ? 0 : v > 1 ? 1 : v);
|
||||
const smooth = (a: number, b: number, v: number) => { const t = clamp01((v - a) / (b - a)); return t * t * (3 - 2 * t); };
|
||||
|
||||
/** Farben im Seekarten-Stil: Papier für Tiefsee, blau getönte Flachwasserstufen, Chamois-Land. */
|
||||
export const COLORS = {
|
||||
sea: 0xf3f0e6, sea1: 0xe6ece4, sea2: 0xd6e5e0, sea3: 0xc2d9d6, isobath: 0x7f9fa4,
|
||||
land: 0xe8d8ad, land2: 0xd9c591, shade: 0x8a7550, ink: 0x18273a, ice: 0xf2eee4, lowland: 0xe3d9b2,
|
||||
};
|
||||
const C = Object.fromEntries(Object.entries(COLORS).map(([k, v]) => [k, rgb(v)])) as Record<keyof typeof COLORS, RGB>;
|
||||
const SEA = [C.sea, C.sea1, C.sea2, C.sea3];
|
||||
const mix = (a: number, b: number, t: number) => { const x = lerp(rgb(a), rgb(b), t); return (Math.round(x[0]) << 16) | (Math.round(x[1]) << 8) | Math.round(x[2]); };
|
||||
|
||||
/**
|
||||
* Geländefarben aus dem Farbsatz „Seekarte 2.0“ (lib/theme-map.ts, hell/dunkel): Meer mit leicht zum Flachwasser
|
||||
* getönten Stufen an der Küste, Land mit zarter Schummerung, Küste, Raster.
|
||||
*/
|
||||
function terrainColors(theme: Theme) {
|
||||
const c = mapColors(theme);
|
||||
const sea = pixi(c.sea), shallow = pixi(c.shallow), land = pixi(c.land), coast = pixi(c.coast);
|
||||
const dark = theme === "dark";
|
||||
return {
|
||||
sea, sea1: mix(sea, shallow, 0.12), sea2: mix(sea, shallow, 0.24), sea3: mix(sea, shallow, 0.38), isobath: mix(shallow, coast, 0.35),
|
||||
shallow, land, land2: mix(land, coast, 0.1), shade: mix(land, dark ? 0x000000 : 0x5a4a2a, 0.5), ink: coast,
|
||||
light: mix(land, dark ? 0x8a8f94 : 0xffffff, 0.6), ice: mix(land, dark ? 0x9aa6b0 : 0xffffff, 0.45), lowland: mix(land, sea, 0.12),
|
||||
coast, grid: pixi(c.grid),
|
||||
};
|
||||
}
|
||||
|
||||
/** Aktuelle Geländefarben (setTerrainTheme vor dem Aufbau). */
|
||||
export let COLORS = terrainColors("light");
|
||||
let theme: Theme = "light";
|
||||
export function setTerrainTheme(t: Theme): void { theme = t; COLORS = terrainColors(t); }
|
||||
|
||||
export interface TerrainRaster {
|
||||
sea: HTMLCanvasElement;
|
||||
@@ -96,7 +113,7 @@ export interface TerrainRaster {
|
||||
isobaths: { near: XY[][]; mid: XY[][]; far: XY[][] };
|
||||
}
|
||||
|
||||
let cached: Promise<TerrainRaster> | null = null;
|
||||
const cached = new Map<Theme, Promise<TerrainRaster>>();
|
||||
|
||||
/** Kurz an den Browser abgeben, damit das Rechnen den Hauptthread nicht blockiert (Eingaben, Zeichnen). */
|
||||
const yieldMain = () => new Promise<void>((r) => setTimeout(r, 0));
|
||||
@@ -108,11 +125,14 @@ const ROWS_PER_STEP = 64;
|
||||
* Hauptthread (Karte 2: erstes Zeichnen ohne lange Blockade; die Karte zeigt solange flache Farben).
|
||||
*/
|
||||
export function terrainRaster(): Promise<TerrainRaster> {
|
||||
cached ??= compute();
|
||||
return cached;
|
||||
let r = cached.get(theme);
|
||||
if (!r) { r = compute(COLORS); cached.set(theme, r); }
|
||||
return r;
|
||||
}
|
||||
|
||||
async function compute(): Promise<TerrainRaster> {
|
||||
async function compute(colors: typeof COLORS): Promise<TerrainRaster> {
|
||||
const C = Object.fromEntries(Object.entries(colors).map(([k, v]) => [k, rgb(v)])) as Record<keyof typeof COLORS, RGB>;
|
||||
const SEA = [C.sea, C.sea1, C.sea2, C.sea3];
|
||||
const geo = coastGeometry();
|
||||
const [mask, mctx] = canvas(W, H);
|
||||
mctx.fillStyle = "#fff";
|
||||
@@ -174,7 +194,7 @@ async function compute(): Promise<TerrainRaster> {
|
||||
c = lerp(c, C.lowland, smooth(0.35, 0.12, e) * 0.5);
|
||||
const hill = smooth(0.45, 1.05, e);
|
||||
c = lerp(c, C.shade, hill * (1 - lit) * 0.55);
|
||||
c = lerp(c, [255, 252, 240], hill * lit * 0.25);
|
||||
c = lerp(c, C.light, hill * lit * 0.25);
|
||||
const greenland = lon < -20 && lon > -62 && lat > 59.5;
|
||||
if (greenland || (lon < -62 && lat > 66)) c = lerp(c, C.ice, smooth(0.25, 0.5, e));
|
||||
c = lerp(c, C.ink, smooth(0.99, 0.7, near[i]) * 0.05 * (m[i * 4 + 3] > 127 ? 1 : 0)); // zarter Küstensaum innen
|
||||
|
||||
@@ -70,7 +70,7 @@ class Islets {
|
||||
this.built = scale;
|
||||
this.g.clear();
|
||||
for (const s of this.list) this.g.circle(s.x, s.y, Math.max(s.r, 1.6 / scale));
|
||||
this.g.fill({ color: COLORS.land }).stroke({ color: COLORS.ink, width: 0.9 / scale, alpha: 0.85 });
|
||||
this.g.fill({ color: COLORS.land }).stroke({ color: COLORS.coast, width: 1.2 / scale, alpha: 1 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,11 +97,10 @@ export function buildTerrain(onUpdate?: () => void): TerrainLayers {
|
||||
const lines = new Container(); // alles mit fester Bildschirmbreite, auf den Kartenrahmen zugeschnitten
|
||||
const shores = clipPaths(geo.shores, b);
|
||||
const layers = [
|
||||
// Küstensaum auf der Seeseite (die innere Hälfte deckt das Land)
|
||||
new ScreenLines(shores, { color: 0x6f9aa6, px: 9, alpha: 0.16 }),
|
||||
new ScreenLines(shores, { color: 0x5d8796, px: 4, alpha: 0.22 }),
|
||||
// Küstensaum auf der Seeseite (Entwurf S5Karte: Flachwasser 10 px, 35 %; die innere Hälfte deckt das Land)
|
||||
new ScreenLines(shores, { color: COLORS.shallow, px: 10, alpha: 0.35 }),
|
||||
];
|
||||
const coast = new ScreenLines(shores, { color: COLORS.ink, px: 1.25, alpha: 0.92 });
|
||||
const coast = new ScreenLines(shores, { color: COLORS.coast, px: 1.5, alpha: 1 });
|
||||
const islets = new Islets(geo.islets);
|
||||
root.addChild(seaFlat);
|
||||
for (const l of layers) lines.addChild(l.g);
|
||||
@@ -138,7 +137,7 @@ export function buildTerrain(onUpdate?: () => void): TerrainLayers {
|
||||
const { x, y } = hexCenterXY(col, row);
|
||||
g.poly(hexPoints(x, y, HEX_SIZE_KM));
|
||||
}
|
||||
g.stroke({ color: COLORS.ink, width: 1, pixelLine: true, alpha: 1 });
|
||||
g.stroke({ color: COLORS.grid, width: 1, pixelLine: true, alpha: 1 });
|
||||
const a = hexCenterXY(c0, r0), z = hexCenterXY(Math.min(COLS, c0 + GT) - 1, Math.min(ROWS, r0 + GT) - 1);
|
||||
gridTiles.push({ g, r: { x0: a.x - 2 * HEX_SIZE_KM, y0: a.y - HEX_SIZE_KM, x1: z.x + 2 * HEX_SIZE_KM, y1: z.y + HEX_SIZE_KM } });
|
||||
grid.addChild(g);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Container, Graphics, Text } from "pixi.js";
|
||||
import { TEXT_RESOLUTION } from "./density.ts"; // Karte 2: Schrift in Gerätepixeldichte
|
||||
import { hexCenterXY } from "@tidefront/world";
|
||||
import { routePosition } from "@tidefront/game-core";
|
||||
import { INK, PAPER, SIEGEL } from "./symbols.ts";
|
||||
import { BRASS, INK, MUTED, PAPER, SIEGEL } from "./symbols.ts";
|
||||
import { xyOf } from "./terrain.ts";
|
||||
import { fmtDuration } from "../lib/time.ts";
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface MapWorldEvent {
|
||||
}
|
||||
|
||||
const SERIF = "Fraunces, Georgia, 'Times New Roman', serif";
|
||||
const GOLD = 0x9a7b2f;
|
||||
|
||||
|
||||
function label(text: string, color: number, y: number): Container {
|
||||
const c = new Container();
|
||||
@@ -47,14 +47,14 @@ function label(text: string, color: number, y: number): Container {
|
||||
export function treasureSymbol(gone = false): Container {
|
||||
const c = new Container();
|
||||
const g = new Graphics();
|
||||
const ink = gone ? 0x59636f : INK;
|
||||
const ink = gone ? MUTED : INK;
|
||||
g.circle(0, 0, 14).fill({ color: PAPER }).stroke({ color: gone ? ink : SIEGEL, width: 1.6 });
|
||||
g.circle(0, 0, 11.5).stroke({ color: gone ? ink : SIEGEL, width: 0.6 });
|
||||
g.poly([-8, 2, 8, 2, 5.5, 6.5, -5.5, 6.5]).fill({ color: ink });
|
||||
for (const [x, h] of [[-4, 7], [0.5, 9], [5, 6]] as const) g.moveTo(x, 2).lineTo(x, 2 - h);
|
||||
g.stroke({ color: ink, width: 1 });
|
||||
for (const [x, h] of [[-4, 7], [0.5, 9], [5, 6]] as const) g.poly([x, 2 - h + 1, x + 3.2, 2 - h / 2, x, 1]).fill({ color: ink, alpha: 0.85 });
|
||||
if (!gone) g.rect(-3, 3.2, 3.6, 2.4).fill({ color: GOLD });
|
||||
if (!gone) g.rect(-3, 3.2, 3.6, 2.4).fill({ color: BRASS });
|
||||
if (gone) g.moveTo(-9, -9).lineTo(9, 9).stroke({ color: SIEGEL, width: 1.4 });
|
||||
c.addChild(g);
|
||||
return c;
|
||||
@@ -95,11 +95,11 @@ export function siegeRing(): Container {
|
||||
export function leviathanSymbol(gone = false): Container {
|
||||
const c = new Container();
|
||||
const g = new Graphics();
|
||||
const ink = gone ? 0x59636f : INK;
|
||||
const ink = gone ? MUTED : INK;
|
||||
g.circle(0, 0, 19).fill({ color: gone ? PAPER : SIEGEL }).stroke({ color: ink, width: 1.4 });
|
||||
g.circle(0, 0, 15.5).stroke({ color: PAPER, width: 0.8 });
|
||||
// Krone aus fünf Zacken (Kartell) und ein langer Rumpf mit Aufbauten (Flaggschiff).
|
||||
g.poly([-9, -4, -9, -11, -5, -7, 0, -13, 5, -7, 9, -11, 9, -4]).fill({ color: gone ? ink : GOLD });
|
||||
g.poly([-9, -4, -9, -11, -5, -7, 0, -13, 5, -7, 9, -11, 9, -4]).fill({ color: gone ? ink : BRASS });
|
||||
g.poly([-13, 2, 13, 2, 9, 8, -9, 8]).fill({ color: gone ? ink : PAPER });
|
||||
g.rect(-6, -2, 4, 4).rect(1, -3, 5, 5).fill({ color: gone ? ink : PAPER });
|
||||
if (gone) g.moveTo(-13, -13).lineTo(13, 13).stroke({ color: SIEGEL, width: 1.6 });
|
||||
@@ -121,7 +121,7 @@ function lifeBar(f: NonNullable<MapWorldEvent["finale"]>, y: number): Container
|
||||
const per = f.initialSections / n;
|
||||
for (let i = 0; i < n; i++) {
|
||||
const x = -w / 2 + i * seg;
|
||||
g.rect(x + 0.5, 6, seg - 1, 3).fill({ color: i * per < f.sections ? GOLD : PAPER }).stroke({ color: INK, width: 0.5 });
|
||||
g.rect(x + 0.5, 6, seg - 1, 3).fill({ color: i * per < f.sections ? BRASS : PAPER }).stroke({ color: INK, width: 0.5 });
|
||||
}
|
||||
c.addChild(g);
|
||||
return c;
|
||||
|
||||
@@ -19,6 +19,7 @@ import { installViewHook } from "../map/view-hook.ts";
|
||||
import { chartFrame, mapClip, tappedHex } from "../map/frame.ts"; // Kartenrahmen, Maske, Tippen auf Zeichen
|
||||
import { MAP_RESOLUTION } from "../map/density.ts"; // Karte 2: volle Gerätepixeldichte
|
||||
import { renderOnDemand } from "../map/render-loop.ts";
|
||||
import { COLORS } from "../map/terrain-raster.ts"; // Farbsatz hell/dunkel
|
||||
import { MAP_BOUNDS, attachGestures, clampScale, clampView, minScale, zoomAround } from "../map/gestures.ts";
|
||||
import {
|
||||
INK, RELATION_COLOR, SEE, SIEGEL, compassRose, diamondDot, dotSymbol, mapLabel, nameTag, nestSymbol, otherBaseSymbol, jammerMark, ownBaseSymbol, portSymbol, wreckSymbol,
|
||||
@@ -138,7 +139,7 @@ export function HexMap(props: HexMapProps) {
|
||||
const shot = registerSnapshotSurface();
|
||||
cleanups.push(() => shot.dispose());
|
||||
void app
|
||||
.init({ resizeTo: el, background: 0xf4f1e7, antialias: true, resolution: MAP_RESOLUTION, autoDensity: true })
|
||||
.init({ resizeTo: el, background: COLORS.sea, antialias: true, resolution: MAP_RESOLUTION, autoDensity: true })
|
||||
.then(fontsReady)
|
||||
.then(() => {
|
||||
if (destroyed) {
|
||||
@@ -239,7 +240,7 @@ export function HexMap(props: HexMapProps) {
|
||||
s.graticule.redraw(sc);
|
||||
intelLayer.current?.rescale?.(sc);
|
||||
// Hexraster erst in der Nahansicht und nur zart; in der Übersicht ganz aus
|
||||
s.grid.alpha = Math.max(0, Math.min(0.3, (sc - 0.3) * 0.6)); // Karte 2: Haarlinien, darum etwas kräftiger
|
||||
s.grid.alpha = Math.max(0, Math.min(0.9, (sc - 0.3) * 1.6)); // Karte 2: Haarlinien in Rasterfarbe des Farbsatzes
|
||||
s.grid.visible = s.grid.alpha > 0.005;
|
||||
terrain.setOverview(sc);
|
||||
lastMove = 0;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Die Karte (PixiJS) wird erst geladen, wenn ein Screen sie zeigt; der erste Start bleibt schlank.
|
||||
import { lazy, Suspense, type ComponentProps } from "react";
|
||||
import { Icon } from "../icons.tsx";
|
||||
import { useTheme } from "../lib/theme.ts";
|
||||
import { applyMapTheme } from "../map/palette.ts";
|
||||
|
||||
const Inner = lazy(() => import("./HexMap.tsx").then((m) => ({ default: m.HexMap })));
|
||||
|
||||
@@ -8,7 +10,7 @@ export type HexMapProps = ComponentProps<typeof Inner>;
|
||||
|
||||
function MapLoading() {
|
||||
return (
|
||||
<div className="w-full h-full grid place-items-center bg-[#061521]">
|
||||
<div className="w-full h-full grid place-items-center bg-paper">
|
||||
<div className="flex flex-col items-center gap-2 text-slate-400">
|
||||
<Icon id="nav-karte" size={40} className="animate-pulse" />
|
||||
<span className="font-mono uppercase tracking-widest text-[11px] text-ink2">Karte wird geladen …</span>
|
||||
@@ -18,9 +20,12 @@ function MapLoading() {
|
||||
}
|
||||
|
||||
export function HexMap(props: HexMapProps) {
|
||||
// „Seekarte 2.0“: Farbsatz hell/dunkel; ein Moduswechsel baut die Karte mit den neuen Farben neu auf.
|
||||
const theme = useTheme();
|
||||
applyMapTheme(theme);
|
||||
return (
|
||||
<Suspense fallback={<MapLoading />}>
|
||||
<Inner {...props} />
|
||||
<Inner key={theme} {...props} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
@@ -262,7 +262,7 @@ test("Versenkung (Finale vorgezogen per Verwaltung): Geschwader, dann Flaggschif
|
||||
|
||||
test("Sammelangriff aufs Flaggschiff: ein Kampf aus dem gemeinsamen K, Schatz und Beute nach Beitrag ohne Laderaum, Allianz in der Ruhmeshalle", async () => {
|
||||
const x = await newPlayer("Erster", 340);
|
||||
const y = await newPlayer("Zweiter", 342);
|
||||
const y = await newPlayer("Zweiter", 344); // Karte 2: 342 rückt zu nah an „Erster“
|
||||
const al = (await createAlliance(engine, x.playerId, { name: "Leviathanjaeger", tag: "LJ" })).allianceId;
|
||||
await db.insert(tables.allianceMember).values({ playerId: y.playerId, allianceId: al, role: "mitglied" });
|
||||
const r = await startFinaleNow(engine, 0);
|
||||
|
||||
@@ -1,25 +1,41 @@
|
||||
// Testhelfer (Karte 2): Einige Tests legen Spieler auf das k-te freie Küstenfeld ab Zeile 10 und verlassen sich auf die
|
||||
// Lage (Nachbarn, kurze Fahrzeiten). Mit den genaueren Küstenlinien verschiebt sich diese Abzählung quer über die
|
||||
// Karte. Darum wird wie bis 0.50 abgezählt (altes Gelände, alte Nest- und Handelshafenfelder) und das Ergebnis auf das
|
||||
// nächste heute gültige freie Küstenfeld nachgeführt – die Lage bleibt praktisch gleich.
|
||||
// Lage (Nachbarn, kurze Fahrzeiten, Seewege zu Nestern). Mit den genaueren Küstenlinien verschiebt sich diese Abzählung
|
||||
// quer über die Karte. Darum wird wie bis 0.50 abgezählt (altes Gelände, alte Nest- und Handelshafenfelder) und jedes
|
||||
// Feld, das heute nicht mehr passt, auf das nächste heute gültige freie Küstenfeld nachgeführt – eindeutig (kein Feld
|
||||
// doppelt) und unabhängig von der Reihenfolge der Aufrufe.
|
||||
import {
|
||||
COLS, ROWS, TRADE_PORTS, hexAtLonLat, hexIndex, isCoast, isTradePortHex, legacyNestSites, legacyTerrainMap, nearestHex, nestSites,
|
||||
type Hex,
|
||||
} from "@tidefront/world";
|
||||
|
||||
export function legacyFreeCoast(skip: number, opts: { noTradePort?: boolean } = {}): Hex {
|
||||
const lists = new Map<boolean, Hex[]>();
|
||||
|
||||
function mapped(noTradePort: boolean): Hex[] {
|
||||
const hit = lists.get(noTradePort);
|
||||
if (hit) return hit;
|
||||
const t = legacyTerrainMap();
|
||||
const oldNests = new Set(legacyNestSites().map((n) => `${n.col},${n.row}`));
|
||||
const oldPorts = new Set(TRADE_PORTS.map(([lon, lat]) => { const h = hexAtLonLat(lon, lat); return `${h.col},${h.row}`; }));
|
||||
const nests = new Set(nestSites().map((n) => `${n.col},${n.row}`));
|
||||
let k = 0;
|
||||
const ok = (c: number, r: number) => isCoast(c, r) && !isTradePortHex(c, r) && !nests.has(`${c},${r}`);
|
||||
const legacy: Hex[] = [];
|
||||
for (let row = 10; row < ROWS; row++) for (let col = 0; col < COLS; col++) {
|
||||
const key = `${col},${row}`;
|
||||
if (t[hexIndex(col, row)] !== "coast" || oldNests.has(key) || (opts.noTradePort && oldPorts.has(key)) || k++ !== skip) continue;
|
||||
const ok = (c: number, r: number) => isCoast(c, r) && !isTradePortHex(c, r) && !nests.has(`${c},${r}`);
|
||||
const h = ok(col, row) ? { col, row } : nearestHex({ col, row }, ok);
|
||||
if (!h) throw new Error("no coast");
|
||||
return h;
|
||||
if (t[hexIndex(col, row)] === "coast" && !oldNests.has(key) && !(noTradePort && oldPorts.has(key))) legacy.push({ col, row });
|
||||
}
|
||||
throw new Error("no coast");
|
||||
const used = new Set(legacy.filter((h) => ok(h.col, h.row)).map((h) => `${h.col},${h.row}`));
|
||||
const out = legacy.map((h) => {
|
||||
if (ok(h.col, h.row)) return h;
|
||||
const n = nearestHex(h, (c, r) => ok(c, r) && !used.has(`${c},${r}`)) ?? h;
|
||||
used.add(`${n.col},${n.row}`);
|
||||
return n;
|
||||
});
|
||||
lists.set(noTradePort, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
export function legacyFreeCoast(skip: number, opts: { noTradePort?: boolean } = {}): Hex {
|
||||
const h = mapped(!!opts.noTradePort)[skip];
|
||||
if (!h) throw new Error("no coast");
|
||||
return h;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { and, eq, sql } from "drizzle-orm";
|
||||
import { createDb, migrateDb, tables } from "@tidefront/db";
|
||||
import { nestSites, isCoast, COLS, ROWS } from "@tidefront/world";
|
||||
import { spyRollOf, type BaseState, type SpyMission } from "@tidefront/game-core";
|
||||
import { legacyFreeCoast } from "./legacy-coast.ts";
|
||||
import {
|
||||
chooseBase, deliverNotices, ensureFieldPlanner, fieldsView, flushMailDigests, launchMission, mailNotice, processDue, register,
|
||||
renderMail, reportMailParts, reportViewFor, saveSmtp, seed, setMailSender, spyLaunch, type Engine, type NoticeJob, type OutgoingMail,
|
||||
@@ -26,12 +27,7 @@ const key = () => `m${++keyN}-${Date.now()}`;
|
||||
const SEED_OK = (() => { let s = 1; while (spyRollOf(s, 20) !== 1) s++; return s; })();
|
||||
|
||||
function freeCoast(skip: number): { col: number; row: number } {
|
||||
const nests = new Set(nestSites().map((n) => `${n.col},${n.row}`));
|
||||
let k = 0;
|
||||
for (let row = 10; row < ROWS; row++) for (let col = 0; col < COLS; col++) {
|
||||
if (isCoast(col, row) && !nests.has(`${col},${row}`) && k++ === skip) return { col, row };
|
||||
}
|
||||
throw new Error("no coast");
|
||||
return legacyFreeCoast(skip); // Karte 2: Lage wie bis 0.50 (legacy-coast.ts)
|
||||
}
|
||||
|
||||
async function newPlayer(name: string, field: number) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
runningSeason, seed, siegeEffects, spawnWorldEvent, trade, worldEventsView, type Engine,
|
||||
} from "../src/index.ts";
|
||||
import { addSecondHarbor } from "./multi-base.ts";
|
||||
import { legacyFreeCoast } from "./legacy-coast.ts";
|
||||
|
||||
const url = process.env.TEST_DATABASE_URL;
|
||||
const HOUR = 3600000;
|
||||
@@ -24,25 +25,25 @@ let keyN = 0;
|
||||
const key = () => `we${++keyN}-${Date.now()}`;
|
||||
|
||||
function freeCoast(skip: number): { col: number; row: number } {
|
||||
const nests = new Set(nestSites().map((n) => `${n.col},${n.row}`));
|
||||
let k = 0;
|
||||
for (let row = 10; row < ROWS; row++) for (let col = 0; col < COLS; col++) {
|
||||
if (isCoast(col, row) && !nests.has(`${col},${row}`) && k++ === skip) return { col, row };
|
||||
}
|
||||
throw new Error("no coast");
|
||||
return legacyFreeCoast(skip); // Karte 2: Lage wie bis 0.50 (legacy-coast.ts)
|
||||
}
|
||||
|
||||
/** Freies Küstenfeld 100–400 km von `near` entfernt (das skip-te solche Feld). */
|
||||
/**
|
||||
* Freies Küstenfeld 100–400 km von `near` entfernt (das skip-te solche Feld, Karte 2: nach Entfernung sortiert – mit den
|
||||
* genaueren Küsten lag das skip-te Feld der Zeilenabtastung sonst oft hinter einer Halbinsel).
|
||||
*/
|
||||
function coastNear(near: { col: number; row: number }, skip: number): { col: number; row: number } {
|
||||
const nests = new Set(nestSites().map((n) => `${n.col},${n.row}`));
|
||||
let k = 0;
|
||||
const out: { col: number; row: number; d: number }[] = [];
|
||||
for (let row = Math.max(0, near.row - 5); row <= Math.min(ROWS - 1, near.row + 5); row++) {
|
||||
for (let col = Math.max(0, near.col - 5); col <= Math.min(COLS - 1, near.col + 5); col++) {
|
||||
const d = hexDistanceKm(near, { col, row });
|
||||
if (isCoast(col, row) && !nests.has(`${col},${row}`) && d >= 100 && d <= 400 && k++ === skip) return { col, row };
|
||||
if (isCoast(col, row) && !nests.has(`${col},${row}`) && d >= 100 && d <= 400) out.push({ col, row, d });
|
||||
}
|
||||
}
|
||||
throw new Error("no coast near");
|
||||
out.sort((a, b) => a.d - b.d || a.row - b.row || a.col - b.col);
|
||||
if (!out[skip]) throw new Error("no coast near");
|
||||
return { col: out[skip].col, row: out[skip].row };
|
||||
}
|
||||
|
||||
/** Spieler mit Hafen; ohne Anfängerschutz (Hafen „alt“), außer protectedBeginner. */
|
||||
@@ -142,7 +143,7 @@ test("Planung: erstes Ereignis nach Saisonbeginn, nie gegen Anfängerschutz, nä
|
||||
});
|
||||
|
||||
test("Schatzschiff abfangen: Abfangpunkt beim Planen, nur der erste Sieger erhält die Beute", async () => {
|
||||
const a = await newPlayer("Kaperer", 60);
|
||||
const a = await newPlayer("Kaperer", 64); // Karte 2: Südgrönland, offene See (Finnischer Meerbusen ist jetzt fast nur Küste)
|
||||
const b = await newPlayer("Spaeter", coastNear(a, 0));
|
||||
const id = await spawn("schatzschiff", a.baseId);
|
||||
// Langsame Fahrt (48 h), damit beide sicher abfangen können.
|
||||
@@ -201,7 +202,7 @@ test("Schatzschiff abfangen: Abfangpunkt beim Planen, nur der erste Sieger erhä
|
||||
});
|
||||
|
||||
test("Großflotte: Ankündigung, Schwächung auf See (Verluste bleiben, Beute und Kampfpunkte), Hafenangriffe mit Schutzregeln", async () => {
|
||||
const a = await newPlayer("Ziel", 90);
|
||||
const a = await newPlayer("Ziel", 66); // Karte 2: Shetland/Schottland – kurzer Seeweg zur Flotte
|
||||
const s = await newPlayer("Schild", coastNear(a, 0));
|
||||
const c = await newPlayer("Jaeger", coastNear(a, 3));
|
||||
// Schild: Schutz nach Niederlage für die ganze Dauer.
|
||||
|
||||
@@ -330,4 +330,21 @@ Analyse und Bilder: `.claude/review-0.22/KARTE-PLAN.md`, `/tmp/tf-karte2/`.
|
||||
`ensureNests` (Migration) legt gerückte Plätze nicht doppelt an, solange das alte Nest liegt.
|
||||
- **Kartenblätter**: Knopf „Mission planen“ heißt „Planen“ (Nest, fremder Hafen, Weltereignis) – die Planung schlägt
|
||||
den Verband vor. Überschrift der Planung bleibt „Mission planen“ (MissionPlan.tsx, anderer Entwickler).
|
||||
- **Leistung** (Integrator-Hinweis 29-huelle): gemessen mit `32-karte-darstellung.spec.ts` („Leistung“, 1440 × 900 @2,
|
||||
150 Wracks, alle Nester, kopfloses Chromium = WebGL ohne Grafikkarte). Ursache der Blockaden: Pixi zeichnete die
|
||||
ganze Karte 40-mal je Sekunde, auch im Stillstand; jedes Bild kostete ohne Grafikkarte 300–900 ms (Masken und
|
||||
Vollbildebenen in 2880 × 1800) – der Hauptthread war dauerhaft belegt. Abhilfe: Zeichnen nach Bedarf
|
||||
(map/render-loop.ts: volle Rate 1,5 s nach Eingabe/Bewegung, sonst 2 Bilder je Sekunde), keine Masken mehr (Land
|
||||
als Vektorfläche mit dem Landbild als Textur, Linien und Gradnetz auf den Kartenrahmen zugeschnitten), Linien in
|
||||
Kacheln mit Ausblenden außerhalb des Sichtbereichs und Vereinfachung auf Bildschirmauflösung, abgeschrägte statt
|
||||
runde Ecken, Geländebild in kleinen Schritten statt in einem Block, ohne Grafikkarte Zeichendichte 1
|
||||
(`localStorage tf-karte-dichte = voll` erzwingt volle Dichte). Danach: Standard – Bilder 50–85 ms, längste
|
||||
Blockade beim Aufbau ~1 s (erstes Zeichnen/Texturhochladen im Grafiktreiber, kaum JS); Dichte 2 erzwungen – Bilder
|
||||
130–210 ms. Mit Grafikkarte fällt die Last fast ganz weg; im Stillstand wird kaum noch gezeichnet (Akku).
|
||||
- **„Seekarte 2.0“ hell/dunkel**: Pixi-Farben aus `mapColors(theme)` (map/palette.ts setzt Symbol- und Geländefarben;
|
||||
LazyHexMap baut die Karte bei Moduswechsel mit `key = Modus` neu auf, Geländebild je Modus zwischengespeichert).
|
||||
Meer, Flachwasser-Saum (10 px, 35 %), Land, Küste (1,5 px), Raster, Landnamen (Fraunces-Versalien) und
|
||||
Meeresnamen (Fraunces kursiv) nach Entwurf S5Karte; Tiefenstufen und Schummerung bleiben dezent im Farbsatz.
|
||||
DOM-Teile (Legende, taktische Zeichen) nutzen die `--tf-art-*`-Tokens; Feldblatt und Kartenleiste nutzen bereits
|
||||
die Farbklassen (Tokens).
|
||||
- Keine Schemaänderung, keine Migration.
|
||||
Reference in new issue
Block a user