Monday, May 28, 2012

Of APIs and Men

A little background here, if you will.

When I first began my undergraduate degree, I proposed an overly ambitious game design project called Superduck Racing for an intro-level course. Superduck Racing was going to be an old-school Mode 7-style racing game. One part of my project proposal would be that the courses in the game would be affected by weather, such as wind and rain. The only trouble, at the time, was that I had absolutely no idea of how this could be accomplished.

Now, though, I'm a few years more experienced and a few years wiser, and I can see that for a theoretical future version of Superduck Racing would employ my latest design heartthrob, APIs. APIs are used to bridge the gap between the vast treasure trove of information on the internet and applications that developers like myself would create. APIs run the gauntlet, from the Associated Press, to Yahoo! Weather, to Twitter.

It's really staggeringly simple to use these powerful tools. For instance, if I wanted to set a Superduck course in, say, Hveragerði, Iceland, then I could access Hveragerði's weather by making this request to Yahoo from within my application. From there, I can parse out that the wind speed in Hveragerði at the time of this blog post is 2 mph, blowing southwest. From there, having that information, it's really straightforward to incorporate it into the actual application as the player experiences it. And, just like that, we've tackled the problem that so flummoxed me as a college freshman.

I mentioned on my website that I made use of the Twitter API when developing Daniel the Squire for my senior project. Specifically, one of the dungeons in the game makes a query to determine what the most recent tweet containing the words "games" is. From there, it analyzes the tweet using a highly unscientific algorithm to determine how "angry" that tweet is, and then scales the difficulty of the dungeon accordingly. This sort of technology really excites me. When adding the Twitter functionality to Daniel the Squire, it took just an afternoon's worth of work to change the game from an isolated single-player experience to one that draws on the thoughts and frustrations of an entire online Universe to build the game world.

And that, I think, is really neat.

No comments:

Post a Comment