perf: adaptive performance mode for mobile

Auto-detect low-end devices (< 4 cores or touch) and reduce visual
complexity: 60% fewer particles, 6 vs 16 speed lines, 15 vs 40 stars,
halved datacenter buildings/racks, skip LED blinking animations,
fewer GPU graveyard chips, reduced afterimages and exhaust particles.

Toggle in fight viewer (LO/HI button), persisted in localStorage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 00:00:48 +00:00
co-authored by Claude Opus 4.6
parent 78f83a7520
commit 5af5ee1cba
4 changed files with 97 additions and 31 deletions
+18
View File
@@ -13,6 +13,7 @@ import {
sfxRandomComedy, sfxRandomFail, sfxVineBoom, sfxEmotionalDamage,
} from '../game/audio'
import { isKokoroLoading, getKokoroProgress } from '../game/tts'
import { isPerfMode, setPerfMode } from '../game/fight/config'
interface Round {
roundNumber: number
@@ -73,6 +74,7 @@ const hitTextY = ref(30)
const glitching = ref(false)
const soundOn = ref(true)
const insanityMode = ref(false)
const perfMode = ref(false)
// Zap the winner
const zapSent = ref(false)
@@ -155,6 +157,12 @@ function toggleInsanity() {
}
}
perfMode.value = isPerfMode()
function togglePerfMode() {
perfMode.value = !perfMode.value
setPerfMode(perfMode.value)
}
// Staggered log
const logItems = ref<{ type: string; round: number; text: string; color: string }[]>([])
@@ -808,6 +816,16 @@ async function _doReplay() {
<path d="M11 5L6 9H2v6h4l5 4V5z"/><line x1="23" y1="9" x2="17" y2="15"/><line x1="17" y1="9" x2="23" y2="15"/>
</svg>
</button>
<button
class="w-8 h-8 flex items-center justify-center border text-[9px] font-pixel tracking-wider transition-all"
:class="perfMode
? 'border-neon-green/70 text-neon-green bg-neon-green/10'
: 'border-border/50 text-text-muted hover:text-neon-green hover:border-neon-green/50'"
:title="perfMode ? 'Performance mode ON (fewer particles)' : 'Performance mode OFF'"
@click="togglePerfMode"
>
{{ perfMode ? 'LO' : 'HI' }}
</button>
<button
v-if="isReplaying"
class="h-8 px-2 flex items-center justify-center border text-[9px] font-pixel tracking-wider transition-all"