Skip to content

Sound replacer menu overhaul - #556

Open
TeeMeeFe wants to merge 113 commits into
ACF-Team:devfrom
TeeMeeFe:TMF/Improved_sounds
Open

Sound replacer menu overhaul#556
TeeMeeFe wants to merge 113 commits into
ACF-Team:devfrom
TeeMeeFe:TMF/Improved_sounds

Conversation

@TeeMeeFe

@TeeMeeFe TeeMeeFe commented Feb 13, 2026

Copy link
Copy Markdown

🚨WIP: Overhauls the sound replacer menu to allow some entities to play multiple, interpolated sounds. 🚨WIP

This changes the way how sounds are played, by allowing multiple sounds to play from a single entity.

imagen

For engines this means:

  • You can now dynamically add or remove up to 16(by default, number can be bumped up though) sounds to a single entity, set their pitch, volume, etc; That they'll play at a certain, arbitrary RPM.
  • This also allows to use multiple soundbanks. You can define where they play at (from the engine entity itself or from an exhaust wire entity), how loud they sound when under throttle vs off throttle.
  • The pitch and volume of these sounds are now fully calculated clientside, instead of serverside like it currently is.
  • Clients can now fetch any sound tables when they join the engine's PAS.
  • There's also doppler effect being simulated, not only for any engine entities, but also for any entity that plays adjustable sounds too!

For guns this means:

  • Nothing, since i haven't got to that part... YET. Stay tuned!
  • For future work, this will allow you to play up to three sounds at different stages. One that is looped when firing, two for the start and end of the firing sequence respectively.

I have created a draft for this so others can look and possibly guide me on this, better ways to approach any problems that will arise, etc.

Ideally i would go on and allow web sounds to be played, since this relies on the client having the sounds at disposition to be played in their respective machines, which is possible some other clients may not have.

EDIT: Now this PR is ready to be reviewed by the devs. I'll keep an eye for any issues, since i haven't been able to extensively test these changes. I will also keep it up-to-date with dev, and if there's a big upcoming patch, that too! Just hit me up when about its to merge those changes into dev!

Partially fixes #553

…oming to do something in this god's forsaken addon
- Done using a very naive approach that consumes a lot of resources for no reason
- Still delegates some calculations to the server to do them
- Some things broken, such as single sound entities
- Fallback to single sound is broken
- I hate the state of this, rewrite coming soon enough!

WIP
… have engine registration to work with the sound table
- Move sound counting to its own local function
- Throttle is now networked properly
- Fix DoPitchVolumeAtRPM function to use pitch and width properly
- Some other changes to documentation
…ing correctly, added a sound path validation icon
…und creation, include the volume on pitchvolume mixing instead of just fallback
TeeMeeFe added 21 commits June 28, 2026 21:43
* Add functionality to the soundgraph sound preview. You can now preview interpolated sounds.
* Fix adding/removing soundbanks messing up soundgraph combobox choice names.
* Add MARK's for VSCode.
* Init.lua now only networks Throttle/RPM.
* Client can now request soundtable data from the server if needed. This is specially useful if the client had just joined the PAS of our engine after its been Active.
* Optimize ENT:UpdateOutputs(SelfTbl). Seems to be slightly faster now.

These changes need more testing though.
* Init.lua now only networks Throttle/RPM.
* Client can now request soundtable data from the server if needed. This is specially useful if the client had just joined the PAS of our engine after its been Active.
* Optimize ENT:UpdateOutputs(SelfTbl). Seems to be slightly faster now.

These changes need more testing though.
…rmance impact. Fix a goober of mine with the soundcount
… convert to the new table format. No path/muted engines are still bugged though
* Change some hardcoded values so they match correctly with the global value.
* Add notification feedback when replacing/resetting entity sounds.
* Fix engine overlay not updating when resetting its sounds.
@TeeMeeFe
TeeMeeFe marked this pull request as ready for review July 29, 2026 23:02
@TeeMeeFe

Copy link
Copy Markdown
Author

Changelog

+ Completely overhauled the sound replacer tool menu. Now with many potential options for players to choose according to the type of acf entity they want to replace their sounds.
+ Added sound bank support for acf_engine entities. Old engines are **NOT** impacted by this change and should continue to function as usual.
+ Added several acf globals. `SpeedOfSound, MaxSounds, MaxSoundBanks, NetSoundRPMBitLimit`.
+ Added a global function `GetHighestPowerOfTwo(Num)` to get the highest binary value as number that fits the number passed as parameter.
+ Added doppler effect support for entities that use `Sounds.UpdateAdjustableSound`. Should **NOT** break any other entities that use that but aren't `acf_engine` class entities.
+ Added several network strings: 
+ (ACF_Sounds_Adjustable_Multi, ACF_Sounds_AdjustableCreate_Multi, ACF_Sounds_AdjustableRequest_Multi); relate to sound table networking;
+ (ACF_SoundMenu_Send_ID, ACF_SoundMenu_Get_Multi, ACF_SoundMenu_Set_Multi); relate to sound menu data networking;
+ Added Exhaust wire output to `acf_engine` to play exhaust sounds to any wired entities, only if the entity's sound table allows for this.
+ Added player notifications when attempting to replace/reset supported entity sounds. 
+ Added 2 new overlay labels to engines. They show the amount of sound banks and total amount of sounds played by the engine.
* Overhauled `acfsound.lua` tool code to accomodate this patch's upcoming changes.
* Changed `tool_support_sh.lua` `acf_engine` support to work with soundbanks instead.
* Changed `ACF.Year` global to be the current year in development, with a comment explaining why. 
* Changed clientside sound creation/deletion to work with tables instead. Old single sound entities should **NOT** be affected by this change.
* Documented """armour""" code existence in `init.lua`. (🤮 🤮 🤮)
- Removed serverside `DoPitchVolume` function at `init.lua`, as it's no longer needed. Sound pitch/volume calcs are now exclusively clientside.

A few caveats from this PR:

  • Single sound engines should still work just as before, but its likely that they might sound different. This is due to the fact that their single sound is now being interpolated (or rather not, but they pass through the function that interpolates with multiple other), with their RPM being at the average between idle and redline.
  • Width (also known as additional curve width, from the author who made the starfall code) existence is because i consider it to fit a niche use i've yet to discover, but it's considered bad math by the author of the sound interpolation chip i used to code this PR. (Props to @mgcheezus)
  • A few other oddities i forgot to document here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants