Commit Graph

3790 Commits

Author SHA1 Message Date
scamiv 0285d7c79d Remove stale mover optimization status doc 2026-05-27 16:19:44 +02:00
scamiv 5f0fb81758 Fix NameLayer atlas asset references 2026-05-27 16:11:00 +02:00
scamiv 93445fdfff Handle sprite-less MIRV warhead movers 2026-05-27 15:48:42 +02:00
scamiv 334fc69590 Restore smooth nuke motion and terrain updates 2026-05-27 15:34:02 +02:00
scamiv 91130bc89c Fix UnitLayer selection import after motion integration 2026-05-27 14:46:18 +02:00
scamiv 62d2a904d3 Vendor namelayer emoji font
Keep the NameLayer emoji atlas generation deterministic by loading Twemoji COLR from resources/fonts instead of resolving it through the twemoji-colr-font npm package.

The font file and its OFL license are now checked in next to the other namelayer font assets. This removes the deprecated package dependency while preserving the current Twemoji output until the project chooses a final emoji font/set.
2026-05-27 14:42:25 +02:00
scamiv da33b283be Address namelayer asset builder review nits
Pass the pinned Twemoji font path to FontLibrary.use as an explicit path array, name the color-detection threshold used by atlas validation, and make SVG viewBox width/height extraction easier to read.

Validated with the namelayer asset build and eslint for scripts/build-namelayer-assets.mjs.
2026-05-27 14:41:12 +02:00
scamiv 7a7814ac50 Await name layer initialization before ticks
Make layer initialization awaitable and have GameRenderer wait for each layer init before input and worker ticks start. This prevents the Pixi NameLayer from seeing players before its async font, atlas, and renderer setup has completed.

Also store the AlternateViewEvent handler on NameLayer so destroy() can unsubscribe it, matching the existing resize listener cleanup and preventing torn-down instances from mutating state.
2026-05-27 14:41:12 +02:00
scamiv bd3e8f5c3c Make namelayer atlas generation deterministic
Replace node-canvas in the namelayer asset builder with skia-canvas so icon and emoji atlases are rasterized through the same cross-platform rendering backend. This removes the previous dependency on host Cairo/Pango emoji rendering, which could produce monochrome emoji sprites depending on the local font stack.

Add twemoji-colr-font as a pinned COLR/CPAL emoji font input for the build. The emoji atlas now renders from that explicit font instead of whichever OS emoji font happens to be installed, making the generated sprite sheet stable across developer machines and CI.

Generalize atlas frame packing for both SVG icons and emoji glyphs: render into a scratch canvas, trim to alpha bounds, center, and scale into the cell with consistent padding. This prevents icon frames from touching cell edges while preserving the existing Pixi atlas JSON contract.

Regenerate namelayer emoji and icon atlases. The builder now validates generated atlas frames and fails if any frame is empty or if the emoji atlas contains no color pixels, catching the monochrome-regeneration failure at build time.
2026-05-27 14:41:11 +02:00
scamiv 7139a111ab fix(client): stop retrying failed NameLayer textures; reset font preload in tests
Track permanently failed texture URLs so getTexture does not call PIXI.Assets.load
again after a rejection. Extend resetWarningsForTests to clear failedTextures and
to reset preloadPromise, fontReady, and fontFamily so tests can run preload() and
loadBaseAssets() from a clean state.
2026-05-27 14:38:08 +02:00
scamiv 2adc1486d1 Render NameLayer text with MSDF assets 2026-05-27 14:38:08 +02:00
scamiv 0906475729 Restore world-stable name scaling 2026-05-27 14:36:16 +02:00
scamiv 645efeab9d Address NameLayer review feedback 2026-05-27 14:36:16 +02:00
scamiv fe216cba4b Render name layer with Pixi 2026-05-27 14:35:21 +02:00
scamiv c1936fb289 Make stepper authoritative for sparse motion segments 2026-05-27 14:34:49 +02:00
scamiv 5e0b2f9adb Improve mover overlap redraw stability 2026-05-27 14:34:49 +02:00
scamiv dee283676b Fix UnitLayer perf counters in prod overlay 2026-05-27 14:34:49 +02:00
scamiv d14150e1d9 Split mover budgets for on-screen and off-screen passes 2026-05-27 14:33:30 +02:00
scamiv fc2ac07fab Add zoom-tier mover canvas scaling and rescale metrics 2026-05-27 14:33:30 +02:00
scamiv a07e00669e Optimize transport trail processing and raster helpers 2026-05-27 14:33:30 +02:00
scamiv 55bf863239 Refine UnitLayer mover rendering pipeline
Detailed changelog:

- keep persistent dynamic mover canvas rendering with overlap-safe conflict redraw groups backed by a spatial hash index

- maintain budgeted bucket passes while fixing round-robin starvation by advancing cursors with actual scanned items

- keep mover sampling + draw separation via cached samples and per-unit render rect tracking for precise clear/update paths

- render moving trade/transport ships as explicit 5x5 mask glyphs matching sprite geometry/color semantics (territory/border)

- optimize mask cross rendering by drawing the center cross with 2 rectangles and ring cells via mask iteration

- retain configurable dynamic mover supersampling and composition smoothing experiment hooks

- expose mover subpixel snap control tied to dynamic canvas scale for seam mitigation experiments

- preserve trail update integration and mover-state bookkeeping with the revised dynamic draw pipeline
2026-05-27 14:33:30 +02:00
scamiv cb123c27af Replace mover queue with bucketed scheduler and clarify metrics 2026-05-27 14:33:30 +02:00
scamiv 0a96ab8e30 Optimize mover rendering and segment plan pipeline 2026-05-27 14:33:29 +02:00
scamiv 83a8dc00e4 unit trails: remove unused motionTrailCanvas layer 2026-05-27 14:29:21 +02:00
scamiv a1ff6b717a unit trails: tick fade, transport persist, nuke cleanup 2026-05-27 14:29:21 +02:00
scamiv 51e2310c21 hook into SmoothingWaterTransformer 2026-05-27 14:29:20 +02:00
scamiv 7a3de19a3e v1 slob 2026-05-27 14:29:19 +02:00
scamiv 0275f6a9ef Merge renderer fallback branch 2026-05-27 14:26:01 +02:00
scamiv 6ac8d4d101 Show fallout in WebGL alt view 2026-05-27 02:15:59 +02:00
scamiv 93378846c8 Show matching renderer debug panel 2026-05-26 23:11:59 +02:00
scamiv 2beb449fb4 Add renderer status panel 2026-05-26 23:00:46 +02:00
scamiv d8841fd1ed Add territory renderer fallback controller 2026-05-26 22:43:23 +02:00
scamiv d0be9e26d5 Extend staging deployment lifetime 2026-05-26 21:59:30 +02:00
scamiv 07da3a3e3d Fix WebGPU settings accessors 2026-05-26 20:39:43 +02:00
scamiv 9456d991a0 Update terrain shader parameters
- Modified terrain shader parameters in GroundTruthData for better rendering.
- Added new user-configurable settings for water effects in TerrainShaderRegistry.
- Enhanced terrain compute shaders to incorporate water depth and blur adjustments.
- Refactored shader logic to improve water color blending and depth calculations
2026-05-26 20:23:20 +02:00
scamiv 63ab3b995f Update WebGPUDebugOverlay section title and adjust terrain shader default values
- Changed section title from "Shaders" to "Terrain" in WebGPUDebugOverlay.
- Updated default values for various terrain shader parameters to improve rendering quality, including noise strength, blend width, lighting strength, and cavity strength.
2026-05-26 20:23:20 +02:00
scamiv c9ea04abac Add improved terrain compute shaders with lite and heavy variants
- Add terrain-compute-improved-lite.wgsl and terrain-compute-improved-heavy.wgsl
- Create TerrainShaderRegistry.ts for shader management
- Refactor TerrainComputePass to support dynamic shader switching
- Update TerritoryRenderer, TerritoryLayer, and GroundTruthData for new shader integration
- Enhance WebGPUDebugOverlay with additional debugging capabilities
2026-05-26 20:23:20 +02:00
scamiv fd87b0e3f8 adjusted defaults 2026-05-26 20:23:19 +02:00
scamiv 962d4cabd4 add temporal smoothing for territory rendering
Add user-selectable temporal smoothing pipeline to create smooth visual
transitions between simulation ticks (~10Hz) and display frames (~60Hz).

Pre-render smoothing provides sharp tile dissolve transitions using compute
shaders, while post-render smoothing blends frames for fluid animation.
Includes tick timing with exponential moving averages for stable temporal
parameters.

New Components:
- TerritoryPreSmoothingRegistry & TerritoryPostSmoothingRegistry for mode selection
- VisualStateSmoothingPass compute shader for pre-render dissolve effects
- TemporalResolvePass render shader for post-render temporal compositing
- Enhanced GroundTruthData with temporal uniforms and history textures

Performance: No full-map per-frame compute, single fullscreen post-render pass.
Compatible with all territory shaders (classic, retro, future variants).

Files: 12 files changed, 1357 insertions(+), 8 deletions(-)
2026-05-26 20:23:19 +02:00
scamiv 6330c865ea Add WebGPU Debug Overlay to prod index.html
- Included <webgpu-debug-overlay> component in the main layout
2026-05-26 20:23:19 +02:00
scamiv d82c33863f Add WebGPU Debug Overlay and Shader Management
- Introduced WebGPUComputeMetricsEvent to track compute timing.
- Added WebGPUDebugOverlay component for displaying WebGPU performance metrics.
- Refactored TerritoryLayer to utilize new shader management for territory rendering.
- Updated shaders to support new parameters for enhanced visual effects.
- Removed deprecated territory border mode settings from UserSettingModal and SettingsModal.
- Enhanced GroundTruthData to manage new textures for owner indices and relations.
- Improved shader parameter handling in TerritoryRenderer and related classes.

This commit enhances the WebGPU rendering pipeline, providing better performance insights and visual fidelity through improved shader management and debugging capabilities.
2026-05-26 20:23:19 +02:00
scamiv 29e74af95f fix border mode selection 2026-05-26 20:21:59 +02:00
scamiv 06eb82b1cf border test 9000 2026-05-26 20:21:58 +02:00
scamiv 99e7d36464 Switched loadShader() to a Vite-bundled static shader map using import.meta.glob(..., { as: "raw", eager: true }) 2026-05-26 20:17:52 +02:00
scamiv 97603f7a1a replace defended epoch stamping with defended-strength field
Store defended influence in defendedStrengthTexture and sample it in territory render shader
Recompute defended strength on tick for state-updated tiles and for post-change dirty tiles, with full-map fallback when diffs are large
Pack defense posts by owner on GPU (owner offsets + posts buffer)
Remove old defended clear/update passes and epoch-based params
2026-05-26 20:17:52 +02:00
scamiv 655bb211e1 simplify defended territory rendering logic
Replace epoch-based defended texture tracking with hard-clear approach for
improved reliability and performance. Remove complex dirty state tracking
and epoch incrementing logic in favor of direct hard clears before rebuilds.

Changes:
- Remove wasDefensePostsDirty tracking from TerritoryRenderer
- Replace numUpdates > 0 checks with hasStateUpdates boolean
- Hard-clear defended texture before restamping instead of epoch management
- Mark DefendedUpdatePass as dirty when rebuilding defended state
- Rebuild bind group in DefendedUpdatePass when missing, not just on buffer change

This eliminates potential transient mismatches where defended rendering
disappeared between rebuilds and simplifies the update pipeline.
2026-05-26 20:17:52 +02:00
scamiv 44ffa96b64 refactor: optimize terrain color extraction in GroundTruthData
Replaced tile sampling for terrain colors with direct extraction from the theme object, significantly improving performance. Updated shore, water, shoreline water, plains, highland, and mountain color computations to utilize theme properties, eliminating the need for tile searches. This change enhances efficiency in terrain color management while maintaining visual fidelity.
2026-05-26 20:17:52 +02:00
scamiv 92ba5754d6 refactor: update workgroup size in compute shader and dispatch logic
Modified the workgroup size in the state-update compute shader from 1 to 64 for improved parallel processing. Adjusted the dispatch logic in StateUpdatePass to calculate the correct number of workgroups based on the new size, enhancing performance during state updates. Removed unnecessary terrain parameter upload in TerritoryRenderer to streamline resource management.
2026-05-26 20:17:52 +02:00
scamiv c26acbda3a refactor: optimize terrain recomputation in TerritoryRenderer
Updated the terrain recomputation logic to trigger asynchronously, improving performance by allowing rendering to continue without blocking. This change ensures that the terrain will be ready for the next frame, which may result in displaying stale terrain for one frame but enhances overall rendering efficiency.
2026-05-26 20:17:52 +02:00
scamiv d149ff48dd move terrain color computation to GPU compute shader 2026-05-26 20:17:52 +02:00