World sounds are local: fade with distance and pan (distant sizzles snapped constantly)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,17 @@ with sync_playwright() as p:
|
||||
pg.wait_for_timeout(500)
|
||||
ev = pg.evaluate
|
||||
ev("window._maxStatus = ''; const _ss = setStatus; setStatus = function (s, k) { if (s && s.length > _maxStatus.length) _maxStatus = s; return _ss(s, k); }; 0")
|
||||
# World effects use the view, and inaudible ones must not throttle nearby sounds.
|
||||
ev("auInit(); window._noiseCalls = 0; window._noiseBurst = noiseBurst; noiseBurst = function (...args) { _noiseCalls++; return _noiseBurst(...args); }; 0")
|
||||
try:
|
||||
far = ev("(() => { const n = _noiseCalls; AU.last.sizzle = 0; const x = R.vx0 + R.bw * 3, y = R.vy0 + R.bh / 2; playSfx('sizzle', 0, x, y); return [_noiseCalls - n, sfxPlace(x, y).gain, AU.last.sizzle]; })()")
|
||||
check('a sound far off-screen is silent', far == [0, 0, 0], far)
|
||||
near = ev("(() => { const n = _noiseCalls; AU.last.sizzle = 0; const x = R.vx0 + R.bw / 2, y = R.vy0 + R.bh / 2; playSfx('sizzle', 0, x, y); return [_noiseCalls - n, sfxPlace(x, y).gain, AU.bus == null]; })()")
|
||||
check('a sound on screen plays', near == [1, 1, True], near)
|
||||
quiet = ev('sfxPlace(R.vx0 + R.bw * 1.5, R.vy0 + R.bh / 2)')
|
||||
check('a sound just off-screen is quieter', 0 < quiet['gain'] < 1 and quiet['pan'] > 0, quiet)
|
||||
finally:
|
||||
ev('noiseBurst = _noiseBurst; delete window._noiseBurst; delete window._noiseCalls; 0')
|
||||
look = sys.argv[2] if len(sys.argv) > 2 else 'pixel'
|
||||
check('a new game starts fully zoomed in', ev('SET.zoom') == 12, ev('SET.zoom'))
|
||||
# Ctrl+W closes the tab; with a world open the browser must ask first
|
||||
|
||||
Reference in New Issue
Block a user