The goal here was to develop a proof of concept of a multiplayer game with a twist: the key feature would be using a mobile device’s screen as a gamepad.
I used a classic Asteroids game as a starting point and made a number of gameplay changes: additional powerups, another asteroid generation principle etc.
To join the game, a player needs to scan a QR code (in this PoC version it’s displayed directly on the screen, but other placement options are possible in the final version) and open the encoded URL. The game’s application contains an HTTP server, designed to send a web page that represents a virtual gamepad to the connected devices. It also had a number of additional functions, like a welcome screen that displays the player’s username and ship’s image, and a game over screen with point count. Communication between the game-server and gamepad-client is done using WebSockets.
The game supports up to 12 active players and adapts to their number: as more players join, the amount of asteroids and powerups increases, while the play area grows bigger. If more players are looking to join, they are placed in a queue and get notified about their position in it via the mobile client.