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:

Source code

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.

Architecture

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.

Tools

The tools used to create this project are:

As you can see only the JavaScript language was used to make this project (and some C/C++ from robotjs) and because the MQTT protocol is lightweight the commands are sent smoothly through the network (of course the better way is to run on a local network).

Playability

Currently you have out of the box a Race Pad and a Directional Pad.

Race Pad
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.

Conclusion

NodeJS (JavaScript) and his event-driven model works really great on environments that require real-time communication, both client and server.

The HTML5 API is still not fully supported but already allows you to create really great apps. The potential is endless.