My newest game:

It’s been out a few weeks already, but I thought I would make a blog post about it.

Pass the Gun is my latest game. The entire game is played on Twitter. Users shoot and/or pass a virtual “gun” to friends on twitter. Users can earn virtual money by pulling the trigger on the gun (also commanded via tweet). However, if the gun goes off then the user is penalized in score. Users can also pass the gun to friends. Every action is recorded and tweeted in the Pass the Gun user @passthegun. People can use the website to track the guns history and their scores.

  1. When the gun is passed to you, you can either pull the trigger or pass the gun onto someone else.
  2. To pull the trigger, tweet @passthegun pull. If the current chamber isn’t loaded, you will survive and some danger money will be added to your score!
  3. To pass the gun onto someone else, tweet @passthegun pass @theirusername. Once they have the gun, it’s their turn to play, and you may no longer act until you receive a gun later on.
  4. The more times you pull the trigger, the greater the risk there is of shooting yourself in the head.
  5. If you shoot yourself (or wait too long!), you lose half your bank.

The design is still ongoing as people play (i.e. the infamous and indefinite beta stage); however, there’s no way to anticipate anything unless the game is iteratively released and changed. But I’m very happy with how it’s turned out so far. Tim Halbert and I have worked out the design and flow of the game.

I am really excited to see how/if it grows. The entire game is based upon social interaction and viralness; it also uses a medium I believe that hasn’t been tapped.

Tim and I were astonished to find that there are other Twitter games out there; however, what separates ours from the rest is that it takes absolutely no registration to play. You simply tweet the instructions once you have the gun and you’ll receive a @reply (and a direct message if you are following the user @passthegun).

I find this medium (Twitter) very interesting for games. Twitter offers so many affordances that mediums such as Facebook, MySpace, or other portals lack. Every single tweet (from a user with his or her settings set to unprotected) is accessible to the entire world. I don’t think people realize how big of a deal that is and how that separates their “platform” from others.

I think Pass the Gun has a great chance of succeeding because:

  • It’s on a platform with a simple and established API
  • Similar to Facebook, Twitter handles all of the registration, security of tweets, and notification mechanisms. Yet it does so in a way that isn’t intrusive and also easy to stop (if anyone doesn’t want to play Pass the Gun they can simply block the user @passthegun)
  • Anyone can play without having to opt in (i.e. Facebook). All it takes is for someone to pass you the gun!
  • The way the game is set up right now is that only players who have played before will receive a new gun when a new gun is spawned (new guns are spawned when a gun is fired). I think this “invitation” only has lots of potential.
  • The game can scale. As soon as my server can’t handle the number of requests that it takes to check Twitter’s servers every 20 seconds (which is the time interval of check right now, which if I had more servers I could easily decrease), I can just use another server to check.
  • The game is simple! The fiction is relevant (Russian Roulette) to normal users.
  • Guns automatically go off after 24 hours of a user receiving the gun. So inactive users won’t stop the game from playing.

Tim and I thought about this design quite a bit before launching and hopefully handle a lot of issues that could happen. Let me know you want a gun by sending me a direct message to my twitter.

Faster Way to Get a Random Row MySQL

So doing order by RAND() limit 0,1 is pretty slow for big tables. So I came up with the following. Basically it uses the ID column to find a random id number between the lowest id in the table (usually it will be 1 since that’s where auto increment start; however, I lots of times delete these rows during testing and don’t reset my auto incrementer). The only stipulation is that your ID doesn’t have any “holes” – basically if you’ve deleted rows in the middle of your table so that the ID column has a set such as n,n+1, n+y,n+y+1, n+y+2… where y > 1. Example would be 1,2,3,5,6,7. Unfortunately, if you are actively deleting rows in the middle of your database you will have to resync a counter column (either the id or some or column) to fill up the holes… Unfortunately, that’s pretty expensive (sort of like reindexing an array to take off holes… same idea). But maybe you can find a balanced solution. Who knows.

Here’s the code:
FROM ptg_users

MAX( ) – MIN( ) ) * RAND( )
) + MIN( ) AS rid
FROM ptg_users
) AS x ON >= x.rid

Replace ptg_users with the name of your table.