| JGroups port to Android |
|
|
|
| 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 :
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
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 :)
I'd love to try it too, running Android 2.1 - could you publish a demo in the market?
Is your HTC Desire running Android 2.2 ? or 2.3 ?
Mine is 2.3 but I can do a package if you want :)
Is the modified draw demo downloadable as a package somewhere ? So that I can directly install it on my HTC Desire ?
RSS feed for comments to this post