Inspiration

  • My friend group used to use Club Penguin's Ski Hill to settle disputes, but with the site shut down, we wanted to come up with our own way. Inspired by old western shootouts, we created a browser-based, mobile app for a good ole' "fastest gun in the west" duel

What it does

  • Lets you duel your friends as gunslingers, online
  • Your phone is your weapon, ready, draw, and FIRE, all tracked by the accelerometer
  • Connect and sync with your friend across large distances to find out who's the superior gunslinger
  • Determines winner of a duel based on who drew their weapon/phone faster

How I built it

  • Google Firebase used to store data about duels and the players, as well as a beacon to signal WebRTC handshakes
  • WebRTC protocol for peer-to-peer communication between two browser-based applications
  • Accelerometer support in the browser to detect the motions of drawing and firing the phone

Challenges I ran into

  • Implementing reliable communication on top of UDP/WebRTC without sacrificing real-time performance
  • Accounting for difference in permissions and implementations of DeviceOrientation and DeviceMotion
  • Real-time applications can be tricky; we needed the application to accurately determine the winner no matter what latency. This is largely due to our teammates being from different cities across the state
  • Getting sounds to play on iOS devices can be incredibly tricky, and getting WebRTC to work was a challenge as well
  • Calculating the different positions using accelerometer data required a lot of data analysis

Accomplishments that I'm proud of

  • This was the first time that any of our team used WebRTC, and we're proud to have created a peer-to-peer networked architecture
  • Tracking and detecting certain motions (ready, draw, fire) are pretty smooth and natural
  • No merge conflicts in development!

What I learned

  • Google Firebase and serverless design
  • WebRTC signaling
  • How to reliably over UDP (without using the built-in features)
  • Peer-to-peer architectures
  • Multi-platform
  • Device Orientation
  • Device Motion

What's next for Cowboys in Space

  • A computer viewer that relays the duel with good graphics and animation
  • A leaderboard perhaps
  • Coming soon, finding and challenging a nearyby gunslinger to a duel
Share this project:

Updates