How high is the performance impact of having sounds inside parts in workspace? I.e. If I have, say, 50 sounds of the same soundId in different parts of workspace, will the performance impact be significant or neglible?
I doubt it would have any serious performance impact - but it also seems like you should be able to test this with relative ease.
for i = 1,50 do
game:GetService("RunService").Heartbeat:Wait()
local p = Instance.new("Part")
p.Parent = workspace
local s = Instance.new("Sound")
s.Parent = p
s.SoundId = "rbxassetid://311824562"
s:Play()
end
I just ran this code and didn’t notice any major impact on performance. My main question is why do you need to run fifty of the same sound at once?
Lots of these:
https://i.gyazo.com/3c33f300709100793641178010b6a136.mp4
Although good point, could just keep spawning sounds until it lags up my computer
I don’t know what would be more practical, but you could probably use some kind of proximity formula to just change the volume of a single sound located inside the Player object.
I don’t know if it’s going to be an issue for you, but I’d never play two sounds of the same ID at the same exact time. For whatever reason, it completely breaks the sound engine whenever you’re within the proximity of both at the same time. This was particularly chaotic when I wanted to make a radio that echoed in a room (using the (effect)soundeffect things), but the radio itself played a version of the sound with no effects on it.
Performance of many sounds playing at once is negligible. As long as you aren’t constantly creating new sounds, you should be fine. If you’re creating lots of sounds in your game, you should make a system that will detect if a sound of the same name is already playing under a parent, and re-use that instead of making a new sound.
Dang, I’d forgotten about that, I actually did run into this issue when I had two waterfalls near each other. Completely broke the sound system.