Sunday 24 March 2013

Putting a webserver inside a Phone!

The Project SmartBerryBox

This project born during an hackathon at CodeMotion Conference in Rome.
Thanks to this project I won a wonderful BlackBerry Z10.
The idea is showed in the following video:



What does it happens?
It is an HTML5 game running in the browser.. and the phone, a blackberry 10 devalpha device, it is used as a pad/controller.

This project is full of different tecnology:

  • a standalone webserver: mongoose runs inside the phone
  • the communication between the phone and the browser is made with websockets
  • html5, canvas, jaws js, javascript for drawing and moving the game

How?
1. The server is inside the phone and the browser download the html5 game files, at first connection; like a visit of an html page.
2. The browser establish a websocket connection with the web server.
3. Whenever an event from the controller/the phone touchscreen, occur, the phone send with websocket the controller event(left,right,fire pressure) to the html5 game that update the movement of the player ship, on the canvas.

Why?
Your phone can do more and more..
Don't you want to use those CPU Cores for something useful and funny? :)
Smartphones are replacing portable console but they can replace home console, at least for casual gaming!
And this is just Today!
You just need a browser with HTML5 and websocket capability and your phone.
The browser (inside a smartTv for example) became the screen, the phone is the pad.
Your phone is something that it is able to adapt to different context and games,  just changing UI or use different hardware like the accelerometer.

Imagine a multiplayer game context, where every phone is connected each other and it is able to act as a controller: you and your friends playing in front of the tv: a quiz game, a car race, etc.
Cool, isn't it?

All the code I did, run on a BlackBerry 10 device, but since it is full of opensource tecnology it is easy to port the code to Android, maybe IOS.. with Native SDK.
The fundamental part is running mongoose with USE_WEBSOCKET flag.

I don't think windowsphone is able to run it, due to platform limitation: no native c/c++ code..as I know..

I will give all the code to the community in the next days, a blog post will follow and the source code on github also.
Do you like it?

2 comments:

  1. Yes we can put the webmaster details on our phone and contact them any time.
    mobi ritz

    ReplyDelete
  2. Great info with lovely details. I like your idea. Thanks for sharing. cep telefonunun

    ReplyDelete