Remote Pad — Remote Control for games using IoT principles
Remote Pad is a web app that allows you to play games on your computer using your smart phone as a remote controller. The principle is to exchange data in real time using the MQTT protocol and send strokes as if it were a keyboard.
Checkout this 1 minute video of Remote Pad in action:
remote-pad - Aplicativo web capaz de enviar dados para um Broker MQTT e controlar jogos em emuladoresgithub.com
remote-pad-server - Broker MQTT responsável por executar comandos enviados por remote-padgithub.com
This project consists of two repos, remote-pad responsible for the web client — which gives you a html5 page with pads or buttons for you to touch, and remote-pad-server which is the server that receives the data from the browser and execute as if it were a keyboard and send data to an emulator.
The image above shows a client that uses 4 buttons and the value of the accelerometer on Y axis as commands. The commands are translated to JSON and are send to the server. The server has maps to actual keys on the keyboard for each player.
That way, it doesn’t matter the emulator. You can play any kind of game as long as your platform (Linux, Windows or Mac) supports it. Even so it has some limitations, for instance some of the libraries used such as robotjs doesn’t have support for 32bits systems.
The tools used to create this project are:
- HTML5 — Device Orientation Events, Touch Events, Web Sockets
- NodeJS — Event-driven, non-blocking I/O
- MQTT protocol — Using mosca as a broker
- robotjs — Desktop Automation Library
- vuejs — Unobtrusive reactivity system
- hammerjs — Add support for touch gestures to your web page
- bulma — A modern CSS framework based on Flexbox
Currently you have out of the box a Race Pad and a Directional Pad.
The playability is tricky sometimes, some games require less buttons, some games require more buttons, but the bottom line is that is possible to play a great number of games with 2 buttons only. That way is better to have special kinds of pads for some sort of games.
For instance the Race Pad of course is better for Race Games. Let’s think about Mario Kart 64, you’ll need the steering wheel, a button to accelerate and another to shoot your special items. And that’s it. All other buttons can be considered optional in the sense of the minimum of buttons require to actually play.
The Directional Pad I use to play games like SNES Bomberman 5. The basics for this kind of game is movement and release the bomb. In this case I use the pan gesture — pointer is down and moved to a direction. It works but sometimes you make unwanted movements. The only way to make it work right is testing and create all kinds of Pads with different gestures until you match the playability.
The HTML5 API is still not fully supported but already allows you to create really great apps. The potential is endless.