Search



Designed by:

JGroups port to Android PDF Print E-mail
Written by Yann Sionneau   
Tuesday, 11 January 2011 22:15

Hi guys !

It's been a long time ... I really don't have the time and the motivation to blog, I guess blogging is not for me !

Anyway, I am doing some relatively nice stuff on a school project lately.

The goal of the project : making games on smart phones where several players can play together with automatic discovery of the different players available (auto configuration). Basically all players will connect to a Wifi Access Point or do some bluetooth PAN, begin a game and play in a mobile context where connection can be lost, data can be lost, anyone could be disconnected any second because of distance, bug, shutting down the device or battery outage. What's interesting about that ?

Several points :

  • No Client/Server architecture, the different instances of the game on each phone will exchange the objects they need and communicate with each other, using group communication (broadcast / multicast) or unicast.
  • There can't be a disconnection of everybody caused by the disconnection (or bug, battery fail, whatever ...) of the server phone, since there will be *no* server phone.
  • No need to enter an IP address or choose a phone to connect to or whatever, as soon as the phones are connected to the same subnetwork (wifi, bluetooth or whatever) they discover each other and can join or leave a game.
  • Each game instance has the same code running, no server-side, no single point of failure.
That's it, so all of this is beautiful theory, how do you do that now ?
We are trying to use JGroups as the lowest level communication API (over IP), it is a Java API to do "multicast communications".
Basically JGroups allows you to create a group (represented by a name), everyone in the same group (the same name) can automatically discover the other participants of the group and begin to discuss with them either on a one-to-one (unicast) mode or one-to-many (multicast/broadcast) mode.
In this case the group name can be the name of the game so that each phone trying to play to the same game would be "connected" to the same group and could discuss with each other.
So the game would use a game API (defined by some researchers from Télécom SudParis), and this game API would be implemented using the JGroups API.
So what is this blog post about ?
Just to tell that I just did a port of JGroups to android (2.1 to 2.3) which is available at https://github.com/fallen/JGroups
I successfully ran some demo programs using JGroups on android phones (HTC Desire, HTC Hero and Nexus One), some demos were also run on an Ubuntu and a Mac OS.
I ported and ran on those three phones a modified version of the "Draw" JGroups demo program.
It's a whiteboard, you can draw on the whiteboard with your finger touching the screen of the phone, and each point you draw is then transmitted to other group members. Several players can draw on the same whiteboard using their own phone.
Then I ported the SimpleChat JGroups demo program, there is no GUI though, but this time it is compatible with the computer version.
It has been tested simultaneously with 3 different phones and 2 computers (1 Mac OS X and 1 Ubuntu Linux).
You can write on the two computers console and the messages will be transmitted to everyone, you will be able to read them in the phones' syslogs (via adb logcat).
The phones will send in an infinite loop a message to the group with "Hello world from *phone name*", you will be able to read them in the phone's syslogs as well as in the computers' consoles.
I will keep you posted if I have something new about this project !
Last Updated on Monday, 17 January 2011 09:26
 

Comments  

 
0 #5 Saumik 2011-12-15 07:54
Hi can i have i demo video for the same app since the app doesn't work on emulator
Quote | Report to administrator
 
 
0 #4 Yann Sionneau 2011-01-20 14:25
Quoting Sanne:
Great!
I'd love to try it too, running Android 2.1 - could you publish a demo in the market?

I have no market account, but you can download the application installer at this url : sionneau.net/touchsurface%202.1.apk
Let me know if you have feed backs about it :)
Quote | Report to administrator
 
 
0 #3 Sanne 2011-01-20 00:48
Great!
I'd love to try it too, running Android 2.1 - could you publish a demo in the market?
Quote | Report to administrator
 
 
0 #2 Yann Sionneau 2011-01-17 10:12
Quoting Bela Ban:
Cool stuff !

Is the modified draw demo downloadable as a package somewhere ? So that I can directly install it on my HTC Desire ?

Is your HTC Desire running Android 2.2 ? or 2.3 ?
Mine is 2.3 but I can do a package if you want :)
Quote | Report to administrator
 
 
0 #1 Bela Ban 2011-01-17 09:39
Cool stuff !

Is the modified draw demo downloadable as a package somewhere ? So that I can directly install it on my HTC Desire ?
Quote | Report to administrator
 

Add comment


Security code
Refresh