## About The Pull Request
`remove_listener` would fail on logout so instead I figure we could
track the tokens on the mob, rather than the client
Functionally not much is changed - but if you go from ghost to mob it'll
remove the token from the ghost and adds the token to the new mob, so it
should fix the issue
There also doesn't need to be any code in `/mob/destroy` because we
listen for `listener_deleted` and remove listeners on the token itself
🆑
fix: Fixes a hard-del and signal override with sound tokens
/🆑
The comsig issue was basically: both source and listener register for
qdel, but they can be the same thing resulting in a double register.
lame!
the hard-del was caused by me running remove_listener when a client
logged out of a mob...but at that point the client is null...so we cant
clear its sound tokens. boo! not smart!
## About The Pull Request
This PR makes a few changes:
1. It makes audio respect max_range correctly. Due to the way we used
fall-off before, we would often get sounds that ended up going below 3
volume, due to an earlier PR, we made any sound below 3 volume not play.
This meant that if you had a sound wiht a max_range of 17, it would not
even play beyond 15~ range.
This change makes it so there's a min volume of 3 (changeable per
playsound use, but I havnt changed the default anywhere), and falloff
caps at this volume. This makes it so we always play at max_range still.
I reduced default sound range to 15 to compensate for this, which is
roughly what the distance would have been in the old system.
The sound curve now looks like this:
<img width="1322" height="861" alt="image"
src="https://github.com/user-attachments/assets/c11a02e7-877c-4467-bb10-129b3f59188b"
/>
The second change is that instead of using chebyshev distance, we now
use euclidean distance to determine the volume of sound.
The reason for this is that chebyshev distance does not respect
diagonals, which means a lot of tiles are treated as the same distance
which makes them sound the exact same too.
<img width="800" height="600" alt="image"
src="https://github.com/user-attachments/assets/b5e40f12-619a-42ad-94fb-85e7fef58adb"
/>
With Euclidean distance, we use the literal distance for diagonals,
which results in much more accurate falloff, and means you notice
falloff much better when walking past something
<img width="252" height="251" alt="image"
src="https://github.com/user-attachments/assets/a9bd5255-9207-4775-b3fb-1b8ca8a63bd3"
/>
BEFORE:
https://github.com/user-attachments/assets/1c327557-283c-49fc-9231-8425a29f7a83
AFTER:
https://github.com/user-attachments/assets/e7f88409-c2fc-4ba8-8dd9-3e23b2eec5c2
## Why It's Good For The Game
makes falloff more accurate to your position, which to me sounds better.
also it makes max_range actually do what it says; be the range at which
you can hear the sound.
## Changelog
🆑 CabinetOnFire
sound: Sound now makes use of euclidean distance for falloff
code: max_range on playsound now ensures the sound is audible up to that
range.
/🆑
## About The Pull Request
This pull request implements sound tokens, based on the implementation
by Kapu at https://github.com/DaedalusDock/daedalusdock/pull/1379
I've taken that implementation and extended it to looping_sounds,
allowing us to have spatial audio that updates much more nicely when
players walk closer. This system also lets players that walk into range
after the sound has started playing to also hear the sound, before if
you missed the sound, you would never hear it. This is particularly
noticeable with long sounds (Which is lame!)
**VIDEOS**:
griddle:
https://streamable.com/v7ayqm
engineering / SM:
https://streamable.com/5lr1oj
The system essentially sends the sound to every client, and changes the
volume based on distance to the sound. There are some performance
concerns here, so we will need to testmerge this and see how impactful
it is. It is in a subsystem though, so there is some limit to the amount
of cpu it will use. Do keep this in mind when watching the videos; it
will probably not be AS responsive as in there.
I've also changed how intense our fall-off is, making sounds lose their
volume slower. Before taking one step away from a 50 volume sound would
make it 18 volume, this is way too big of a drop and it became
particularly jarring with the changes in this PR.
Some sounds might be too long range now, but I think we should just
reduce the max range of those sounds as we were basically playing them
at <5 volume after 10 tiles, at which point we should maybe just reduce
the range a bit since at those volumes theyre really not audible.
**OLD FALLOFF;** note the MASSIVE drop from 1 tile to 2 tiles
<img width="1416" height="897" alt="image"
src="https://github.com/user-attachments/assets/805b270e-6aa5-4e84-868e-39585966f0a4"
/>
**NEW FALLOFF:**
<img width="1418" height="905" alt="image"
src="https://github.com/user-attachments/assets/eabbd592-ae9c-4690-8945-fbd0b4f6614f"
/>
Also tweaked a few looping sounds (deep-fryer in particular got some
clean-up, as its mid-length was way too short for the sounds and it had
a double-definition)
## Why It's Good For The Game
This system allows us to have a richer audio experience, I really don't
like how choppy our looping sounds are, especially in some areas where
you hear them a lot (kitchen and engineering)
## Changelog
🆑 CabinetOnFire, Kapu
sound: Changed our falloff to be less intense, as it was punching volume
down way too fast.
refactor: Implements a system for spatial audio to improve our looping
sounds
/🆑
---------
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>