We've seen a lot of new interest in the AR games department spurred on by the success of Pokémon Go. It's proven, given something fun enough, people want excuses to go outside and explore their neighborhoods with friends and strangers alike. Defusal Squad hopes to offer a way to do just that!
What it does
Say you and four friends are outside and decide to spin up game,
Player 1 goes to the website under the 'start game' screen. Fills out their name and a name for thier game room for others to connect to (herein referred to 'room name'). Currently hard-coded is a distance of about 0.1 mi for ease of testing, but in the future, this is also where player 1 would select the size of the geofence for the game.
Players 2-4 (there's no limit on the people, you can play with 1 to n people as long as as you select an area large enough for larger number of players) go under 'join game' and fill in thier player name and player 1s room name. In the background, this is making use of socket.io's rooms feature, which creates a web socket for every client and assigns all client to that room, so everyone in the room can recieve updates at the same time.
On the game screen, you'll the info displayed up top (check screenshot) along with a toggle for map / chat. We incorporated Twillos IP Messaging client. There's one assigned to every room where the players can talk about the current mission. I had a little trouble making a seperate one for every room, so for now, it's a global chat for all sockets.
Step 1 of the game is to find the bomb. It's hidden somewhere in the entirety of the selected geofence area. There's no time limit, and the server sends you messages letting you know if you're getting hot/cold through the twillo ip messaging service (it's tied to player 1s geo location).
For the demo, this is all I was able to get to and you'll see a winning screen when you find the bomb, but the game has another major step.
- Once you find the bomb, a timer is set of, and the big geofence is split into a random number of smaller zones depending on how many players there are. N players equal (n-1) / 2 Max zones. Because of the short length of the timer, players have to split into teams of 2-3 and hunt in thier smaller zone for a fragment of the key code which defused the bomb.
Player 1 has to enter the codes into the bomb (which can only be done in the proximity of it). Other players message their codes through Twillos built in chat after they find themvand communicate with the rest of the team to help solve future puzzles.
- Either you defuse it in time with good team work and win, or it goes boom!
How I built it
- W3C to fetch and monitor player locations
- Google Maps to draw on map for player and item locations
- SOCKET. IO to handle concurrent connections and allow multi-player
- nodejs for backend deployment
- materializecss components to give me a working if ugly front end.
- the server itself is hosted on aws to allow it to scale with more concurrent users
Challenges I ran into
Socket.io docs left a lot to view desired. Also as I was working alone, I had to stay up for close to 30 hours working on this fixing bug after bug. I had to stop the demo short of the second phase because of time and also because of getting timer objects to work out in node and assigning them to rooms.
Accomplishments that I'm proud of
First multi-player game I've built!
What I learned
Learned a lot of sockets and used non get/post to communicate to server for the first time.
What's next for Defused Squad
Built custom sized geofences when starting a game, allowing games to be block wide, campus wide, city wide, etc
Make there be puzzles for attaining the key codes, instead of giving them by proximity
Incorporate persistent redis store instead of using a hack in memory dictionary to allow for better scalability
Make the timer be dynamically set based on the size of the geofence, like x minutes based on number of zones and distance between furthest zone and bomb. Allows to scale to do cool things like state wide / country wide games that might last days / weeks.
Add in AR support using the camera to 'see' the bomb and keys.
Allow players to see public games where if a bomb has been found nearby (player set up a lobby and is hunting for bomb) they can hop in.
Maybe build native apps for iOS/android? Currently built on js web view which is easy to deploy but essentially a website and people like apps more.