IBM Hursley held an internal competition called The Great Cluster Code-Off through December and January. Teams of IBMers from all over the UK and Ireland signed up to one of two software, hardware and design challenges. After a couple of months of hacking the teams presented their entries to a selection of senior managers who awarded points; the highest scoring team was then declared the winner and “Master Coders”.
The two challenges that the teams could choose between were:
- The Internet of Things Challenge was to produce some kind of robotic device that you could control remotely from a laptop or mobile device; ideally it would include sensors for additional user feedback
- The Big Data Challenge was to build an app or game which used real-time location data of players and displayed them, or their interactions, on a map
Both challenges had some mandatory technology requirements:
The winning team…
After several months of hard work, involving late nights and long weekends, our team was crowned the winner of the code-off and awarded a trophy! We were a team of four WAS Liberty developers: Dave Waddling, Liz Maple, Laura Cowen and Alex Pringle. Together, we designed and produced a game called Liberty Paintball which answered the “Big Data Challenge”.
The winning entry…
As the name implies, Liberty Paintball uses Liberty profile in addition to all of the other technology we were required to use. Liberty Paintball is a simple game of virtual paintball that is played using mobile devices. You install an Android app, join the game (via Twitter), and fire virtual paintballs. The app uses GPS to monitor your location and it displays game events on a map so you can watch the action unfold.
The rules of the game …
Here we demonstrate Liberty Paintball in Liberty Paintball: The Movie:
You join the game and try to eliminate your opponents without getting eliminated yourself – simple! Or is it?
Indeed, there’s the slight problem of not knowing who else is playing. When you join the game you get a randomly-generated in-game name such as FeistyOrangeBadger. As the game progresses, information is broadcast to you and all of the other players about what events have occurred. Of course, as everyone is referred to by their in-game name you can only recognize yourself.
You might find out that ten minutes ago you were dangerously close to another player but didn’t know it! Do you remember where you were? And who was nearby? Oh, and don’t forget that the player also knows they had a close encounter too…
At any time during the game you can take a shot and, when you do, there are three possible outcomes:
- If there are no other players in range, you miss and the paintball sails past them.
- If there is 1 other player in range, you splat them with paint! They are knocked out of the game and you score a point.
- If there are 2 or more players in range, there’s a chaotic paintball fight in which you get splatted with paint and your opponents escape unscathed. You’re out.
You need to balance risk and reward. A busy location might be good for splatting lots of players but if you encounter more than one at the same time you’ll get splatted yourself.
You win the game if you are the last player left standing.
How it works…
Liberty Paintball is comprised of several different software and hardware components. The following diagram shows the architecture:
The app uses the Eclipse Paho library for publishing and subscribing to MQTT messages on the IBM MessageSight appliance. The app also uses the OpenLayers API for displaying the game map. This is what it looks like:
The Liberty Paintball game logic is provided by a servlet running on Liberty profile. This servlet maintains the entire state of the game, handles events, and provides an API for fetching game information. Node-RED interacts with the servlet via a JAX-RS API to route messages between the servlet and the various MQTT topics on IBM MessageSight. Node-RED also monitors Twitter to detect when a player joins the game, posts game events and statistics on Twitter for players to see, and communicates with the app on each player’s mobile device.
Becoming a sample…
Everyone who has seen Liberty Paintball in action has loved it. It’s simple, fun, and a creative demonstration of lots of technology. So we’re working on releasing the game as a sample here on WASdev.net.
Watch this space for an update when it becomes available!
Now available on Github!