Under the Hood of the AADL Summer Game

The 2011 Summer Game has brought big changes to the way we play here at the library. In addition to the "classic" summer reading game, players can earn points for writing reviews, adding comments and finding game codes at events and locations. Players also earn badges for special accomplishments. We just passed player ID #4000 and we still have weeks to go for even more players to join and earn points and prizes. The pieces that make up the Summer Game are diverse but by adding custom code to the solid foundations provided by these open tools we've been able to concentrate our efforts on adding new content and functionality rather than chasing bugs and putting out fires. Here's some of the tools and technologies that make up the Summer Game:

Drupal: The aadl.org websites run on the Drupal Content Management System. In addition to giving us a framework for writing blogs, creating user accounts and writing comments, it has a extensive API which allows us to leverage those pieces to add our own functionality. A drupal module for Summer Game was created that keeps track of player data, lets players add points through multiple activities, and displays a leaderboard. Players are attached to user accounts, and a simple function which could be placed in any code that runs the site allows us to award points for any website action. The summer game module is available through github: Summer Game module.

Ubercart: The Summer Game shop runs on this Drupal module that provides a simple shop interface for your Drupal site. Again, it has a extensive API which allowed us to use Summer Game points as a custom payment type. We also added a hook into the order process to send data to our custom label printing function, printing labels for the items at the time of order, and creating custom order emails. By leveraging the ubercart module, we were able to create a complete online shop and order fulfillment process in about 3 weeks, start to finish.

FPDF/FPDI: The core of the Summer Game is still the "classic" summer reading game, where you read books, fill out a score card, bring it to a library location and get a prize. This year we decided to track all our score cards with unique identifier numbers to see where and when people picked them up. We also wanted to allow players to print their score cards on demand as PDF files. The FPDF library allows us to dynamically create each score card PDF with a unique number. We also use the FPDF library to create easily-printable Game Code signs so staff can post a points-accruing Game Code at their events. The FPDI plugin for FPDF allows you to import an existing PDF as a template for your FPDF document.

Redis: Redis provides a persistent data store, similar to a database, but as key-value pairs rather than tables. We used Redis to store the score card identification numbers because it allowed us to do an atomic increment operation. We don't want two people printing score cards at the same time with the same ID number. In a single call we can get the next number in the sequence without worrying about holding other people up or both grabbing the same number. We also use Redis to store our shop email notification data in a processing queue which allows us to delay sending them out. We currently use the Redisent PHP library to talk to our Redis install.

Twilio: Twilio provides an easy API to interact with users via cell phone text messages. By creating a simple drupal module that utilizes the Twilio API we allowed players at an event to easily sign up for the game and start earning points using their cell phones. We also use twilio to send prize pickup reminder text messages when we fill orders from the Summer Game shop.

AADL is happy to share source code. View the rest of our shared code on our github page. Code monkeys not included. Your mileage may vary.




I've been wondering about the technologies being used here! Thanks for sharing the code!

Very Cool

Is there a convenient way to print a list of all the books one has read during the game? I'm one of those lazy parents who didn't keep a separate list for my kids and I know their school librarian wants them... :)

I wasn't here in Ann Arbor when the 2010 Summer Game was done, but I could tell it was awesome. The program seems to have
changed a lot since last year.

what code?

thanks for telling us

It's amazing how much work goes into creating such a wonderful program!

Wow, 90% of this post is completely Greek to me. It's interesting to read how many different pieces are involved to make the game work.


I've certainly been talking up this summer game to friends from other areas. Have you been getting inquiries about the summer game and its infrastructure from other libraries?

I think it's great how this encourages patrons to submit content (I've contributed a lot of reviews, which I probably would not have done without the rewards of this game system), though I worry a bit about junk content. (How many times have one or two word reviews or comments been posted? Lots, if what I've come across is any indication.)

Its interesting to learn about the inner workings

This is awesome! Our school recently had a Drupal workshop and I've been wanting to see some examples of that and other website-creating programs.

I am really like this year's summer reading. Can't wait to start earlier next year.

This has been great!



That's a great idea! We'll make sure to get a "reading report" option added to each player's scorecard as we draw nearer to the end of the Summer Game.

And last year, the summer game was just a piece of paper. Amazing!

Very interesting.... [teehee~ code monkeys..... XD]

I think it's good that now many things in the catalog have reviews and ratings, helping people to make decisions on what to read, but it makes me mad that there are so many one word reviews out there, and that some of the writers of those reviews are on the leaderboard.

This is pretty interesting, I never knew about that.

what is the code! I probably have it any way

Agree with this. I also never reviewed, tagged or rated an item until this game. But the junk is awful. For next year's summer game, it would be ideal if we could eliminate junk reviews. Junk posts aren't so great, either, but I really hate looking at the review section of an item (book, movie, music) and seeing a complete review like, "it was cool". That's not a review, and it clutters up the site.

We use Drupal at work too. Thanks for sharing!

This summer game is great! My family and I are enjoying playing! Thanks for sharing info about the code.

I agree - there are a lot of useless "reviews" that the site could do without.


Hey all you fretters about lackluster reviews or other content... don't worry! That's the web, and WE HAVE A PLAN. And you're all part of it. Stay tuned, as the Summer Game isn't out of surprises yet!

Great to learn how the game works behind the scenes!

Well done! My 2 & 3 year old and I are having fun playing the Summer Games. We look forward to playing in the future.


There is no code, derin. This is telling you the codes involved in making the aadl summer game possible.

Yes, ejk is a programmer, and when he says code he means software code, the programs we use to make the summer game. But wait! If you made it this far, enter the code


for 173 points!

For reals!


This is so cool! I can't wait for the next surprises!

The new code is so funny!

Hah! Amusing new code. I like what is says on your page after you enter the code!

awesome cant wait

I literally laughed out loud (in my office, at work - got some strange looks, too) about the new code. Well done.

Will there be a new blog post today?

Of course, we're working on it now! You might be able to get a head start by perusing the badge page... all this week's new badges are already up there. But stay tuned!


I would like to add that I know some middle-school aged boys who were initially excited about the game, but have gotten a bit discouraged because of what looks to most of us to be cheating. 800,000 points seems absurd - and the fact that most of the people on the leaderboard won't let you see how they are getting their points only contributes to the perception that they must be cheating. We look forward to learning the plan for getting rid of the junk! Maybe that will reinvigorate the formerly-hard-working 13 year olds I know...

Well, it may be hard to believe, and you can't see how they are scoring those points, but we can, and we watch everyone closely for cheating, looking at every tag, review, and list, and we've deleted TONS of stuff and points behind the scenes. Let's put it this way, it's not too hard to get that many points if you're putting in a 12 hour day most days of the week... I know it's hard to imagine, but we're watching, and it's legit. Any game will have its outliers... we've got over 4000 players, and only 1 appears to be uncatchable.

Also, from my extensive experience working with middle-school aged boys in competitive situations, they are usually quick to assume cheating, especially when they're being outplayed. =)


AADL's Summer Games site is fantastic and it is great to see that it is based on open source software. The fact the all the code is openly available on github just adds to the awesomeness. Great job!!

so are you saying that that one player is cheating?

looks like i was wrong. there is a code. :)

You all rock. Nice code, and nice code. lol. I want to work with you guys! Maybe if I teach myself drupal. ;-)

I'm so glad you have talented people that can work behind the scenes to make the magic of the Summer Reading Game work!

tree64, a few players are trying to cheat, usually by making unhelpful reviews or tags or lists. But when we see unhelpful reviews, tags, or lists, we delete them and their points. Most players learn pretty quickly what gets deleted and stop doing unhelpful stuff.

I see. Thank you eli!


loved the secret code - kind of like an Easter Egg that isn't an Easter Egg, but then turned into one :-)

Thanks for the code!


This is quite awesome.


I'm so glad I keep checking for new replies/comments on older posts!

This kinda confused me

Keep up the good work!

To the 13yo boys I know, getting points for writing "cool" on every blog post or "great book" for a book review is cheating - because it's a violation of integrity, and doesn't contribute valuable content to the conversation. There is a certain element of "drat, I'm not on the leaderboard any more", but it goes deeper. Not to mention, none of their parents would let them sit in front of a computer for 12 hours in a day, even if they were spending it writing worthy book reviews!

Maybe it's an adult who is on the computer 12 hours a day.

Thanks for sharing all of the interworkings of the website's technology.

I'm curious if you've ever had a panel AFTER the summer game to talk about how it went and answer questions, get feedback, etc.