I was wondering how I could apply sound to a large area? Currently, I only know how to do apply sound to my game using nodes, but nodes are 1 point in space. If I wanted to apply sound to a river, for example how would I a) find the coordinates for the entire river path and b) create a more “stretched” sound area? Thanks
Just add a sound node that is as far away from you as the river I would say. The nearer you are to that river the closer your river sound node should be.
I learned that game development is much about fake
I don’t know whether it’s possible, but you could add some invisible bounding boxes (from a cube for example) and then check whether the player is inside the bounding box and relative to the distance to the center which is your river the sound plays with a higher or lower volume. Depending on how your river path looks like you might have to add several bounding boxes. Maybe you even can create them in code.
But wouldn’t that create uneven sounds across the river? Also, what if the river were, say, in the middle of the map? Maybe a directional sound node that plays in the direction of the river path?
Just move it along the spline itself, at the point (of the spline) that is closest to the player (each frame). That way the sound will always come from the direction of the river and the distance resolves itself automatically.
You could even make the points of the spline have metadata as to what sound to use to have more dynamic (?) parts of the river have different sounds that blend from one to another along the spline.
I’ll be needing something like that too for laser beams Even though it might be more realistic to only have the laser source make noise, it’s much cooler to hear the whole beam buzzing.
You could extend that idea with the splines and take the minimum distance to a set of splines. distance = min(distSpline1, distSpline2)
That would allow for more irregularly shaped areas:
Distance functions could be used to make this work with arbitrary, combined shapes in 3D. I’ll just leave that here for now:
Even though the fundamentals of distance functions / distance fields are not as complicated as it might look, i can image that implementing such a sound system can get complex very quick. And it might be complete overkill because:
The nice thing about signed distance functions is that you can trivially detect if you’re inside a shape. So you would know when you’re “inside” the river and then you can for example play the sound at full volume for all channels (sound node position = cam position).