[jdev] [Standards] Using Jabber in a KDE game
Alban Crequy
alban.crequy at collabora.co.uk
Thu Sep 4 06:31:22 CDT 2008
Hi,
[ I added the Telepathy mailing list in Cc. ]
Le Sat, 30 Aug 2008 13:56:31 +0200,
Kleag <kleag at free.fr> a écrit :
> Hello,
>
> New to this list, I'm the author of KsirK, a KDE strategy game.
> Currently its net game uses pure TCP/IP. One player start its game by
> setting a port on which to listen to and the others connect to this
> port. Then the libkdegames/kgame library is used to communicate. This
> lib as all what is necessary to exchange messages including Qt
> objects. It also have a chat framework. KsirK is a multiplayer game
> with, currently, does not allow passive not playing participants.
>
> Jabber seems to be a largely better solution. I want to have a very
> few centralized system, keeping one client as the game server and
> using the communication framework only for that: a communication
> tool. I'm also not interested in controling cheating, basing the game
> in trust.
>
> So, my idea is to progressively switch to Jabber. In a first step, it
> would just allow to publish a proposed game in a kind of chat room
> and then the current communication system would be used. In a second
> step, xmpp would also be used to exchange game data.
>
> I must admit that, even if Jabber seems promising, I'm a little bit
> lost in all the specifications and I don't know how to start
> implementing. I had a look to the recent thread (january and june)
> about the proposed Games XEPs and it seems promising for me.
>
> I will also contact the thelepathy and kopete teams as there are more
> related to KDE, but I'd like to have your opinion and advices about
> my ideas. I could describe them with more details, but I'm very not
> at ease with the underlying concepts and I don't want to say right
> now too silly things :-)
Hi,
If you already have a working TCP/IP protocol for your game, you can
use Telepathy stream tubes. You can use the Telepathy framework to
choose a contact in your game and offer a stream tube to your contact.
player 1:
unix socket
KsirK ------------> Telepathy
Connection Manager
| Telepathy Stream tube
player 2: | (some sort of XEP-0095 XEP-0047 atm)
unix socket v
KsirK <------------ Telepathy
Connection Manager
http://telepathy.freedesktop.org/wiki/Tubes
The difference would be to listen on an unix socket instead of a inet
socket on player 2's computer, and to connect on an unix socket instead
of an inet socket on player 1's computer. The telepathy framework do
the proxy and know how to reach the other contact. And the tube is
negotiated by KsirK using the Telepathy D-Bus specification (see
OfferStreamTube and AcceptStreamTube methods):
http://telepathy.freedesktop.org/spec.html
The advantages would be that your users do not need to setup the jabber
(server name, password) in your game because it reuses the connection
of the desktop. And that you keep your current protocol, the Telepathy
framework will be responsible to reach the contact, avoid NAT
problems, etc.
Does your game send a lot of data through the TCP connection? The
current implementation in the Gabble Connection Manager use Stream
Initiation (XEP-0095) and In Band Bytestream (XEP-0047) so the data
travel through the Jabber server encoded in XML+base64. But we plan to
implement tubes in a different way (Jingle?) to avoid abusing Jabber
servers without changing the interface for applications using tubes.
Best regards,
Alban
More information about the JDev
mailing list