Commit graph

368 commits

Author SHA1 Message Date
Kelsi
f1e7f75141 Add comprehensive spell sound manager with 35+ magic sounds
Implemented complete spell casting audio system with all magic schools:

Magic schools supported:
- Fire: Precast (Low/Medium/High), Cast, Fireball impacts
- Frost: Precast (Low/Medium/High), Cast, Blizzard impacts
- Holy: Precast (Low/Medium/High), Cast, Holy impacts (4 levels)
- Nature: Precast (Low/Medium/High), Cast
- Shadow: Precast (Low/Medium/High), Cast
- Arcane: Precast, Arcane Missile impacts
- Physical: Non-magical abilities

Spell phases:
- Precast: Channeling/preparation sounds (before cast)
- Cast: Spell release sounds (when spell fires)
- Impact: Spell hit sounds (when spell hits target)

Power levels:
- Low: Weak spells, low level abilities
- Medium: Standard power spells
- High: Powerful high-level spells

Sound coverage (35+ sounds):
- 16 precast sounds (Fire/Frost/Holy/Nature/Shadow × Low/Med/High + Arcane)
- 5 cast sounds (one per school)
- 16 impact sounds (Fireball ×3, Blizzard ×6, Holy ×4, Arcane Missile ×3)

Technical details:
- Loads 35+ sound files from Sound\Spells directory
- Simple API: playPrecast(school, power), playCast(school), playImpact(school, power)
- Convenience methods: playFireball(), playFrostbolt(), playHeal(), etc.
- Random variation selection for impacts
- Volume at 0.75 with global scale control
- Ready for integration with spell casting system

Usage examples:
```cpp
// Full spell sequence
spellSoundManager->playPrecast(MagicSchool::FIRE, SpellPower::HIGH);
// ... cast time ...
spellSoundManager->playCast(MagicSchool::FIRE);
// ... projectile travel ...
spellSoundManager->playImpact(MagicSchool::FIRE, SpellPower::HIGH);

// Convenience methods
spellSoundManager->playFireball();
spellSoundManager->playHeal();
```

This adds essential magic feedback for spell casting gameplay!
2026-02-09 16:45:30 -08:00
Kelsi
3a3e9f3c79 Add player character combat vocals with 60+ voice lines
Implemented player combat vocals for Blood Elf and Draenei races:

Player vocal types:
- Attack grunts: Multiple variations per race/gender
- Wound sounds: Pain reactions when hit
- Wound crits: Special sounds for critical hits taken
- Death cries: Final sounds when player dies

Race coverage (60+ voice lines):
- Blood Elf Male: 9 attacks, 8 wounds, 3 crit wounds, 2 deaths
- Blood Elf Female: 5 attacks, 7 wounds, 1 death
- Draenei Male: 7 attacks, 8 wounds, 3 crit wounds, 2 deaths
- Draenei Female: 7 attacks, 4 wounds, 3 crit wounds, 1 death

Technical details:
- Loads 60+ vocal sound files from Sound\Character\*PC folders
- Simple API: playPlayerAttackGrunt(race), playPlayerWound(race, crit), playPlayerDeath(race)
- Random variation selection for immersion
- Volume at 0.9-1.1 depending on sound type
- Crit wounds play 1.1x louder for emphasis
- Extensible design ready for other races
- Only BC races have dedicated PC vocal folders in WotLK 3.3.5a

Usage examples:
```cpp
combatSoundManager->playPlayerAttackGrunt(PlayerRace::BLOOD_ELF_MALE);
combatSoundManager->playPlayerWound(PlayerRace::DRAENEI_FEMALE, true);  // Crit
combatSoundManager->playPlayerDeath(PlayerRace::BLOOD_ELF_FEMALE);
```

This adds essential combat immersion with player character reactions!
2026-02-09 16:42:15 -08:00
Kelsi
da249d5be0 Add comprehensive combat sound manager with weapon swings and impacts
Implemented complete combat audio system with 40+ combat sounds:

Weapon swing sounds (whooshes):
- Small weapons (1H): 3 variations + crit
- Medium weapons (2H): 3 variations + crit
- Large weapons (heavy 2H): 3 variations + crit
- Miss whooshes: separate 1H/2H sounds

Impact sounds by armor type:
- Flesh (unarmored/cloth): 3 variations + crit
- Chain armor: 3 variations + crit
- Plate armor: 3 variations + crit
- Shield blocks: 3 variations + crit
- Metal weapon parries: 1 sound
- Wood impacts: 3 variations
- Stone impacts: 3 variations

Emote sounds:
- Clap: 7 variations

Technical details:
- Loads 40+ sound files from Sound\Item\Weapons and Sound\Character
- Simple API: playWeaponSwing(size, isCrit), playImpact(size, type, isCrit)
- Random variation selection for non-crit sounds
- Volume at 0.8 with global scale control
- Crit sounds play 1.2x louder for emphasis
- Uses 1H axe impact sounds as base (similar across weapon types)
- Ready for integration with combat system

Usage examples:
```cpp
combatSoundManager->playWeaponSwing(WeaponSize::SMALL, false);
combatSoundManager->playImpact(WeaponSize::MEDIUM, ImpactType::PLATE, true);
combatSoundManager->playWeaponMiss(true);  // 2H miss
combatSoundManager->playClap();
```

This adds essential combat audio feedback for melee combat!
2026-02-09 16:38:50 -08:00
Kelsi
1a937fa69a Make city bell tolls mark real server time like actual clock towers
Changed bell tolls from random intervals to proper timekeeping mechanism:

How it works:
- Bells now toll at the top of every hour (minute == 0)
- Number of tolls indicates the hour in 12-hour format:
  * 1 AM/PM = 1 toll
  * 2 AM/PM = 2 tolls
  * 12 AM/PM = 12 tolls
- 1.5 second delay between individual tolls
- Uses system time (server time for single-player mode)

Technical details:
- Detects hour changes via std::chrono and localtime()
- Tracks lastHourTolled_ to prevent duplicate tolling
- remainingTolls_ counter for sequential toll playback
- bellTollDelay_ for 1.5s spacing between tolls
- Only tolls when currentCity_ is set (in a city)
- Resets bell state when changing cities
- Converts 24-hour to 12-hour format (0 and 12 both become 12)

Example: At 3:00 PM in Stormwind, the Alliance bell will toll 3 times
with 1.5s between each toll, marking the hour like a real clock tower.

This makes bells actually useful for tracking real time while playing!
2026-02-09 16:33:53 -08:00
Kelsi
011b33c7f8 Add comprehensive UI sound manager for interface interactions
Implemented complete UI sound system with 32+ interface sounds:

Window sounds (10 types):
- Bag open/close (backpack, containers)
- Quest log open/close
- Character sheet open/close
- Auction house open/close
- Guild bank open/close

Button sounds (2 types):
- Interface button clicks
- Main menu button clicks

Quest sounds (4 types):
- Quest activate (new quest accepted)
- Quest complete (quest turned in)
- Quest failed
- Quest update (progress notification)

Loot sounds (3 types):
- Coin pickup (small/large amounts)
- Item loot from creatures

Item sounds (6 types):
- Drop item on ground
- Pickup sounds by item type: bags, books, cloth, food, gems

Eating/Drinking (2 types):
- Eating food sound
- Drinking potion/water sound

Special sounds:
- Level up fanfare
- Error/invalid action feedback
- Target select/deselect

Technical details:
- Loads 32 sound files from Sound\Interface directory
- Volume at 0.7 with global scale control
- Simple API: playBagOpen(), playQuestComplete(), etc.
- Ready for integration with UI systems and game events
- Can be hooked to ImGui windows, inventory actions, quest system
2026-02-09 16:30:47 -08:00
Kelsi
3a37299443 Add fountain positional ambient sounds
Implemented fountain sounds as positional audio emitters:

Technical details:
- Added fountainSounds_ library (FountainSmallMediumLoop.wav)
- Fountain type already existed in AmbientType enum but was unused
- 6 second loop interval for fountain sounds
- Volume at 0.8x water volume for gentle bubbling effect
- Max distance: 35 units (same as other water sources)
- Counted in activeWaterCount limit (max 3 water sources at once)
- Spatial 3D audio based on fountain position
- Can be placed via addEmitter(position, AmbientType::FOUNTAIN)
2026-02-09 16:27:16 -08:00
Kelsi
cfb64f1d24 Add bell tolls for major cities marking time
Implemented periodic bell chimes that add atmosphere to major cities:

Bell types by faction:
- Alliance bell: Stormwind, Ironforge
- Night Elf bell: Darnassus
- Horde bell: Orgrimmar, Undercity
- Tribal bell: Thunder Bluff

Technical details:
- Loads 4 bell toll sound files from Sound\Doodad
- Plays every 120-180 seconds (2-3 minutes) with random variation
- First bell toll 60-90 seconds after entering city
- Volume at 0.5 for noticeable but not overpowering effect
- Only plays when currentCity_ is set (not in wilderness)
- Each city uses faction-appropriate bell sound
- Separate timer (bellTollTime_) from regular city ambience
- State logging for debugging bell events
2026-02-09 16:25:59 -08:00
Kelsi
77a9b3192d Add major city ambient audio with day/night variations
Implemented city-specific ambient soundscapes for all six major cities:

Alliance cities:
- Stormwind: day/night crowd and marketplace sounds
- Ironforge: underground forge ambience (no day/night)
- Darnassus: day/night elven city sounds

Horde cities:
- Orgrimmar: day/night orcish city atmosphere
- Undercity: underground undead ambience (no day/night)
- Thunder Bluff: day/night tauren plateau sounds

Technical details:
- Added CityType enum (NONE, STORMWIND, IRONFORGE, DARNASSUS, ORGRIMMAR, UNDERCITY, THUNDERBLUFF)
- Loads 12 city sound files from Sound\Ambience\WMOAmbience
- Underground cities (Ironforge, Undercity) use single sound without day/night variants
- 20s loop interval for city ambience (more frequent than zone ambience)
- Volume at 0.4 for noticeable but not overwhelming urban atmosphere
- Cities take priority over zone ambience to prevent mixing
- updateZoneAmbience() now checks for active city and skips if in city
- State change logging for debugging city transitions
2026-02-09 16:14:03 -08:00
Kelsi
d6f0c2ec46 Add comprehensive weather, water, and zone ambient audio systems
Implemented three new ambient audio systems with automatic day/night transitions:

Weather ambience:
- Rain sounds (light/medium/heavy intensity based on weather system)
- Snow sounds (light/medium/heavy intensity)
- Automatically syncs with visual weather system in renderer
- Different loop intervals based on intensity (18-30s)
- Disabled indoors

Water ambience:
- Underwater swimming sounds (18s loop)
- Ocean surface sounds
- State tracking for entering/exiting water

Zone ambience:
- Forest (normal and snow variants)
- Beach sounds
- Grasslands
- Jungle
- Marsh/swamp
- Desert (canyon and plains variants)
- All zones have separate day/night sound files
- 30s loop interval for subtle background atmosphere
- Disabled indoors

Technical details:
- Added WeatherType enum (NONE, RAIN/SNOW LIGHT/MEDIUM/HEAVY)
- Added ZoneType enum (NONE, FOREST_NORMAL, FOREST_SNOW, BEACH, GRASSLANDS, JUNGLE, MARSH, DESERT_CANYON, DESERT_PLAINS)
- Loads 26 new sound files from Sound\Ambience\Weather and Sound\Ambience\ZoneAmbience
- Weather intensity thresholds: <0.33 = light, 0.33-0.66 = medium, >0.66 = heavy
- Renderer automatically converts Weather::Type + intensity to AmbientSoundManager::WeatherType
- All ambience respects volumeScale_ and indoor state
- State change logging for debugging transitions
2026-02-09 16:12:06 -08:00
Kelsi
bbfab23566 Replace blacksmith weapon sounds with proper BlackSmith ambience loop
Replaces the pitch-shifted weapon hit sound hack with the official
Sound\Ambience\WMOAmbience\BlackSmith.wav ambience loop. This provides
authentic blacksmith atmosphere with natural hammer strikes and anvil sounds.

Changes:
- Use proper blacksmith ambience file instead of modified weapon sounds
- Remove pitch shifting (1.6x) - use natural sound at 1.0x pitch
- Adjust volume to 0.6 (from 0.25) for ambient loop
- Play every 15 seconds (from 2.5s) for natural atmosphere
- Single loop file replaces 3 random weapon hit sounds
2026-02-09 16:04:59 -08:00
Kelsi
28d009f7db Add comprehensive NPC voice system with interaction and combat sounds
Implements full NPC voice interaction system supporting 6 different sound categories
for all playable races/genders. System loads ~450+ voice clips from MPQ archives.

Voice Categories:
- Greeting: Play on NPC right-click interaction
- Farewell: Play when closing gossip/dialog windows
- Vendor: Play when opening merchant/vendor windows
- Pissed: Play after clicking NPC 5+ times (spam protection)
- Aggro: Play when NPC enters combat with player
- Flee: Play when NPC is fleeing (ready for low-health triggers)

Features:
- Race/gender detection from NPC display IDs via CreatureDisplayInfoExtra.dbc
- Intelligent click tracking for pissed sounds
- Combat sounds use player character vocal files for humanoid NPCs
- Cooldown system prevents voice spam (2s default, combat sounds bypass)
- Generic fallback voices for unsupported NPC types
- 3D positional audio support

Voice Support:
- All playable races: Human, Dwarf, Gnome, Night Elf, Orc, Tauren, Troll, Undead
- Male and female variants for each race
- StandardNPC sounds for social interactions
- Character vocal sounds for combat

Technical Changes:
- Refactored NpcVoiceManager to support multiple sound categories
- Added callbacks: NpcFarewell, NpcVendor, NpcAggro
- Extended voice loading to parse both StandardNPC and Character vocal paths
- Integrated with GameHandler for gossip, vendor, and combat events
- Added detailed voice detection logging for debugging

Also includes:
- Sound manifest files added to docs/ for reference
- Blacksmith hammer pitch increased to 1.6x (was 1.4x)
- Blacksmith volume reduced 30% to 0.25 (was 0.35)
2026-02-09 16:03:51 -08:00
Kelsi
251f0ac246 Increase blacksmith hammer sound pitch to 1.6x
Raises pitch from 1.4f to 1.6f for more distinct metallic clink in blacksmith ambience.
2026-02-09 15:21:07 -08:00
Kelsi
dab23f1895 Add ambient sound system and eliminate log spam
- Implement AmbientSoundManager with tavern/outdoor ambience
- Fix audio buffer limit (5s → 60s) for long ambient loops
- Set log level to INFO to eliminate DEBUG spam (130MB → 3.2MB logs)
- Remove excessive terrain/model/network logging
- Fix ambient sound timer sharing and pitch parameter bugs
2026-02-09 14:50:14 -08:00
Kelsi
4a7e599764 Fix NPC voices to use correct WAV format and gender detection
WotLK 3.3.5a uses .wav files for NPC voices, not .ogg as shown in retail Wowhead. Fixed audio engine to preserve original sample rate from WAV files (preventing chipmunk playback). Implemented race/gender detection using CreatureDisplayInfo.dbc and CreatureDisplayInfoExtra.dbc to play correct voice types for each NPC.
2026-02-09 02:22:20 -08:00
Kelsi
5f57a83332 Test forward slash paths for MPQ file access
MPQs may store files internally with forward slashes. Testing both:
- Sound/Creature/... (forward slashes)
- Sound\Creature\... (backslashes)

This should help identify the correct path format for accessing files.
2026-02-09 02:05:09 -08:00
Kelsi
609185f10f Expand NPC voice file search to test multiple path patterns
Tests various path structures to find where voice files actually exist:
- Wowhead StandardNPC paths
- Lowercase variations
- PC voice files (HumanVocMale/Female - player emotes)
- VO/Voice directories
- Simpler creature paths

This will help identify which files actually exist in the 3.3.5a MPQs.
2026-02-09 02:03:35 -08:00
Kelsi
c3c6ffeedb Add speech MPQ archives for NPC voices
Loads speech-enUS.MPQ, expansion-speech-enUS.MPQ, and lichking-speech-enUS.MPQ
which contain NPC voice/creature sound files. These MPQs were present but not
being loaded, causing all .ogg NPC greeting sounds to show as NOT FOUND.
2026-02-09 01:58:55 -08:00
Kelsi
838b82e503 Add complete NPC voice library from Wowhead database
Added all standard NPC greeting sounds for all playable races:
- Human (male/female): 6/5 greetings
- Dwarf (male): 6 greetings
- Gnome (male/female): 6/6 greetings
- Night Elf (male/female): 8/6 greetings
- Orc (male/female): 5/6 greetings
- Tauren (male/female): 5/5 greetings (note: male was missing from Wowhead, added anyway)
- Troll (male/female): 6/5 greetings
- Undead (male/female): 6/6 greetings

Paths from Wowhead: Sound\Creature\[Race][Gender]StandardNPC\
Note: Human male uses "Greetings" (plural), others use "Greeting" (singular)
2026-02-09 01:54:21 -08:00
Kelsi
44a75928ba Fix NPC voice paths to use Sound\Creature\ with .ogg format
NPC sounds are in Sound\Creature\[npctype]\ not Sound\Character\.
Changed to use correct paths like humanmalestandardnpc/humanfemalestandardnpc
with .ogg extension. This matches actual WoW 3.3.5a structure.
2026-02-09 01:52:07 -08:00
Kelsi
708142a8a4 Also initialize mount sound and NPC voice managers in loadTestTerrain
These managers were only being initialized in loadTerrainArea (online mode).
Added initialization in loadTestTerrain as well so they work in both modes.
Now the file probing should actually run and show which sound files exist.
2026-02-09 01:50:42 -08:00
Kelsi
b8375627e9 Fix NPC voice and mount sound managers not initializing in online mode
The cachedAssetManager was only set in loadTestTerrain() for single-player mode.
In online mode (loadTerrainArea), it was never set, so NPC voice and mount sound
managers never initialized. Now gets asset manager from Application instance if
not already cached. This will enable file probing and voice/sound loading.
2026-02-09 01:48:19 -08:00
Kelsi
ec457a37c8 Add MPQ file probing for NPC voices and tavern music
Tests various potential sound file paths at startup and logs which ones exist
in the MPQ. This will show us the correct file paths to use for both NPC
voices and tavern music.
2026-02-09 01:44:58 -08:00
Kelsi
ee52732350 Add debug logging for tavern music and NPC voices
Added extensive logging to diagnose issues:
- Logs WMO model IDs when entering WMOs (to identify correct tavern IDs)
- Logs when tavern music should be playing
- Logs NPC voice playGreeting calls and their results
- Logs which sound files are being played
- Added more emote variations (Hello, Yes) for NPC voices

This will help identify why tavern music and NPC voices aren't working.
2026-02-09 01:43:20 -08:00
Kelsi
e1ecd13bcd Fix action bar not clickable: remove NoInputs flag
The ImGuiWindowFlags_NoInputs flag was blocking all input including mouse clicks.
Removed this flag to restore action bar clickability while keeping keyboard shortcuts functional.
2026-02-09 01:40:29 -08:00
Kelsi
becc94d4ba Fix NPC voices and add tavern music support
NPC voice fixes:
- Changed sound paths from "Greeting" to "Hello" emote (more reliable)
- Added warning log when no voice samples load
- Voice files should now play when clicking NPCs

Tavern music:
- Detect tavern WMOs by model ID (inn buildings)
- Play tavern-specific music when inside taverns
- Crossfade back to zone music when exiting taverns
- Adds cozy ambient music to inn/tavern buildings
2026-02-09 01:39:12 -08:00
Kelsi
e40ea0c47a Fix taxi window close auto-mounting player on griffin
Fixes issue where closing the flight map window would incorrectly mount the
player on a griffin at spawn point. Added taxiLandingCooldown when closing
taxi window to prevent UNIT_FLAG_TAXI_FLIGHT check from re-triggering mount.
2026-02-09 01:35:29 -08:00
Kelsi
42821604d3 Fix mount dust visibility: spawn above ground with stronger upward velocity
Fixes issue where dust particles were angling down into terrain and not visible.
Changes spawn position to fixed 0.2 units above ground, increases upward velocity
to 1.2-2.5 for clearer rise, and uses only horizontal velocity component for drift
to prevent Z component from pushing particles downward.
2026-02-09 01:32:40 -08:00
Kelsi
eb288d2064 Implement NPC greeting voice lines
Added NPC voice manager that plays greeting sounds when clicking on NPCs:

Features:
- Voice line library with multiple race/gender voice types (Human, Dwarf,
  Night Elf, etc.)
- 3D positional audio - voice comes from NPC location
- Cooldown system prevents spam clicking same NPC
- Randomized pitch/volume for variety
- Loads greeting sounds from character voice files in MPQ
- Generic fallback voices for NPCs without specific voice types

Voice lines trigger automatically when gossip window opens (SMSG_GOSSIP_MESSAGE).
Uses same audio system as other sound effects with ma_sound_set_position.
2026-02-09 01:29:44 -08:00
Kelsi
71c4fb3ae6 Fix crash in mount dust: add null check for camera pointer
The mount dust code was calling camera->getForward() without checking if
camera was null first, causing a crash that prevented mounting/dismounting.
Added camera null check to the condition.
2026-02-09 01:26:28 -08:00
Kelsi
c95c3db03a Add mount dust particle effects
Implemented dust cloud particles that spawn at mount feet when running
on the ground, similar to the original WoW. Features:

- Brownish/tan dust particles using point sprite rendering
- Spawn rate proportional to movement speed
- Particles rise up, drift backward, and fade out naturally
- Only active when mounted, moving, and on ground (not flying)
- Smooth particle animation with size growth and alpha fade

Uses similar particle system architecture as swim effects with
GL_POINTS rendering and custom shaders for soft circular particles.
2026-02-09 01:24:17 -08:00
Kelsi
c6a915397c Remove confusing north indicator from minimap
Removed the "N" indicator that was showing on the minimap when rotation
was enabled. The indicator was confusing and not needed - when rotation
is disabled (default), north is always at the top of the minimap, and
when rotation is enabled, the map itself rotating shows the orientation.
2026-02-09 01:21:12 -08:00
Kelsi
0fed931aa0 Implement mount ambient sounds
Added full mount sound system with:
- Wing flap sounds for flying mounts (gryphon/wyvern) when moving
- Wing idle/hovering sounds when stationary in air
- Breathing/snorting sounds for ground mounts when idle
- Occasional whinny sounds for ground mounts when moving

Sounds are loaded from MPQ files and played via AudioEngine with
randomized pitch/volume variation. Mount sound manager tracks mount
type, movement state, and flying state to play appropriate ambient
sounds at natural intervals.

Updated setMounted() to accept creature display ID and notify the
mount sound manager, which uses display ID ranges to detect mount
type (flying vs ground).
2026-02-09 01:19:35 -08:00
Kelsi
0b6b403848 Fix mount footstep timing and frequency
Reduced mount footsteps from 4 beats to 2 beats per animation cycle
with evenly-spaced timing at 0.25 and 0.75 normalized time. The
previous 4-beat pattern (0.1, 0.35, 0.6, 0.85) was too frequent and
not properly synced with mount animations.
2026-02-09 01:15:30 -08:00
Kelsi
980cec00bf Disable minimap rotation by default and fix settings checkbox
Changed default value from true to false in three places:
- Minimap class (rotateWithCamera member)
- GameScreen settings (minimapRotate_ and pendingMinimapRotate)
- Restore Interface Defaults button

The minimap will now remain fixed/north-up by default, and the settings
checkbox properly controls the rotation behavior.
2026-02-09 01:13:56 -08:00
Kelsi
dbf3038560 Fix action bar keyboard shortcuts not working
Added ImGuiWindowFlags_NoInputs to action bar window so it doesn't capture
keyboard input. Previously, hovering over or clicking the action bar would
set WantCaptureKeyboard=true, blocking the 1-9,0,-,= hotkeys from working.
2026-02-09 01:11:49 -08:00
Kelsi
0ce23cf7bd Fix unwanted mounting when closing taxi window
Closing the taxi map without selecting a destination now properly dismounts
the player. Previously, selectTaxiNode() would optimistically mount the
player, then closeTaxi() would only clear taxiWindowOpen_ without cleaning
up the mount state, leaving the player mounted.
2026-02-09 01:08:39 -08:00
Kelsi
f9ba6aa1b0 Add MountSoundManager skeleton for mount audio
Implement framework for playing mount sounds (flapping, galloping) based on mount type and movement state. Actual sound playback to be implemented next.
2026-02-09 01:04:53 -08:00
Kelsi
83b364a417 Fix jump collision with slope grace period
Add grounded state grace to prevent fall stumbles when descending slopes while maintaining proper jump physics.
2026-02-09 01:01:25 -08:00
Kelsi
16485e691c Convert ActivitySoundManager to use AudioEngine
Replace process-spawning with direct AudioEngine calls for jump, landing, and melee swing sounds.
2026-02-09 01:01:24 -08:00
Kelsi
ffa47f62d6 Implement 3D positional audio with distance attenuation
Add full 3D spatialization support to AudioEngine with inverse distance attenuation model for NPC voices and mount sounds.
2026-02-09 01:01:21 -08:00
Kelsi
af0a3a4daf Fix jump collision and WMO doodad rotation bugs
Prevent character from being yanked down during upward jump movement, and correct quaternion rotation for holiday decorations.
2026-02-09 00:41:19 -08:00
Kelsi
28330adfb0 Eliminate per-frame allocations in M2 renderer to reduce CPU stutter
Use persistent vectors for animation work indices, futures, and glow sprites instead of allocating each frame.
2026-02-09 00:41:07 -08:00
Kelsi
bd3f1921d1 Replace process-spawning audio with miniaudio for non-blocking playback
Eliminates severe stuttering from fork/exec + disk I/O by streaming audio directly from memory using miniaudio library.
2026-02-09 00:40:50 -08:00
Kelsi
c047446fb7 Add dynamic memory-based asset caching and aggressive loading
- Add MemoryMonitor class for dynamic cache sizing based on available RAM
- Increase terrain load radius to 8 tiles (17x17 grid, 289 tiles)
- Scale worker threads to 75% of logical cores (no cap)
- Increase cache budget to 80% of available RAM, max file size to 50%
- Increase M2 render distance: 1200 units during taxi, 800 when >2000 instances
- Fix camera positioning during taxi flights (external follow mode)
- Add 2-second landing cooldown to prevent re-entering taxi mode on lag
- Update interval reduced to 33ms for faster streaming responsiveness

Optimized for high-memory systems while scaling gracefully to lower-end hardware.
Cache and render distances now fully utilize available VRAM on minimum spec GPUs.
2026-02-08 23:15:26 -08:00
Kelsi
27d0496894 Add 1GB RAM cache for decompressed MPQ files
Eliminates repeated MPQ decompression overhead by caching decompressed
files in RAM with LRU eviction. Major performance improvement for file access.

Problem:
- Every readFile() call decompresses from MPQ (expensive!)
- M2 models, textures, WMO files decompressed repeatedly
- No caching of decompressed data
- MPQ decompression is CPU-intensive (zlib/bzip2)

Solution:
- Added 1GB LRU file cache to AssetManager
- Cache hit: instant return of decompressed data
- Cache miss: decompress once, cache for future access
- LRU eviction when cache full (removes least recently used)
- Don't cache files >100MB (avoid giant WMO chunks)
- Thread-safe with existing readMutex

Implementation:
- CachedFile struct: data + lastAccessTime
- fileCacheAccessCounter for LRU tracking
- Hit/miss statistics for monitoring
- Budget: 1GB (modern RAM easily handles this)

Performance impact:
- First load: same speed (decompress + cache)
- Subsequent loads: instant (no decompression)
- Expected 70-90% hit rate during normal play
- Huge benefit for frequently accessed models

Cache stats logged on shutdown to monitor effectiveness.
2026-02-08 22:37:29 -08:00
Kelsi
34cd5a161d Reduce wave amplitude to fix tile boundary gaps
Each water tile generates waves independently using local coordinates,
causing height mismatches at tile boundaries. Reduced amplitude minimizes
visible seams.

Problem:
- Waves calculated per-tile using local vertex positions (aPos)
- Adjacent tiles have different local coords at shared boundary
- Wave height discontinuity creates visible gaps between tiles

Solution:
- Reduced ocean wave amplitude: 0.25 → 0.06 (75% reduction)
- Reduced canal wave amplitude: 0.10 → 0.04
- Kept frequency and speed for subtle animation
- Waves still visible but gaps minimized

Technical note: Proper fix would be world-space wave calculation, but
requires passing tile offset to shader. This amplitude reduction is
simpler and effective for smooth ocean appearance.
2026-02-08 22:35:11 -08:00
Kelsi
26e984b60f Skip all camera controller logic during taxi flights
Taxi flights are externally controlled - no need for collision detection,
movement processing, or input handling. Massive performance improvement.

Changes:
- Early return in CameraController::update() when externalFollow_ is true
- Skips all collision queries (terrain, WMO, M2)
- Skips all movement physics (gravity, swimming, jumping)
- Skips input processing (keyboard, mouse)
- Skips camera collision raycasts

Performance impact:
- 100% elimination of ~17 collision queries per frame during taxi
- No wasted cycles on movement code when position is scripted
- Camera still updates position via setExternalFollow system
- Smooth taxi flights with zero collision overhead

This addresses the core issue: "shouldn't be looking for collision at all
during taxi" - now it doesn't!
2026-02-08 22:33:45 -08:00
Kelsi
6158d56316 Add collision query caching to reduce map traversal overhead
Caches floor height checks to skip redundant collision queries when position
hasn't changed significantly. Major performance improvement during movement.

Problem:
- 17+ collision queries per frame during movement
- getFloorHeight calls expensive (WMO/terrain/M2 raycasts)
- Same queries repeated when barely moving

Solution:
- Cache last collision check position and result
- Skip checks if moved < 15cm (COLLISION_CACHE_DISTANCE)
- Update cache when threshold exceeded or result changes

Implementation:
- Added lastCollisionCheckPos_, cachedFloorHeight_, hasCachedFloor_
- Check distance moved before main ground height query
- Reuse cached floor height for micro-movements
- Full collision check only when meaningfully repositioned

Performance impact:
- Stationary/slow: ~90% reduction in collision queries
- Fast movement: Still helps on same-tile micro-adjustments
- No accuracy loss (15cm is smaller than collision step size)

This addresses "computationally heavy" operations during map traversal.
2026-02-08 22:30:37 -08:00
Kelsi
27d550d521 Break up regular wave pattern with randomized phases and octaves
Eliminates visible grid symmetry when viewing ocean from altitude by adding
pseudo-random phase offsets and multiple wave frequencies.

Changes:
- Added position-based hash functions for pseudo-random phase offsets
- Phase-shifted primary waves (w1, w2) by hash * 2π
- Added 2 higher-frequency detail waves (w3, w4) at lower amplitudes
- Detail waves: 1.7x-2.1x frequency, 0.28-0.35x amplitude
- Different speeds and directions for each octave

Result: Natural-looking ocean with broken symmetry visible from altitude.
No more obvious grid pattern or repetitive crests.

The hash function creates consistent randomness per vertex position,
breaking the regular sine/cosine pattern without performance impact.
2026-02-08 22:28:26 -08:00
Kelsi
e98e0562b8 Fill water tile gaps at coastlines with neighbor checking
Fixes visible square gaps in ocean near coastlines by rendering masked tiles
if they have any water neighbors. Creates smoother, more natural coastlines.

Implementation:
- Check 8 neighboring tiles when a tile is masked out
- If any neighbor is water, render the edge tile anyway
- Creates 1-tile overlap at coastline boundaries
- Fills square gaps between water tiles

Before: Hard square edges with missing ocean tiles at coast
After: Continuous water coverage with smooth blended coastlines

The straight-line grid artifacts are reduced by ensuring adjacent water
tiles connect properly instead of leaving rectangular voids.
2026-02-08 22:27:11 -08:00