8000 Graphic Improvement and Adaptability Per Device by miracles2motion · Pull Request #1 · amiaoapp/inkwave · GitHub
[go: up one dir, main page]

Skip to content

Graphic Improvement and Adaptability Per Device - #1

Open
miracles2motion wants to merge 8 commits into
amiaoapp:mainfrom
miracles2motion:main
Open

miracles2motion wants to merge 8 commits into
amiaoapp:mainfrom
miracles2motion:main

Conversation

@miracles2motion
Copy link
Copy Markdown

feat(perf, mobile): adaptive device profiling, dynamic resolution governor, and mobile/thermal optimizations

Summary

This PR introduces an adaptive, device-relative performance architecture and mobile gameplay enhancements designed to eliminate thermal runaway on laptops, stabilize frame rates at a steady 60 FPS across all hardware tiers, and provide a polished mobile/touch experience.


Key Improvements

1. Adaptive Device Profiling & Dynamic Resolution Governor

  • Hardware Capability Classification (src/core/devicePerf.js): Benchmarks GPU unmasked renderer strings, CPU concurrency, device memory, battery presence, and display density into capability classes (enthusiast, high, medium, low).
  • Device-Relative Quality Engine (src/config.js, src/core/renderer.js): Quality presets (Auto, Low, Medium, High, Ultra) scale relative to the device's hardware and thermal constraints:
    • Laptops & battery-constrained devices: Replaces fixed desktop multipliers with thermally bounded limits (caps shadows to 2048, skips 4× MSAA and full-res GTAO raymarching) to prevent shared heat-pipe saturation and 90°C thermal throttling.
    • Auto Preset: Automatically benchmarks the system and continuously modulates dynamic resolution scaling via PerformanceGovernor to maintain a locked 60 FPS.
    • Direct Framebuffer Fast-Path: Allows low/medium and mobile presets to render directly to the default framebuffer without spinning up the multi-pass post-processing pipeline.

2. Thermal & Idle Power Savers

  • Tab Background Sleep (src/main.js): Suspends rendering when the browser tab is hidden or minimized (if (document.hidden) return;).
  • Menu FPS Limiter: Caps frame rates to 60 FPS in menus and lobbies, preventing GPUs from running unconstrained loops at 240+ FPS while idle.

3. Mobile & Touch Controls Overhaul

  • Aspect Ratio & Safe Areas (styles/touch.css, index.html): Added viewport-fit support and env(safe-area-inset-*) handling to prevent aspect ratio distortion and notch overlap.
  • Multitouch Tracking (src/core/touch.js): Separated pointer IDs for movement, aim look, and weapon firing to prevent touch coordinate jumps during simultaneous actions.
  • Squid Swim Latch: Added quick-tap latching for squid swim mode on touchscreens.
  • Landscape Gate: Clean landscape orientation overlay with CSS backdrop blur and rotation guidance.
  • Pointer Lock Isolation (src/core/input.js): Prevents mobile touches from spuriously requesting desktop pointer lock or causing pause on pointer unlock.

4. Shaders, Actor LOD & Audio Optimizations

  • Ink Shading Fast-Path (src/world/inkShading.js, src/world/levelMaterial.js): Added #ifdef INK_QUALITY_LOW shader path that bypasses bicubic filtering, gel micro-surface, and complex clearcoat specular math on mobile/low settings.
  • Bot & Character LOD (src/game/actor.js, src/game/character.js, src/game/bots.js):
    • Staggers bot navigation perception checks across frames to eliminate CPU garbage collection spikes.
    • Throttles bone pose updates for offscreen or distant bots to every 2nd or 3rd frame.
    • Skips fragment shader dither discard on mobile to preserve GPU Early-Z and tile cache efficiency.
  • Audio Optimization (src/audio/audio.js): Bypasses heavy convolution reverb on mobile/low to prevent buffer underruns and audio clicking/stuttering; applies 24m spatial distance culling and tighter voice caps.

5. Tooling

  • Cross-Platform Build Fix (tools/build-dist.py): Added explicit UTF-8 encoding with error fallback when reading source files, resolving UnicodeDecodeError on Windows systems.

Verification & Testing

  • npm run check: Passed cleanly on all 180 modules (node tools/check-syntax.mjs).
  • npm run build: Succeeded with code 0 (dist ready: 19 addon files + 2 diagnostics).
  • Tested locally on desktop (discrete GPU), laptop (integrated/shared thermals), and mobile touch viewport.

@miracles2motion
Copy link
Copy Markdown
Author

feat(perf, mobile): adaptive device profiling, dynamic resolution governor, and mobile/thermal optimizations

  • Add getDeviceProfile() and PerformanceGovernor to benchmark GPU/RAM/battery and modulate resolution scaling for steady 60 FPS
  • Implement device-relative quality engine (Auto/Low/Med/High/Ultra) bounded by hardware thermal dissipation limits
  • Enable direct framebuffer fast-path for low/medium tiers to eliminate multi-pass post-processing overhead
  • Overhaul touch controls with multitouch pointer tracking, safe area insets, and squid swim latch
  • Add INK_QUALITY_LOW shader defines to bypass bicubic sampling and gel ripples on mobile/low
  • Throttle offscreen bot skeleton pose solving and stagger AI perception queries to eliminate frame time spikes
  • Bypass convolution reverb and add spatial distance culling on mobile/low to resolve audio stuttering
  • Freeze rendering loop when browser tab is hidden and limit menu FPS to 60
  • Fix UnicodeDecodeError in tools/build-dist.py on Windows environments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0