Mumble NS2 Positional Audio Plugin

HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
edited December 2012 in Modding
<div class="IPBDescription">>hear< where are your mates</div><div align='center'><!--coloro:#ADD8E6--><span style="color:#ADD8E6"><!--/coloro--><!--sizeo:4--><span style="font-size:14pt;line-height:100%"><!--/sizeo-->Mumble Natural Selection 2 Positional Audio Plugin<!--sizec--></span><!--/sizec-->
<!--sizeo:2--><span style="font-size:10pt;line-height:100%"><!--/sizeo-->by Hackepeter<!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc--></div>
Hey NS2 community!
The famous open source voice group chat application <a href="http://mumble.sourceforge.net" target="_blank">Mumble</a> has an awesome feature called Positional Audio:
<div align='center'>
"Positional Audio is a feature of Mumble that places the people talking to you in a certain position relative to your own depending on their actual position in the game you are playing. This way you can hear the person like his actual avatar in-game would be talking to you."

<img src="http://mumble.sourceforge.net/w/images/c/c3/Positional_Audio.gif" border="0" class="linked-image" />
(<a href="http://mumble.sourceforge.net/Positional-Audio" target="_blank">source</a>)
</div>
No surprise that Mumble currently doesn't support Natural Selection 2 in it's beta phase.
BUT to change that I made a plugin for NS2 so that you can use the Positional Audio feature if you like it!

I provide two installation possibilities. You can either install it as a mod or install it directly into NS2 when you already using a mod.

<!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->Please read the <b>README.txt</b> for detailed installation instructions and further information about the plugin.<!--sizec--></span><!--/sizec-->

Enjoy! Any feedback is much appreciated :)

Thanks to my testers ale, Gh0ti, Koruyo and Zeikko!
---------------------------------------------------

<!--sizeo:4--><span style="font-size:14pt;line-height:100%"><!--/sizeo--><!--coloro:#FF0000--><span style="color:#FF0000"><!--/coloro-->
This plugin does not work with the current version of NS2. I'm very sorry! Please read this post:<!--colorc--></span><!--/colorc--><!--sizec--></span><!--/sizec--> <a href="http://www.unknownworlds.com/ns2/forums/index.php?s=&showtopic=114904&view=findpost&p=2052024" target="_blank">http://www.unknownworlds.com/ns2/forums/in...t&p=2052024</a>

Version: 1.2
Date: 2012-03-20

<strike><a href="http://goo.gl/E3TuS" target="_blank"><!--sizeo:4--><span style="font-size:14pt;line-height:100%"><!--/sizeo-->DOWNLOAD<!--sizec--></span><!--/sizec--></a></strike>

<b>Changelog:</b>
<ul><li> updated code to work with Build 200</li></ul>
«1

Comments

  • CandideCandide Join Date: 2011-06-28 Member: 106766Members
    It's amazing!
    How does it work? I mean technically.
  • KoruyoKoruyo AUT Join Date: 2009-06-06 Member: 67724Members, Reinforced - Shadow
    edited September 2011
    <a href="http://mumble.sourceforge.net/Positional-Audio" target="_blank">http://mumble.sourceforge.net/Positional-Audio</a>
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    <!--quoteo(post=1874052:date=Sep 10 2011, 03:45 PM:name=Candide)--><div class='quotetop'>QUOTE (Candide @ Sep 10 2011, 03:45 PM) <a href="index.php?act=findpost&pid=1874052"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->It's amazing!
    How does it work? I mean technically.<!--QuoteEnd--></div><!--QuoteEEnd-->

    You mean how I programmed it?

    If the DLL gets loaded by Lua I get access to the whole Lua Client VM and can extract the local players position (and camera position). Those values are transported to a shared memory which Mumble provides for Positional Audio data. Mumble will then send this data to your current Mumble Server to forward it to the other Mumble users in your current channel. You also get the player positions of the other users over that way and if you are in the same context (I defined the context as server ip:port and teamnumber) the Positional Audio gets activated. The rest is some math to calculate the volume for each speaker according to the relative player positions and so on.

    The Positional Audio data is updated on every client tick, but it's almost just a bit memory copying of a few bytes, it don't affects the game performance!
  • SkymanderXSkymanderX Green Marine - The Few, The Proud, The Green. Join Date: 2011-07-29 Member: 113006Members
    really nice contribution!
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    <!--quoteo(post=1875987:date=Sep 21 2011, 02:05 AM:name=SkymanderX)--><div class='quotetop'>QUOTE (SkymanderX @ Sep 21 2011, 02:05 AM) <a href="index.php?act=findpost&pid=1875987"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->really nice contribution!<!--QuoteEnd--></div><!--QuoteEEnd-->
    Thank you!

    <!--coloro:#4169E1--><span style="color:#4169E1"><!--/coloro--><!--sizeo:3--><span style="font-size:12pt;line-height:100%"><!--/sizeo-->New update arrived today! Version 1.1:<!--sizec--></span><!--/sizec--><!--colorc--></span><!--/colorc-->

    Bug fix: Positional Audio was not correctly differentiating between teams, it turns out the context string doesn't like space characters. A new context definition fixes that but makes the plugin incompatible to version 1.0.

    <b>New feature:</b>

    Positional Audio is now working one-way for commanding or being dead. That means if you are a commander you can hear your players on ground with Positional Audio (you can hear from where someone is calling you) but the players on ground hear the commander without Positional Audio because that would be kinda irritating. The same if you are dead, if you following somebody as a dead spectator you can still hear the Positional Audio of them but if you are speaking as a dead player the others hear you without Positional Audio. Furthermore, when they will implement first person view for spectating you will hear exactly the same Positional Audio as the guy that you are following :)

    Enjoy!
  • HeadClotHeadClot Utah Join Date: 2009-12-20 Member: 69724Members
    Hey, Quick Question - Would it be ok if I used this in a Mod that I am making for NS2?
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    <!--quoteo(post=1876590:date=Sep 23 2011, 09:54 PM:name=HeadClot)--><div class='quotetop'>QUOTE (HeadClot @ Sep 23 2011, 09:54 PM) <a href="index.php?act=findpost&pid=1876590"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Hey, Quick Question - Would it be ok if I used this in a Mod that I am making for NS2?<!--QuoteEnd--></div><!--QuoteEEnd-->

    Sure! Please use it and forward the feedback about the Plugin back to me. Would like to hear about your mod so keep me informed! :)
  • HeadClotHeadClot Utah Join Date: 2009-12-20 Member: 69724Members
    <!--quoteo(post=1876597:date=Sep 23 2011, 02:35 PM:name=Hackepeter)--><div class='quotetop'>QUOTE (Hackepeter @ Sep 23 2011, 02:35 PM) <a href="index.php?act=findpost&pid=1876597"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Sure! Please use it and forward the feedback about the Plugin back to me. Would like to hear about your mod so keep me informed! :)<!--QuoteEnd--></div><!--QuoteEEnd-->

    The post is up for Space Station 13

    Feel Free to look over it :)

    <a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=115015" target="_blank">http://www.unknownworlds.com/ns2/forums/in...howtopic=115015</a>
  • Ender_74Ender_74 Join Date: 2011-01-28 Member: 79329Members
    Is this adjustable ?
    I'm a huge fan of Ender's game (the book from Orson Scott Card, if you haven't read it yet, man you are really missing out, but I think my nick is obvious enough).

    ...

    Even though at this stage I'll take for granted that you have read it I'll explain my though.
    In this book, they are all playing in front of a simulator and are using microphones. The position of their head determine who will hear them. For instance, when they want to talk to their commander they need raise their face, or lower it when they want to talk to their squad. That would be cool but is not really feasible just yet.
    However, being able to set the different position of sounds for your team mates would be awesome. Hearing a voice coming from above you when it's the commander, so you can easily know that it's him/her. When you are in combat it's sometimes hard to know who talked. And when you hear "Incoming two skulks !!", but it's not directed to you it's disorientating.

    Would it be possible to set different positions for everyone, or for groups of players ? (Comm, squad, close to you, others)
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    <!--quoteo(post=1880319:date=Oct 17 2011, 07:45 PM:name=Ender_74)--><div class='quotetop'>QUOTE (Ender_74 @ Oct 17 2011, 07:45 PM) <a href="index.php?act=findpost&pid=1880319"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I'm a huge fan of Ender's game (the book from Orson Scott Card, if you haven't read it yet, man you are really missing out, but I think my nick is obvious enough).<!--QuoteEnd--></div><!--QuoteEEnd-->
    Unfortunately I didn't read Ender's Game but it has amazing good ratings and is also available in my local library, maybe I should give it a try ;)
    <!--quoteo(post=1880319:date=Oct 17 2011, 07:45 PM:name=Ender_74)--><div class='quotetop'>QUOTE (Ender_74 @ Oct 17 2011, 07:45 PM) <a href="index.php?act=findpost&pid=1880319"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->In this book, they are all playing in front of a simulator and are using microphones. The position of their head determine who will hear them. For instance, when they want to talk to their commander they need raise their face, or lower it when they want to talk to their squad. That would be cool but is not really feasible just yet. However, being able to set the different position of sounds for your team mates would be awesome. Hearing a voice coming from above you when it's the commander, so you can easily know that it's him/her.
    [...]
    Would it be possible to set different positions for everyone, or for groups of players ? (Comm, squad, close to you, others)<!--QuoteEnd--></div><!--QuoteEEnd-->
    It is not possible to provide different players with different positions of each other.
    I can just send the local players position to Mumble and all distribution decisions are handled by the Mumble server.
    It would be possible to limit Positional Audio to squads but I'am not sure if it would be annoying to have it turn on and off multiple times if you enter/leave a squad and at least aliens don't have squads imho.
    To the Commander point, I tried that already through pushing the commanders position to the players so they hear the commander "above" them. It is working BUT the commander is moving so fast and so many time over the whole map so you just hearing him swapping between left and right speaker etc. it is just irritating and confusing and if you have him exactly over your head it sounds of course just like without Positional Audio.
    Currently I implemented the Positional Audio for the Commander unidirectional in that way that the Commander hears his players depending on there position (normal Positional Audio) but the players hear the Commander always "global" (without Positional Audio). I think that approach is the more natural to everyone.
    <!--quoteo(post=1880319:date=Oct 17 2011, 07:45 PM:name=Ender_74)--><div class='quotetop'>QUOTE (Ender_74 @ Oct 17 2011, 07:45 PM) <a href="index.php?act=findpost&pid=1880319"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->When you are in combat it's sometimes hard to know who talked. And when you hear "Incoming two skulks !!", but it's not directed to you it's disorientating.<!--QuoteEnd--></div><!--QuoteEEnd-->
    That is just why I made the plugin and is already working like that :) At least you can hear where he screams for his life :D

    But sure if you wan't to try something different just contact me and as long as it is technical possible I could set up a test version for trying it out.
  • Ender_74Ender_74 Join Date: 2011-01-28 Member: 79329Members
    My main focus here is for clan matches and I meant this in a more static way that you understood it I think.
    I would want to have the voice of the comm from above me regardless of where he's watching. (I want to recognize his voice over the others)
    Regarding the squads, when we play in matches we decide squads out of the game and try to stick to them during the round, that's when I'll set the position of my squad mates voices.
    I understand it is probably completely different from the mod you are presenting here, I just think it may be useful. And of course would imply some getting used to.
  • culpritculprit Join Date: 2005-01-07 Member: 33527Members, Constellation
    This is a really awesome mod here! I really hope this can get rolled into the NS2 proper. There are definitely some tweaks that could be done to handle to edge cases (comm and distant players). Using specific DSPs on the comm (maybe to simulate a PA intercomm sound - like TF2 announcer) and distant teammates would really help add some polish on this.
  • ZehtukaZehtuka Join Date: 2010-07-26 Member: 72853Members
    They should integrate this in the game and replace the current VOIP.
  • endarendar Join Date: 2010-07-27 Member: 73256Members, Squad Five Blue
    Very nice!

    Just testing this out, cant wait to try it out in a real game.
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    Thank you for all your positiv feedback guys :)

    <!--quoteo(post=1881148:date=Oct 22 2011, 11:48 AM:name=Zehtuka)--><div class='quotetop'>QUOTE (Zehtuka @ Oct 22 2011, 11:48 AM) <a href="index.php?act=findpost&pid=1881148"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->They should integrate this in the game and replace the current VOIP.<!--QuoteEnd--></div><!--QuoteEEnd-->

    hmm the problem is that the plugin is working over Mumble, it can't replace the ingame voice in that way. But I agree that I would really like to see something like that built into the ingame voice of a game. I don't know any game which has such a Positional Audio feature. Of course with the ability to disable it if somebody don't want it.

    At least the devs could integrate the <a href="http://mumble.sourceforge.net/Link" target="_blank">Mumble Link</a> into the engine so it supports Mumbles Positional Audio out of the box. The code for that is under public domain "and can be used, shared or modified freely" so I think there is no licence problem if they would put that in there proprietary engine. There are not many games with native support currently.
  • ale'ale' Join Date: 2011-08-06 Member: 114689Members
    <!--quoteo(post=1880333:date=Oct 17 2011, 10:44 PM:name=Ender_74)--><div class='quotetop'>QUOTE (Ender_74 @ Oct 17 2011, 10:44 PM) <a href="index.php?act=findpost&pid=1880333"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->My main focus here is for clan matches and I meant this in a more static way that you understood it I think.
    I would want to have the voice of the comm from above me regardless of where he's watching. (I want to recognize his voice over the others)
    Regarding the squads, when we play in matches we decide squads out of the game and try to stick to them during the round, that's when I'll set the position of my squad mates voices.
    I understand it is probably completely different from the mod you are presenting here, I just think it may be useful. And of course would imply some getting used to.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Do you have speakers or headphones that can emulate the sound coming from above? I know I don't. And it shouldn't be a big issue in clan matches anyway because you should learn to recognize the voice of your commander pretty quickly.
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    <!--quoteo(post=1881196:date=Oct 22 2011, 05:02 PM:name=ale')--><div class='quotetop'>QUOTE (ale' @ Oct 22 2011, 05:02 PM) <a href="index.php?act=findpost&pid=1881196"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Do you have speakers or headphones that can emulate the sound coming from above? I know I don't. And it shouldn't be a big issue in clan matches anyway because you should learn to recognize the voice of your commander pretty quickly.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Anyway, it is just not possible to hear things from above. Even if you would have such a speaker it would sound the same as from front or behind. The reason is that your ears will get the sound with the same volume and delay so there is there no information for you brain to calculate the position of the sound origin. Just try it with a friend, close your eyes and let him snap his fingers before and behind you. You will have no idea where the sound is coming from, you can just guess it. :) I wish I could implement such features but humans are to limited, you need cat/bat ears or at least more ears like him: <a href="http://www.guardian.co.uk/artanddesign/2009/apr/14/performance-artist-ear-impant" target="_blank">click for more ears!!</a>
  • derWalterderWalter Join Date: 2008-10-29 Member: 65323Members
    the brain calculates the direction by echos and reflections,
    so the brain can defect where a sound is coming from.

    never had this situation, you are walking on the street and
    out of sudden you are jumping to the side and looking up
    because you heard a cracking noise over your head?
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    <!--quoteo(post=1881346:date=Oct 23 2011, 12:32 PM:name=derWalter)--><div class='quotetop'>QUOTE (derWalter @ Oct 23 2011, 12:32 PM) <a href="index.php?act=findpost&pid=1881346"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->the brain calculates the direction by echos and reflections,
    so the brain can defect where a sound is coming from.

    never had this situation, you are walking on the street and
    out of sudden you are jumping to the side and looking up
    because you heard a cracking noise over your head?<!--QuoteEnd--></div><!--QuoteEEnd-->

    I'm no expert so I just read the Wikipedia article about sound localization. And reflections and echos are not used for localization calculation by the auditory system, only direct sounds. BUT (and that's new to me) it uses characteristics reflections in the external portion of the ear to detect directions. So it could detected sounds from above. Awesome! But at least not possible to achieve with stereo speakers. ^^

    But thanks for the hint!
  • glimmermanglimmerman Join Date: 2004-04-29 Member: 28300Members, Constellation
    edited October 2011
    Check out the ACRE mod for arma 2 for a good way this should work.

    A nice video of the demo, genera directl 3d during the whole game, some radio chatter at around the 1:20 mark.

    <a href="http://www.youtube.com/watch?v=v1TAenJI-zs&feature=related" target="_blank">http://www.youtube.com/watch?v=v1TAenJI-zs...feature=related</a>.

    The radio signal is affected by all sorts of things including:

    - the type of radio
    - the power settings of the radio
    - terrain
    - plus other technical stuff I can't remember

    It also has different channels for communication (set by frequencies though, this is a military sim implimentation of it)

    Main things to listen for is the radio noise, and the 3d sound positioning.

    This is using teamspeak 3.

    Also has a few things like if you talk on the radio, people around you will hear your direct talk (aka the 3d sound), as well as your radio dialouge if you are on the same radio frequency.
  • RanemanRaneman Join Date: 2010-01-07 Member: 69962Members
    Now if only there was a clan with a mumble server.
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    <!--quoteo(post=1887228:date=Nov 28 2011, 01:49 AM:name=Raneman)--><div class='quotetop'>QUOTE (Raneman @ Nov 28 2011, 01:49 AM) <a href="index.php?act=findpost&pid=1887228"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Now if only there was a clan with a mumble server.<!--QuoteEnd--></div><!--QuoteEEnd-->

    At least we and HBZ used Mumble :) The Teamspeak 3 Plugin ACRE from glimmerman's post sounds awesome but I have currently no idea about the Teamspeak 3 plugin API and also no time to dig into it. But maybe I'll give it a shot sometime later.
  • RyneRyne Join Date: 2012-02-25 Member: 147408Members, NS2 Map Tester
    Does this mod still work with B199? I cannot get it to work and typing "mumble" into console does nothing.
  • ArkantiArkanti pub baddie Join Date: 2011-07-22 Member: 111781Members, NS2 Playtester, Squad Five Blue, Reinforced - Shadow
    So this only works with positional audio for everyone in your Mumble channel right, not in game? Does everyone in Mumble need to be running the plugin for it to work, or just yourself?
  • endarendar Join Date: 2010-07-27 Member: 73256Members, Squad Five Blue
    It is probably broken by now, due to the nature of how these things work.

    And to Arkanti: If you are running the plugin, it will allow others who are running the plugin to have access to your location data, and it will allow you to receive location data from other players running the plugin.

    It can be disconcerting using this, takes a bit to get used to.
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    <!--quoteo(post=1912036:date=Mar 11 2012, 09:33 AM:name=Ryne)--><div class='quotetop'>QUOTE (Ryne @ Mar 11 2012, 09:33 AM) <a href="index.php?act=findpost&pid=1912036"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Does this mod still work with B199? I cannot get it to work and typing "mumble" into console does nothing.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Thank you for the information!

    I haven't had time the last months to play NS2 by myself but I'll try to fix it. It worked quite a long time without updates from my side so hopefully just some small changes are needed. Stay tuned!
  • Smug_LobsterSmug_Lobster Join Date: 2009-06-22 Member: 67903Members
    Holy crap can't wait to try this. I wish games would all have positional audio for voice communication.
  • HackepeterHackepeter Join Date: 2003-06-08 Member: 17107Members, Constellation
    And there it is!

    I updated the first post to the new version 1.2 which will work with B200 and hopefully many of the following builds.

    Keep in mind that your friends also need the plugin and it's important that all of you are connected to the same server IP. If you host a local server and connect locally but your friends connect over an external IP then Mumble thinks you are playing on different servers and there will be no Positional Audio between you. If you play on normal public servers it should always work, please write an PM when you experience any problems.

    Enjoy!
  • RyneRyne Join Date: 2012-02-25 Member: 147408Members, NS2 Map Tester
    <!--quoteo(post=1915480:date=Mar 20 2012, 09:49 AM:name=Hackepeter)--><div class='quotetop'>QUOTE (Hackepeter @ Mar 20 2012, 09:49 AM) <a href="index.php?act=findpost&pid=1915480"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->And there it is!

    I updated the first post to the new version 1.2 which will work with B200 and hopefully many of the following builds.

    Keep in mind that your friends also need the plugin and it's important that all of you are connected to the same server IP. If you host a local server and connect locally but your friends connect over an external IP then Mumble thinks you are playing on different servers and there will be no Positional Audio between you. If you play on normal public servers it should always work, please write an PM when you experience any problems.

    Enjoy!<!--QuoteEnd--></div><!--QuoteEEnd-->

    Thanks man, Ill give it a try tonight! Really appreciate the work you put into this.
  • SquishpokePOOPFACESquishpokePOOPFACE -21,248 posts (ignore below) Join Date: 2012-10-31 Member: 165262Members, Reinforced - Shadow
    <!--quoteo(post=1881148:date=Oct 22 2011, 02:48 AM:name=Zehtuka)--><div class='quotetop'>QUOTE (Zehtuka @ Oct 22 2011, 02:48 AM) <a href="index.php?act=findpost&pid=1881148"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->They should integrate this in the game and replace the current VOIP.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Sucks to be those who can only hear out one ear...
Sign In or Register to comment.