Jumps Background Race Background Turret Background

Blog

This post is part of a series about making a Facebook game from scratch in one week. Go read the Overview to find out more and see a list of all the posts.

Facebook Integration

I must say, the Facebook Graph API is a lot better than the old one. However, the official Python SDK is really bare-bones, and could use some nice convenience functions. Despite the fact that there is some good documentation about how to get your app authorized, the canonical way seems to be to use JavaScript. I wouldn't normally care, but the way the login system works, you have to get the user to click on a button in order to show a pop-up to them. I don't want that. I want the user to go to the address of my game and automatically be asked to approve it.

That's obviously still possible, but it took longer than I felt it should have. And there are a lot of little caveats that are buried deep in the docs, if at all. Things like the fact that your app is no longer authorized to do anything once a user signs out of Facebook. You have to ask for the special extended permission "offline_access" to do that, but I thought it would just be a part of authorizing an app. I'd wager most end-users have no idea what the difference is.

At the end of a solid 8 hour day I had my app getting authorized the first time, but there's still a lot of bugs around getting re-authorized for users that come back. I did find some good reading about the new process, and I'll use that to hopefully get things up and running tomorrow.

If you're not using FBML but want to use advanced features, then you're forced to use the Facebook JavaScript library to load up XFBML, and it is the slowest thing I've ever encountered online. It's probably my biggest complaint about this whole process. I got invites working (something the JavaScript SDK should support natively) and the request to Facebook to process the XFBML is regularly about 55 seconds. That's just not acceptable at all. Luckily, there's a way to force FBML for a single page, and that will probably speed things up. I'll try that out tomorrow.

Unforeseen Consequences

Throughout the course of integrating Facebook I've had to change the model a lot. Battles now have a join table for keeping track of users' stats, and I've added "elements" to users and powers, based on Facebook data. This should make the battle system a little more complex, and interesting. In order to keep things balanced with these changes I had to add another set of 3 powers. So we're up to 27 powers. That's 9 categories of 3. And 6 of those are elemental based now.

Daily Wrap Up

I didn't get nearly as much done today as I wanted to. Facebook integration is slow-going, and difficult to debug. It would really help if they had clear, concise examples on how to do exactly what I want, but that's probably a pipedream. I'd settle for a easy to use sandbox mode.

Now for some stats about Day 4:

  • Working Time: 8 hours
  • Number of Commits: 5
  • Total Number of Files: 59
  • Total Lines of Code: 1513

Update: Go on to Day 5.

Webmention Endpoint

Sections

Stay Connected