Jump to content
Sign in to follow this  
zsawyer

[WIP] Mod for Mumble's link plugin

Recommended Posts

Hello,

I just would like to let you guys know that I am currently working on implementing a mod that will support/use mumble's link plugin to get positional audio working.

Basically this will be a work-around until (hopefully sometime) BIS will support mumble's link plugin without requiring a modification.

The project can be found over at Dev-Heaven and will be free and open-source (LGLP3):

https://dev-heaven.net/projects/mumblelink

I have got experience with this kind of thing as I already have successfully done exactly this (a mod) for Minecraft (https://sourceforge.net/projects/modmumblelink/). Using my experience and code from that project I am hoping I can adapt it to Arma2/Arma2OA.

While I am quite confident of achieving this I could still use some help from the community. I am not very experienced in making Addons/Mods for Arma2. I only had a little glance at SQFs from MSO, FPScounter and of course the BIKI.

Mumble requires information about the player to compute the positional audio. Extracting this information from the available functions is proving difficult but I think I have found some promising interfaces that might work: https://dev-heaven.net/projects/mumblelink/wiki/Developer%27s_notes

Basically there are 3 things I need right now:

  1. avatar's positional data
  2. camera's positional data
  3. avatar's meta data

1. avatar's positional data

This consists of 3 vectors:

  1. location in the world

  2. which direction is forward

  3. which direction is upward

2. camera's positional data

This consists of 3 vectors (very similar to avatar):

  1. location in the world

  2. which direction is forward

  3. which direction is upward

3. avatar's meta data

This is data related to the player. For identification and grouping.

Minimum should be:

  1. player identity (nick name or UID)

Optimal would be:

  1. player identity (UID)

  2. server identity (IP/IP+port or UID or server name)

  3. player's team

  4. player's squad

Note: The meta data is intended for mumble's "context" (
). However right now team or squad will probably not be used as this will lead to only squad or team members being able to get linked.

Also note that not linked players will be heard and hear others non-directional and with full volume ("force center").

This project consists of two parts:

  1. SQF-Mod
  2. Native Library

1. SQF-Mod

This is the part I am fairly new to. Basically it will tell the native library to hook up to mumble (
init
) and then continually acquire all the necessary information and hand it over (
update
) to the native library using the
method.

2. Native Library

This is a rather easy part for me. This native library (DLL) will initialize (
init
) mumble's link plugin and take the information passed by the SQF-Mod's callExtension-Call and parse the arguments to then "shove" (
update
) them over to Mumble (mumble's link plugin; pipe structure "linkedMem").

A basic and totally untested implementation is already in the repository.

So how can you help?

Generally any technical input especially regarding SQF and Addons is much apprechiated. That being said...

  • Please have a look at my
    and see if you have any suggestions.

  • I still desperately need a server identifier. How can I get the IP of the server that the client is connected to?

  • As I am not too fit in SQF and modding maybe you can lend me a hand and contribute by creating the actual mod (SQF stuff). I will provide the native library interface for callExtension.

Thanks for reading.

Edited by zsawyer

Share this post


Link to post
Share on other sites

Thanks for taking the time to work on this. I would really like mumble positional audio to work with A2OA. The in-game VON just doesn't cut it and it lags the server.

Share this post


Link to post
Share on other sites

1. avatar's positional data

This consists of 3 vectors:

  1. location in the world
  2. which direction is forward
  3. which direction is upward

You can get all of these via getPosASL, vectorDir, and vectorUp for objects.

2. camera's positional data

This consists of 3 vectors (very similar to avatar):

  1. location in the world
  2. which direction is forward
  3. which direction is upward

These can be had in a number of ways, mostly via using the available camera functions, or possibly, in the new beta, eyeDir (I assume it returns a vector to which the I is looking). Not sure about the up vector though.

3. avatar's meta data

This is data related to the player. For identification and grouping.

Minimum should be:

  1. player identity (nick name or UID)

Optimal would be:

  1. player identity (UID)
  2. server identity (IP/IP+port or UID or server name)
  3. player's team
  4. player's squad

In the latest betas there is a function that will return the games internal network identifier for that object.

Share this post


Link to post
Share on other sites

Thank you for your support and input.

@NouberNou

I am glad that we concur in using getPosASL, vectorDir, vectorUp.

The camera object has me kind of worried because I have not found a way to access the current camera. It also has got me confused as it seems to be more intended for cinematic purposes. From what I can tell I would have to instantiate one myself hoping it will not mess up the player's view. A workaround I was hoping for is to inquire unit vectors in the camera coordinate system to be transformed to world coordinate system using positionCameraToWorld. A bit of translation magic and I might get the coordinates without having to create a cinematic camera object.

Looking at the current mumble plugin for arma2 (memory hack) it seems that camera position is ignored and simply the avatar's data is used.

I am pondering whether or not this is a better approach as it might be more immersive not using the actual camera position. I will probably have this as optional so the user can set this in a configuration file to whatever he prefers.

In the latest betas there is a function that will return the games internal network identifier for that object.

I am not exactly sure what you mean by internal network identifier. Could you link me to that function please?

My own research yielded https://dev-heaven.net/issues/25915#note-28 which talks about "netId" but this is rather for callbacks and dll management rather than an actual game server id. So not sure if that is what you had in mind.

PS: I am currently refactoring the minecraft mod hoping this will lead me to create a clearer interface for the SQF.

Share this post


Link to post
Share on other sites

Indeed netId is what I am talking about, but it should work for your purposes because it returns the games internal identifier that is used to identify objects across the network, so in that you can pass the netId from one machine to another via some other means and it will refer to the same object (at least in theory, the function is very new, so of course there might be bugs).

In ACRE we use the TS3 ID from Teamspeak and we just pass it into arma and assign it to player objects via setVariable with the third parameter for it being network public as true. I have not really used mumble all that much, but I would assume that it has its own unique identifier for connected clients as well, so you might want to look into that.

Share this post


Link to post
Share on other sites

Alright, I think I get it: You are using it for player identification based on the TS3 ID.

When the word "network" came I was kind of thinking about identifying the server. There isn't possibly any API-Reference or other documentation for that function available? Or maybe you would allow me to peak at your code ;).

While I think I understand how you are using the TS3 IDs to distinguish players, I believe that for Mumble a more pragmatic approach can be used (at least for now): The player / Arma2 client identifies itself towards the mumble client using the "identity" field. It is quite generic (up to 256 unicode characters) but it will suffice to use an arma2 server-wide unique ID (thought of getPlayerUID here for now but might as well use netId if it's just some kind of getter that works out of the box).

As for server id: I think that would require the server to run the mod as well (and broadcast it's netId) which is not what I want - I'd like the project to be pure client-side.

Again, thanks for your input it is much appreciated!

Edit:

Just thought: maybe I can have the first client initialize a public variable to identify the whole group (maybe that is exactly what you meant). Something like

getVariable "myServerID"

... //when not set do

setVariable "myServerID", getPlayerUID player

*disregard wrong syntax please xD

All clients would then be identified by what ever the first client set myServerID to. (Could maybe use some time based random string to make it more generic.)

I will have to look further into the live-cycle of those broadcasted variables.

Edited by zsawyer

Share this post


Link to post
Share on other sites

From the my understanding you are trying to mimic Directional in Mumble, but will you also make it where we can set the distance/range before it cuts off. Would love to have directional based Mumble that wasn't range restricted, otherwise my group will more than likely stick to regular Mumble.

Share this post


Link to post
Share on other sites
From the my understanding you are trying to mimic Directional in Mumble

That is not exactly right. The mod will not calculate positional audio itself. It will merely will give mumble the player's location etc. Mumble itself will then do the rest.

but will you also make it where we can set the distance/range before it cuts off. Would love to have directional based Mumble that wasn't range restricted,

Mumble has an option for exactly that. By default you will be able to hear people directionally even if they are infinitely far away. (See Settings -> Audio Output -> Positional Audio -> Maximum Distance and Minimum Volume setting

otherwise my group will more than likely stick to regular Mumble.

You can be using the regular Mumble anyways. You just turn positional audio on or off.

I hope this answers your question.

Share this post


Link to post
Share on other sites

Ahh thanks zsawyer, you cleared up my concerns :) I had the impression you were trying to mimic the drop off and range of Direct Communication, ie someone speaking outside the range would not be heard over Mumble.

Share this post


Link to post
Share on other sites

I had a first try at getting a test version of the SQF mod to run but I just do not understand it.

I need some help - I just cannot figure out why the init line is never called.

I am expecting line 3 from this (all code here)

class MumbleLink_main  
{
   init="[] call compile preprocessFile ""\MumbleLink\scripts\init.sqf"";";
};

to be executed but it never happens. I can tell since I scattered diag_log calls all over the place.

The PBO is built using cpbo.exe by right clicking on the MumbleLink-folder and "create PBO".

What am I doing wrong?

I can't seem to find a tutorial that applies to my situation (simply running a script that does stuff on its own once it was started).

Any help and resource hints will be much appreciated.

Thx

Edited by zsawyer

Share this post


Link to post
Share on other sites

a) post your addon/config

b) you need CBA/XEH for auto init

Share this post


Link to post
Share on other sites
a) post your addon/config

All the files can be downloaded from the repository (https://dev-heaven.net/projects/mumblelink/repository/revisions/master/show/sqf)

b) you need CBA/XEH for auto init

Well I am not trying to initialize on any specific item/unit. I just want to initialize on load of the addon. I am aiming at having as few dependencies as possible so I am attempting to avoid CBA and XEH.

Thanks for looking into this, I appreciate it.

Share this post


Link to post
Share on other sites
All the files can be downloaded from the repository (https://dev-heaven.net/projects/mumblelink/repository/revisions/master/show/sqf)

Well I am not trying to initialize on any specific item/unit. I just want to initialize on load of the addon. I am aiming at having as few dependencies as possible so I am attempting to avoid CBA and XEH.

Thanks for looking into this, I appreciate it.

There is nothing like that in A2 by default. CBA's XEH gets around this by basically overwriting the init event handler for every unit in the game and plugging into their defined events. Until BIS provides us with this feature on our own you need to use CBA or write your own (which would then not be compat with any addon that uses CBA, which is a lot of them).

Share this post


Link to post
Share on other sites
There is nothing like that in A2 by default. CBA's XEH gets around this by basically overwriting the init event handler for every unit in the game and plugging into their defined events. Until BIS provides us with this feature on our own you need to use CBA or write your own (which would then not be compat with any addon that uses CBA, which is a lot of them).

Alright I have seen Deadfast's FPS counter uses a toggle button - I guess that could be an alternative. Maybe I can check if CBA/XEH is available and if not provide a button that the user can/has to press to activate it. But that's for later at first I'll go with XEH.

Thank you for that thorough explanation.

Share this post


Link to post
Share on other sites

You can also auto init from the onLoad handler of the main display. However this can be only done by one addon.

So you easily run into compatibility conflicts there.

You may want to try DevCon for coding, testing and debugging.

Share this post


Link to post
Share on other sites

I think using CBA would be the best option, as it is well supported and provides compatibility with other mods. If you ever need some people to test this out I would be glad to help. My group uses mumble for voip, we are a bit scared of acre and teamspeak and chose to go with mumble as it seemed the simpler option at the time.

Share this post


Link to post
Share on other sites

I too am very interested in helping as our clan has been using TS for years but are increasingly dismayed by crashes and difficulty in getting ACRE to work.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×