Indoors vs Outdoors Ambience

Hello developers, today I need assistance planning a system.

I’d like to create an ambient sound/weather system, however I don’t know the most efficient way to accomplish this goal. I was thinking of having nodes that are checked for magnitude every so often by the player, and will play the appropriate ambient sounds attached to those nodes when inside the radius. This gets super complex and difficult though when a player is in a town, where buildings are rectangular instead of spherical or circular.

The drawing above is just an example of a situation. In my ideal system, when a player is outdoors they would see rain and hear the local environment’s effects when it rains. In an exterior (a porch for example), they would see rain only outside of the porch area, and not coming through the roof. When in an interior, they would hear muffled rain effects, and rain could still be seen through windows. When in a deep interior (a cave for example), they would hear that environment’s effects, like water dripping or a howling wind, with no rain sounds or particles.

How would you accomplish this? Sound nodes? Parts that fill every area perfectly and check if you’re inside one? Some complex system of raycasts? Something entirely different?

I appreciate any kind of response!

5 Likes

Regions 3 would be the way to go in my opinion. Just set the regions up in your desired areas and play sounds/show rain accordingly

2 Likes

How would you go about organizing these? Intangible parts filling those spaces?

Also, how would one accomplish things like rain particles falling outside of a porch area, but not inside? If possible, I’d like to also have it so rain doesn’t fall inside of the house, so you wouldn’t see particles falling inside the home through the door if you’re on the porch

2 Likes

Yah I’d just have a bunch of colored bricks that you can have to represent those spaces and turn them into region3’s on start up.

As for particles @As8D made a very cool open sourced particle collision system which you would use to prevent going through parts. But I don’t see you using this without a crap ton of lag.

Unfortunately on Roblox, effects like rain are very difficult to generalize with a “Weather System” it’s a heck of a lot easier just to make custom rain per place, sculpting the parts and emitter lengths around the buildings.

2 Likes

For the Egg Hunt I had a plugin that allowed the builders to place down spherical / box zones and attach lighting settings / music to them. Anything that wasn’t part of a zone was the default zone, which could also have properties. Then there was a system that would check where the player was and tween towards the settings of the right zone.

In the rain effect that I’m pretty close to open-sourcing, it actually does volume attenuating depending on how close you are to spots exposed to the sky. I raycast upwards in a grid centered at the camera, and use that to determine how deep a player is inside a structure.

9 Likes

That sounds like a really cool plugin.

1 Like

Raycasting should help with this - make each rain particle raycast downwards, then set it’s end to where it hits.

Additionally you can externalise this so you can also detect when a player is inside a building where they will hear faded out rain or whatever.

(If you want to optimise it long term, you could do all the raycasting when the client loads and then just access the results from that later.)

1 Like

Wouldn’t raycasting for each particle be extremely laggy?

Raycasting isn’t very expensive, I believe I got about a thousand rain particles working like this a while ago with good performance when I first tested using trails for rain.

That’s awesome! Let’s say you have a map with around 150k to 300k parts though, thinking performance would still be good? Also how did you make them move? Did you cframe them and use some sort of algorithm to make sure they would be where they’re supposed to regardless of FPS?

What I did was:

  • Make a template set of attachments and a trail object for a rain particle
  • Copy them and put them into Terrain
  • Set attachment properties in the trail object
  • Position the attachments to the start point with say, 0.05 studs in between them
  • Tween the attachments down to where the raycast gave
  • Wait until they finish then delete them

I think it would be best if you would make it so they only render in a certain distance from the player’s character (or camera).

1 Like

This works great! I’m not sure if it’ll perform well under stress yet, but it’s working very nicely.

1 Like