GTetrinet integration with instant messaging applications



Hi,

[ Is it the right mailing list for GTetrinet ? ]

GTetrinet uses a client-server model: each player must connect to the
same server and then start a game with people connected to the server
[1]. I think it would be great to have some kind of integration with
instant messaging applications, namely Jabber [2] and Telepathy [3].

[1] http://alban.apinc.org/files/gtetrinet/gtetrinet1_small.png
[2] http://en.wikipedia.org/wiki/Jabber
[3] http://telepathy.freedesktop.org/wiki/FrontPage

== Use case ==

The use case I want to resolve is friends that already chatting over
IM and they want to play GTetrinet together. They don't want to choose
a server because it is an unneeded configuration task since they are
already connected via the IM. The IM application already knows how to
send messages from a player to another. Each player should configure
the IM one time and then everything should be automatic. They don't
want to choose a nickname in GTetrinet either because all players have
already configured their nicknames in the IM application.

So instead of writing the tetrinet server name, the user should be
able to select other people directly. GTetrinet can know the list of
online contacts because the IM application already know that list. See
example screenshot [4].

[4] http://alban.apinc.org/files/gtetrinet/gtetrinet_with_telepathy.png

Then the player start the game.

To keep compatibility with others clients, the client-server model
must remain. But it is possible to have both client-server support and
IM support.

== How to do that ==

This can be done with the Telepathy framework [3]. We can use contacts
widgets from libempathy-gtk. Empathy is an IM application for the
GNOME desktop using the Telepathy framework. Empathy and other
Telepathy components *may* be included in the GNOME 2.22 desktop: see
thread [5].

[5] http://mail.gnome.org/archives/desktop-devel-list/2007-September/msg00301.html

To achieve this goal, a lot of work is needed: the tetrinet protocol
is designed to be client server. The new protocol scheme may look like
[6].

[6] http://alban.apinc.org/files/gtetrinet/gtetrinet2_small.png

In order to have something working quickly, we can keep the protocol
unchanged and just use the Telepathy framework to route the packets.
The first player will have to host the server but it does not change
anything for users. Other players do not have to know the IP address
of the server (player1's computer) because Telepathy take care of
this.

This use the ability of Telepathy to create "tubes" (application data
channels). Tubes make applications able to exchange arbitrary data
between contacts. This can be "D-Bus tube" or, in case of GTetrinet,
"stream tube" (implemented by Guillaume in Gabble, the Telepathy
Connection Manager for Jabber). This behaves like a proxy [7].

[7] http://alban.apinc.org/files/gtetrinet/gtetrinet3_small.png

== Status of this work ==

Guillaume (in Cc: of this mail) and I are interested to see GTetrinet
working with tubes. We have some experimental patches. Guillaume has a
patch for this use case:

- Player1 start the GTetrinet application.
- Player1 select the player 2 in the contact list and click on "play".
Player1's GTetrinet start a local tetrinet server and configure a tube
for player2 for exporting the listening socket of the tetrinet server.
- Player2 is using the Empathy client. When the player2's Empathy
client receive the tube from the player1, it start GTetrinet with a
options "gtetrinet -P <xxx> --connect=localhost". The -P option is for
choosing the tcp port of the server. Player2's GTetrinet is connecting
to localhost because the listening socket has been proxied by the
tube: see schema [7].

Guillaume's patch need an Empathy support for starting other
applications. I don't know the status of this support. In the future,
we don't want this feature to be specific to one IM client (Empathy in
this case). There is a thread [8] on the Telepathy mailing list for
putting this feature in the right layer of the Telepathy framework.

[8] http://lists.freedesktop.org/archives/telepathy/2007-October/001127.html

I have another (ugly) patch [9] that does not need a Telepathy client
support (but need Telepathy of course):

- Player1 start the GTetrinet application and register a callback to
telepathy on "new tubes" events.
- Player2 start the GTetrinet application and register a callback to
telepathy on "new tubes" events.
- Player1 select the player 2 in the contact list and click on "play".
Each GTetrinet has a server included that listen only local
connections (bind address 127.0.0.1). I take the tetrinetx-ng [10]
code. Player1's GTetrinet configure a tube for player2 for exporting
its server socket.
- When player2's GTetrinet receive the tube from the player1, it
connects to the tube. See schema [7].

[9] http://dede.muadda.org/~alban/d/2007/10/gtetrinet_telepathy-v14.patch
[10] http://sourceforge.net/projects/tetrinetx-ng/

My patch is ugly because it includes all code from tetrinetx-ng. It is
just a prototype, but I was able to play via tubes. The relevent
Telepathy bits are in src/telepathyclient.{c,h} and README.Telepathy.
I wanted to clean up my patch but I don't know when I will do that. So
I prefer to let you know right now the fun I have with
GTetrinet/Telepathy hacking ;-)

Thanks in advance for your comments,
Best regards,

-- 
Alban Crequy


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]