Efficient sound design

Instead of storing sounds in my game as instances I heard that it was better to store them as values in tables. For example:

return {
	["GunShotSound"] = {
		id = "rbxassetid://132312",
		preloaded = false
	}
}

The idea is to dynamically create the Sound objects in code when needed. This seems cleaner and easier to manage, especially with named categories like UI sounds, gun sounds, ambient loops, etc.

My question is If I’m going to have a TON of sounds — like hundreds — wouldn’t this approach:

  • Take longer to preload?
  • Use more memory?
  • Make debugging trickier?

Thanks

This seems like a good approach but you’ll need to handle preloading and cleanup properly. The memory usage should actually be lower because the sounds are only created when needed. But the problems are that you’ll have to preload manually and it will probably be harder to debug.