I need help making a sounds module

How can I make an optimized sounds replication module with no prior knowledge of buffers or how caching works?

I want to be able to replicate a sound request from a client to all other clients. I was hoping if anyone could provide any sort of guidance

I mean I have a pretty simple solution, but it’s probably not that efficient. Use a remoteEvent to fire the server when a sound request is made by the client, then fireAllClients and receive the signal locally to play the sound.

why do you need buffers and caching?

How many sounds are you sending and how much data is in a sound
Also how are you encoding sounds

If its multiple rbxassetid per second then you can probably just use remote events

Would UnreliableRemoteEvents and just sending the raw sound instance across the server be optimized enough? I just thought buffers would be used for performance, but yes there may be a lot of sounds being sent

I was asking whether or not when sending events to the clients to play a sound, Do i need to use buffers to optimize the data being sent at all, like do I need any optimizations to this or no

See my latest reply on the topic please :slightly_smiling_face:

you cant send instances; you have to serialize them

if you send an uncompressed array with assetid (8B), volume (8B), speed (8B) + 40B for overhead + 40B of other stuff then each sound would send 104B. Sending 100 sounds per second would probably need 10.4kB/s which is fine

if you use a buffer then you can get rid of array overhead and use ints instead of 8B floats. It makes the performance slightly slower but reduces network load

I think for this case, network wont really be strained so you should only use unreliable remote events as a last resort if you cant reduce the network enough

If you dont need fully dynamic sounds you can save alot by predefining sounds (or part of sounds, like ID) on the client and then sending just one number to identify the sound