diff options
| author | David Skoland <davidskoland@gmail.com> | 2026-04-01 13:59:13 +0200 |
|---|---|---|
| committer | David Skoland <davidskoland@gmail.com> | 2026-04-01 13:59:13 +0200 |
| commit | 10b413c0f0a31bc9476eed86812b6bb90f82caed (patch) | |
| tree | 94ac6676fcad76dc76e901e2889a30f7ba611d8d /webAO/viewport/interfaces/PreloadedAssets.ts | |
| parent | d6163543f483c35737da52b7e307cf6f65828f82 (diff) | |
Add asset preloading system for IC message rendering
Fix rendering race conditions where character sprites, pre-animations,
and paired character assets were displayed before being downloaded.
All assets referenced in an MS packet are now resolved and preloaded
into the browser cache before the animation timeline starts.
- Add unified assetCache module with session-wide promise caching
- Add preloadMessageAssets orchestrator for parallel asset resolution
- Cache fileExists HEAD requests so missing files aren't re-probed
- Preload all SFX (emote, shout, realization, stab) alongside sprites
- Use synchronous setEmoteFromUrl at all render transition points
- Graceful fallback to legacy setEmote if preloading times out
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'webAO/viewport/interfaces/PreloadedAssets.ts')
| -rw-r--r-- | webAO/viewport/interfaces/PreloadedAssets.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/webAO/viewport/interfaces/PreloadedAssets.ts b/webAO/viewport/interfaces/PreloadedAssets.ts new file mode 100644 index 0000000..54d20b8 --- /dev/null +++ b/webAO/viewport/interfaces/PreloadedAssets.ts @@ -0,0 +1,20 @@ +export interface PreloadedAssets { + /** Resolved URL for idle (a) sprite */ + idleUrl: string; + /** Resolved URL for talking (b) sprite */ + talkingUrl: string; + /** Resolved URL for pre-animation sprite (no prefix) */ + preanimUrl: string; + /** Duration of preanim in ms (0 if no preanim) */ + preanimDuration: number; + /** Resolved URL for paired character idle (a) sprite */ + pairIdleUrl: string; + /** Resolved per-character shout SFX URL, or null to use default */ + shoutSfxUrl: string | null; + /** Resolved emote SFX URL, or null if no sound */ + emoteSfxUrl: string | null; + /** Resolved realization (flash) SFX URL */ + realizationSfxUrl: string | null; + /** Resolved stab (screenshake) SFX URL */ + stabSfxUrl: string | null; +} |
