mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-01 02:53:31 +00:00
7c151e76ad
## What
Renders the `transportShipTrail` cosmetic effect in-game. Transport
ships already left a trail, but it was always drawn in the player's
**territory color** — this wires the selected effect through to the
renderer so the trail shows the player's chosen **gradient**.
## How
- **Per-player effect texture** (`RGBA32F`, mirrors the palette texture)
keyed by `smallID`, sampled by the trail fragment shader. Each row holds
a gradient color; spare alpha channels carry the color count,
`colorSize`, and `movementSpeed`.
- **Shader**
([trail.frag.glsl](src/client/render/gl/shaders/map-overlay/trail.frag.glsl))
cycles a flowing gradient through the color list: 1 color → flat, 2+ →
animated bands scrolling along the trail. No effect (count 0) falls back
to the territory color; alt-view keeps affiliation colors.
- **WebGLFrameBuilder** resolves each player's catalog attributes (the
in-game cosmetic is only `{ name, effectType }`; the style/colors live
in the catalog) and encodes them. Resolution is decoupled from the
first-seen palette path so it retries until the catalog loads, and
unparseable colors are dropped so bad catalog data degrades to the
territory color rather than rendering black.
## Schema
Collapses the trail attributes to a single gradient shape:
```ts
{ type: "gradient", colors: string[], colorSize: number, movementSpeed: number }
```
- `colors` — solid = one color, rainbow = the spectrum, gradient = two
or more.
- `colorSize` — band width (tiles per color band; `1` is the default, ~4
tiles).
- `movementSpeed` — scroll rate along the trail (tiles/sec; `0` =
static).
## Notes
- Animation is render-only (local time), no simulation/determinism
impact.
- The catalog (`cosmetics.json`, served by the closed-source API) must
ship effects in this `{ type: "gradient", colors, colorSize,
movementSpeed }` shape.
- Band thickness (`4.0` base in the shader) and the gradient frequency
are visual constants picked without in-game verification — easy to tune.
## Testing
- `tsc --noEmit`, ESLint, Prettier, `build-prod` all clean.
- Schema + Privilege test suites updated for the gradient shape (92
tests pass).
- Not yet visually verified in a running game (effect selection is
flare-gated).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
export type { AttackRingInput } from "../types";
|
|
// createDebugGui is intentionally not re-exported here — it pulls lil-gui and
|
|
// the debug GUI into the main bundle; dynamically import "./debug/index".
|
|
export { GraphicsOverridesSchema } from "./GraphicsOverrides";
|
|
export type { GraphicsOverrides } from "./GraphicsOverrides";
|
|
export { MapRenderer } from "./MapRenderer";
|
|
export { preloadAtlasData } from "./passes/name-pass/AtlasData";
|
|
export type { SpawnCenter } from "./passes/SpawnOverlayPass";
|
|
export { applyGraphicsOverrides } from "./RenderOverrides";
|
|
export { createRenderSettings, dumpSettings } from "./RenderSettings";
|
|
export type { RenderSettings } from "./RenderSettings";
|
|
export { deepAssign, deepDiff } from "./SettingsUtils";
|
|
export {
|
|
MAX_TRAIL_COLORS,
|
|
buildTerrainRGBA,
|
|
getPaletteSize,
|
|
} from "./utils/ColorUtils";
|
|
export { renderDpr } from "./utils/Dpr";
|
|
export { buildNukeTrajectory, samRange } from "./utils/NukeTrajectory";
|
|
export type { SAMInfo } from "./utils/NukeTrajectory";
|
|
|
|
// Re-export shared types used in the public API
|
|
export type {
|
|
NameEntry,
|
|
PlayerState,
|
|
PlayerStatic,
|
|
RendererConfig,
|
|
TilePair,
|
|
UnitState,
|
|
} from "../types";
|