FAF Voice plugin

Post here if you want to help developing something for FAF.

FAF Voice plugin

Postby Rienzilla » 26 Feb 2013, 17:35

Current test version: http://sinas.rename-it.nl/~rien/faforev ... .9-157.zip Use at your own risk.

Hey everyone,

I was toying with the idea to make a voice plugin for FAF. Idea:

1. Create a voip server somewhere (I toyed with mumble for now).
2. As soon as people launch a teamgame (i.e. where there's more than 1 person in a team), have the server create a set of voice channels on the server named "gameid-teamnumber".
(2b: have the server send a message to lobby clients that the channel is ready?)
3. Have the lobby connect the voice client to the server and make it join the channel.
4. when the game ends, have the lobby leave the channel.

ad 2: The creation of a voice channel for mumble can be accomplished by doing a simple http get or post request.
ad 3: To make a client join the right channel, all we need to do is have the lobby execute mumble mumble://myserver/channelname

I've never looked the faf source code before, but it seems like implementing this is fairly simple. Could anyone give me some pointers where this could be added?
--
Rien
Last edited by Rienzilla on 04 Mar 2013, 12:11, edited 2 times in total.
User avatar
Rienzilla
Contributor
 
Posts: 145
Joined: 09 Aug 2012, 22:08
Has liked: 0 time
Been liked: 9 times
FAF User Name: Rienzilla

Re: FAF Voice plugin

Postby ZaphodX » 26 Feb 2013, 17:48

This would be ace. That is all.
User avatar
ZaphodX
Contributor
 
Posts: 560
Joined: 02 Jan 2013, 01:55
Location: UK, GMT+0
Has liked: 0 time
Been liked: 0 time
FAF User Name: TAG_ZaphodX

Re: FAF Voice plugin

Postby Ze_PilOt » 26 Feb 2013, 17:51

You need to know when the game is launched, or when the games are modified.

All things related to games are going through the signal called "gameInfo".

GameInfo is sent each time something new happens to a game (new player, new map, game starts,....).
It's a standard python dictionary with the following keys (I've only described the less obvious) :

gameInfo["access"] : the access type (private/public)
gameInfo["uid"]
gameInfo["title"]
gameInfo["state"] : State of the game (open/playing/closed). Open means that player can join (lobby state).
gameInfo["featured_mod"]
gameInfo["mapname"]
gameInfo["host"]
gameInfo["num_players"]
gameInfo["game_type"] (assassination,...)
gameInfo["game_time"] : When the game was started.
gameInfo["max_players"]
gameInfo["teams"] : The team composition. It's another dictionary where the key is the team number, and the value is an python array of the players in that team. -1 for observers.

So, in order, you need to create a new module (would be cleaner).

In the clientwindow file (https://bitbucket.org/thepilot/modular- ... at=default), you have a setup fonction.

That's where you make the lobby aware of your module.

Then you need to connect the gameInfo signal to a function in your module.

If you respect the same conventions of the rest of the code :

Code: Select all
self.client.gameInfo.connect(self.processGameInfo)


where client.gameInfo is the signal coming from the client, and processGameInfo the function you call :

Code: Select all
def processGameInfo(self, gameinfo) :
    print gameInfo["teams"]


Will print you the team composition.

So you need to parse all the teams to check if the player (self.client.login) is in it.
The first time, the state will be "open". Save the uid somewhere with that state.
When the state is going to "playing", you can run your code making the player is going in the right channel.
You also have to check that the player does not disappears from that game.
You also want to check if the gameMod is not ladder1v1, or if the amount of players > 2.

Then, when the state goes to "closed", you can send a command to close/quit the channel.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: FAF Voice plugin

Postby Rienzilla » 27 Feb 2013, 03:36

edit: problem with subprocess/QProcess is solved: spawning the process via win32 api works.

However, I wonder: when do I ever get the closed gameInfo signal? I seem to never get one. It's not that big a deal, but it will cause people to hang in the channel until they join the next game.
Last edited by Rienzilla on 27 Feb 2013, 04:35, edited 1 time in total.
User avatar
Rienzilla
Contributor
 
Posts: 145
Joined: 09 Aug 2012, 22:08
Has liked: 0 time
Been liked: 9 times
FAF User Name: Rienzilla

Re: FAF Voice plugin

Postby Pierto » 27 Feb 2013, 04:23

This would indeed be awesome...

Hence my humble input:
http://windows-exe-errors.com/windows-e ... elevation/

If you are experiencing an error 740 message in Windows Vista or Windows 7 when trying to launch an application, it means the software was installed (or has been configured) to Run as Administrator.

Since the Application is launched from FAF, you'll probably have to run FAF as adminstrator to enable it to launch Mumble.

P
"T2 mex, I think it's a mistake! Why not do something more useful?" (RA_Zlo in a ranked 1v1 game against Yarma_Darma on Haven's Reef)
Pierto
Avatar-of-War
 
Posts: 82
Joined: 22 Nov 2012, 22:29
Has liked: 0 time
Been liked: 6 times
FAF User Name: Pietros

Re: FAF Voice plugin

Postby ColonelSheppard » 27 Feb 2013, 07:42

Pierto wrote:Since the Application is launched from FAF, you'll probably have to run FAF as adminstrator

i think somebody once said that this is a bad idea
User avatar
ColonelSheppard
Contributor
 
Posts: 2997
Joined: 20 Jul 2012, 12:54
Location: Germany
Has liked: 154 times
Been liked: 165 times
FAF User Name: Sheppy

Re: FAF Voice plugin

Postby Ze_PilOt » 27 Feb 2013, 08:52

Rienzilla wrote:edit: problem with subprocess/QProcess is solved: spawning the process via win32 api works.

However, I wonder: when do I ever get the closed gameInfo signal? I seem to never get one. It's not that big a deal, but it will cause people to hang in the channel until they join the next game.


Yes you do, that's why games are disappearing from the game lobby list and livereplay list.

You can also track a signal when FA is closed.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: FAF Voice plugin

Postby Rienzilla » 27 Feb 2013, 12:24

Ah indeed, the thing is that I am no longer in the teams list when I get a closed gameInfo signal.

When do those signal get emitted? After the game is completely over (i.e. everyone left?)
User avatar
Rienzilla
Contributor
 
Posts: 145
Joined: 09 Aug 2012, 22:08
Has liked: 0 time
Been liked: 9 times
FAF User Name: Rienzilla

Re: FAF Voice plugin

Postby Ze_PilOt » 27 Feb 2013, 12:27

Every time something change in the game (map changed, player leaving, game starting, ending, ....).

Once you get the current player in a game, you should store that UID somewhere and monitor it.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: FAF Voice plugin

Postby Ze_PilOt » 27 Feb 2013, 16:09

Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Next

Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest