So I was wondering. I'd like to make ambiances in my game, such as perhaps room ambiances or rivers, that were positional while one was on the outside of them, but acted as a normal room ambiance once the player was within its boundaries. I.E, a river, perhaps like the one in STW, where you walk beside it and it is positioned and does not fall behind until you're passed it.
I asked camlorn about this very thing 2 days ago. The short answer: You can't, not without a lot of code positioning sources around the player when inside a defined boarder, and even that wouldn't achieve what your going for.
However, a day later he posted a tweet saying he now understands how to do volumetric sources, so here's hoping it's important enough to get included when he gets some free time.
In the mean time, I'm putting this particular thing on hold in my game and moving on without it; I can add it later if / when it gets added, and it was slowing me down trying to think up algorithms to do this realistically in my code.
Just because I set it aside for the moment of course doesn't mean you have to, and if you find a way to do this I'd appreciate the code or a write-up of how you achieved it.
I don't know if this will work, but maby you should download some of mason's python games like that opensource scroling battles.
It uses sound_positioning like bgt does.
I think you can position sound_1d using one of that libraries.
You can, but that's also a very simple matter. Most things side scroller are. If I were doing this as a side scroller, I would probably have the source not pan while a player was over it. But this is 3d.
5 (edited by roelvdwal 2017-03-30 19:29:53)
O, asked on the libaudioverse mailing list before I saw blademan's post. Specifically asked for cuboid sources.
Maybe you could change the position of the source when the player position changes? that might also work.
@roelvdwal that is a sort-of solution. You would need to have a virtual boundary for each source, like a 3-dimensional box that it can't leave, and whenever a player comes close it needs to follow them along the edges, and stay literally on top of them when they are inside the defined cube.
The problem with this (at least as I see it) is that this means a lot of custom code. This was one of the ideas I had when trying to think up something that would accomplish what the original poster mentioned.
Though I could do it, and it might (might) add up to what I wanted, it would be more work than I felt like doing.
I don't have a problem with writing a lot of code to do exactly what I want, but I *hate* duplicating code, and if I wrote a solution (even a partial one) for this, it has less of a chance of being implemented in the library itself. Also it's guaranteed to run slower than something written in c++ would.
For now I've updated my game's map editor to allow for size specification of sources. it's not perfect and I can't clearly define boundaries like I want to, but I have larger things to code, and this problem might just solve itself eventually.
Yeah, am also going to wait for this to be implemented. It's not very useful writing code that will be hopefully implemented in a little while anyway, besides, I only know python, and probably don't have best coding practices, so it'd only slow down my sound manager if I would implement it myself.