'u' flag and bridge bot interface -- protocol info

'u' flag and bridge bot interface -- protocol info

Discuss development of lobby clients, server, autohosts and auto-download software.

Moderators: Moderators, Lobby Developers

Post Reply
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

'u' flag and bridge bot interface -- protocol info

Post by Silentwings »

As announced in viewtopic.php?f=64&t=38922, uberserver now has support for bridge bots to external chat channels e.g. Discord, ZK, IRC. This allows chat messages to appear natively e.g. "<[Some]Dude:Discord> oh hai", and for a lobby to show the bridged users in their userlists.

With this comes a change: the chat for a battle now takes place inside a channel. This permits autohosts to also act as bridge bots e.g. "<[Some]Dude:DarkEnergy7> my tank just died", and also reduces duplicated code within the lobbyserver. Consequently SAYBATTLE and SAYBATTLEEX are deprecated.

A client signifies they are ready for both of these updates by sending the 'u' compatibility flag.

Protocol changes for ordinary clients who provide 'u':
  • A new sentence arg of BATTLEOPENED informs the client of the name of the channel associated to the battle. Clients joining (/leaving) this battle will be automatically joined (/left) from this channel, with the usual notifications sent to other clients supporting 'u'. The server controls which clients are present in this channel e.g. a 'normal' JOIN command is not allowed.
  • The battle chat takes place through SAID and SAID** commands in this channel, just like a normal channel.
  • JOINEDFROM, LEFTFROM, SAIDFROM to notify that a bridged user joined/left/spoke in a channel.
  • CLIENTSFROM, sent alongisde the usual CLIENTS when a user joins a channel, providing a list of currently bridged users in that channel.

Protocol changes for (auto)hosts who provide 'u':
  • Send a ex-style message within the battle to a single user with BATTLEHOSTMSG. This functions as a SAIDEX sent to just a single user, and is only accessible to battle hosts.
Protocol changes for bridge bots, only accessible with 'u': Clients supporting this functionality should send the 'u' compatibility flag. Bridge bots using the interface must send the flag, and also require a botflag unless they are a battle host bridging into its own battleroom and using the hosts own username as the location.

Ordinary clients, including hosts, that fail to support 'u' are supported with (near complete) backwards compatibility using SAYBATTLE etc.
User avatar
bibim
Lobby Developer
Posts: 952
Joined: 06 Dec 2007, 11:12

Re: 'u' flag and bridge bot interface -- protocol info

Post by bibim »

Silentwings wrote: 08 Feb 2019, 13:09Bridge bots using the interface must send the flag, and also require a botflag.
So this means autohosts without bot flag can't use the bridge interface for in-game players ?
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: 'u' flag and bridge bot interface -- protocol info

Post by Silentwings »

I think I see why you're asking - I'll relax this restriction to allow a host with no botflag to bridge into its own battle, provided that the host uses its own username as the location.

edit: done, modified OP.
User avatar
bibim
Lobby Developer
Posts: 952
Joined: 06 Dec 2007, 11:12

Re: 'u' flag and bridge bot interface -- protocol info

Post by bibim »

From a autohost named "Spads":

Code: Select all

20190218153434 - DEBUG    - [SpringLobbyInterface] Sending to lobby server: "BRIDGECLIENTFROM spads testId testName"
20190218153434 - DEBUG    - [SpringLobbyInterface] Received from lobby server: "FAILED msg=You cannot bridge a location named after another bot user	cmd=BRIDGECLIENTFROM"
Also, is there any reason to prevent bridging by the host in private battles ?
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: 'u' flag and bridge bot interface -- protocol info

Post by Silentwings »

From a autohost named "Spads":
"BRIDGECLIENTFROM spads testId testName"
Please have another go, there was a bug https://github.com/spring/uberserver/co ... 88a07e6f1d (and note that usernames are case sensitive!)
Also, is there any reason to prevent bridging by the host in private battles ?
It's allowed as in viewtopic.php?f=64&t=38984&p=589982#p589980, but they can only bridge into their own battleroom. That restriction exists because bridge bots can effectively impersonate other users, so "full" bridging rights need to be controlled.
User avatar
bibim
Lobby Developer
Posts: 952
Joined: 06 Dec 2007, 11:12

Re: 'u' flag and bridge bot interface -- protocol info

Post by bibim »

Silentwings wrote: 18 Feb 2019, 18:52 and note that usernames are case sensitive!
Yes that's what I tried initially, but then here is what happened:

Code: Select all

FAILED msg=Invalid syntax: Only lower case ASCII chars, [], _, 0-9 and . are allowed in location names.	cmd=BRIDGECLIENTFROM
Silentwings wrote: 18 Feb 2019, 18:52
Also, is there any reason to prevent bridging by the host in private battles ?
It's allowed as in viewtopic.php?f=64&t=38984&p=589982#p589980, but they can only bridge into their own battleroom. That restriction exists because bridge bots can effectively impersonate other users, so "full" bridging rights need to be controlled.
Actually by "private battles" I meant passworded battles.
Here is what happens when a autohost tries to use the bridge interface inside a passworded battleroom:

Code: Select all

FAILED cmd=JOINFROM	msg=Cannot bridge to private channels
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: 'u' flag and bridge bot interface -- protocol info

Post by Silentwings »

Yes, privacy, if bridges out of passworded channels existed then the users would in some sense expect privacy but also have lost sight of where their chat was being sent to. I've (just now) added an exception for passworded battle hosts bridging into their own battles. The upper/lower case issue should also be fine now.
User avatar
bibim
Lobby Developer
Posts: 952
Joined: 06 Dec 2007, 11:12

Re: 'u' flag and bridge bot interface -- protocol info

Post by bibim »

FYI I tried again to experiment a bit with the bridge bot interface and autohost, but it seems there are still issues: lobby clients which don't support the bridge bot interface will not see the bridged messages because they are relayed by the lobby server using the "__battle__XXXXX" channel, which they don't support.

Here is an example of commands sequence used for testing:

Code: Select all

SPADS -> LobbyServer : BRIDGECLIENTFROM Spads testId testName
LobbyServer -> SPADS : SERVERMSG You are now the bridge bot for location 'Spads'
LobbyServer -> SPADS : BRIDGEDCLIENTFROM Spads testId testName
SPADS -> LobbyServer : JOINFROM __battle__77761 Spads testId
LobbyServer -> SPADS : JOINEDFROM __battle__77761 Spads testName:Spads
SPADS -> LobbyServer : SAYFROM __battle__77761 Spads testId test message
LobbyServer -> SPADS : SAIDFROM __battle__77761 testName:Spads test message
And here is the corresponding message received from the lobby server by a client in the battleroom which didn't send the "u" flag and so only expect SAIDBATTLE type messages:

Code: Select all

LobbyServer -> LobbyClient : SAID __battle__77761 Spads <testName:Spads> test message
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: 'u' flag and bridge bot interface -- protocol info

Post by Silentwings »

You are right - it should be fixed by https://github.com/spring/uberserver/co ... d10d3ae100, which is now on the lobbyserver. Thanks.
Post Reply

Return to “Lobby Clients & Server”