Archive for the ‘Social Gaming’ Category

Facebook Week – Day 4

Despite all the frustrations, yesterday was pretty productive. I knocked off the new game features in the morning and spent all afternoon (and evening) learning more about the Facebook API. ASP.NET, Facebook quirks, and IIS bugs made most of the day pretty unpleasant, but by last night everything was working as expected.

The big bug that was at the root of it all was this one. With IIS 5 you can’t POST to a default document. The webserver returns a 405 error instead of calling the document.  The bug is fixed in IIS 6, but you can’t actually install IIS 6… it comes with Windows Server 2003, so that fix is worthless to me on my XP Professional development machine.

This is a real problem for Facebook apps because Facebook puts anything after the application’s name on the end of the callback URL when loading the page.  So if the callback URL for your app “MurderMystery” is “http://somedomain.com/fbcallback.aspx” and you go to the canvas page “http://apps.facebook.com/MurderMystery/SuspectDetails.aspx” it actually calls the callback at “http://somedomain.com/fbcallback.aspxSuspectDetails.aspx”. That’s obviously not going to work.  The usual solution is to set “http://somedomain.com/” as the callback URL instead and let the webserver use the default document if you aren’t loading a specific canvas page. This IIS bug means that you must have an actual document name in your callback URL to accept POST requests.

No problem, I thought!  I’ll just go download a copy of ISAPI_Rewrite and use URL rewriting to work around the bug. That involved an hour or so of downloading, installing, and reading. I’m not much of a web programmer, so I wasn’t really familiar with URL rewriting. Once I figured out how it worked, my rewriting rules ended up being pretty simple.  I have a rule for the default page (to directly work around the IIS bug) and another for each sub-page. This has the happy side-effect of cleaning up URLs by stripping out the “.aspx?mysteryId=” gunk from every URL.

Unfortunately ASP.NET didn’t automatically grok my rewritten URLs. ASP.NET puts a form around every page so it can handle postbacks, and that form has the page’s actual document written into it.  I came up with a hack that got it all working using HttpContext.RewritePath(). It’s not pretty, and makes all kinds of assumptions about the URLs people will be hitting the page from, but it works.  If only the hack didn’t make me feel so dirty…

When I finished up last night I had multiple pages up and running in the app and was navigating between them. The most important of those pages is the one where you actually play the game, and right now that page is empty. Today’s task is to re-implement my game’s UI in FBML. The HTML version is about 300 lines, and all the back-end code will work just fine, so I think I can get that done today.

I’m using FBML instead of an IFrame so that I don’t have to deal with fetching and serving all the images and Facebook profile info myself. It also gives me access to useful controls like the multiple-friend invitation UI. It causes some problems for ASP.NET (controls that use Javascript don’t work, which includes LinkButton) but I think it’s worth the trade-off.  The result will be that the app will be more tightly integrated with Facebook.

Today I hope to accomplish:

  • Get the game-playing canvas page completely working (but probably not pretty)
  • Get started on automatic game creation

If today goes well I’ll probably put the game up sometime tomorrow in a rough form so other people can play it.

Facebook Week – Day 3

Yesterday went pretty well.  By end end of my 12 hour work day I was able to take clues and sources, publish clues, and accuse suspects.  I have the turn-processing mechanism in place, including mystery resolution for Detectives. The foundation is all there to add each of the special abilities for the various player roles, so that shouldn’t take very long.

I doubt that much of what I just said actually makes any sense without knowing more about the game. I mentioned it was a game about solving murder mysteries.  Players accomplish this by investigating sources to retrieve clues. Each clue points toward a suspect, but only the player who actually retrieved who it implicates for the first few turns. There are two categories of players who have largely orthogonal goals: Detectives and Reporters.  Each player chooses a role from one of these two categories when they take the case.

Detectives win by figuring out who the killer was (i.e. finding the suspect with the most clues pointing their way.)  If a detective accuses someone who was innocent, they are off the case (and out of the game) so they have to be very careful with their accusations. On the other hand, an incorrect accusation lets the rest of the players know one suspect who didn’t do it, so they’re useful to the remaining players. When a detective makes an accusation each other detective is given a chance to make an accusation of their own. All detectives who accuse the correct suspect win the detective side of the game.

Reporters win by publishing the most clues about the suspect who eventually turns out to be the killer.  Once a clue is published it’s removed from the game (except for guilt determination) so the reporters are racing each other to see who can publish the most clues about likely suspects. Reporters don’t actually “accuse” anyone, they just publish stories about them, so the reporter side of the game is time-limited by the detective game. At the end of the game the published clues by each reporter are totaled, and the reporter (or reporters) with the most published clues about the killer wins.

Each player has a role from one of those two categories. The roles have a special ability that helps them achieve their goals, but also causes trouble for other players.  The roles from the paper prototype were:

  • Police Detective -  Exclusive access to the “Crime Scene” source. Able to take any public source “in for questioning” to keep other players from using it.
  • Private Detective – Able to steal clues from another player before their exclusivity ends.
  • Medical Examiner – Exclusive access to the “Body” source. Able to add extra turns of exclusivity to their owned clues.
  • Ace Reporter – Able to steal a source from another player.
  • Investigative Journalist – Able to make a player’s exclusive source shared so anyone can use it.
  • Mystery Novelist – Able to publish multiple clues about the same suspect at the same time.

I think those special abilities are going to shift around a bit as the game goes online. The Mystery Novelist’s power, in particular, is too powerful, and some of the detective powers are not powerful enough.

Today’s development goals are:

  • Victory for reporters
  • All the special abilities
  •  The very beginning of Facebook integration

I expect the game will go from “standalone web game” to “poorly integrated Facebook Application” today.  Woot!

Facebook Week – Day 2

Happy Easter!

I have a long history of working on holidays. Back in the BadgerCom days I once spent Christmas Eve working on our online Illuminati game. Unsurprisingly, I was the only one in the computer lab. Since moving away from Colorado it’s been hard to get excited about holidays like Easter.

I didn’t quite get everything on yesterday’s list done. I have the mystery generator working, but it doesn’t write to the database yet.  I probably have an hour or so left on that piece of things.

Now that I have the guts and infrastructure (mostly) done, today should be pretty productive.  By the end of the day I hope to have:

  • Mysteries actually saving to the database
  • Admin tools to view the state of mysteries
  • Enough front end to allow players to:
    • Join a mystery
    • Reveal clues
    • Reveal sources
    • View the overall state of the mystery

I hope to have the game more or less complete by tomorrow night so I can get started on Facebookification on Tuesday.

Facebook Week – Day 1

I’m taking this week off from work… to write code!

I’ve had a Facebook game rattling around in my head for the past few months and I’d like to get it out.  I can’t seem to find time to code while I’m working 60 to 80 hour weeks on Pirates, so I spending a week of vacation at home, in my basement, programming. Does that sound sad to you?  Well not to me. I’m really never happier than when I’m up to my elbows in source code working on something I’m really excited about. As the team at Flying Lab has grown I’ve moved further and further away from the code, and I miss it. Time to reconnect with my roots.

The app I’m working on is a murder-mystery solving “card” game.  I’ve built and tested a few paper prototypes since January. My regular Tuesday night board game group has provided lots of valuable feedback and the game is much better than it was when I started, so it’s time to implement it for real. That starts this morning.

My plan is to post my progress about once a day to document how it’s going. I’ve been assuming that I would use Java plus GWT for high levels of interactivity on the client and a PHP back-end because my current hosting provider (which is run by college buddies of mine) can host it. Yesterday it occurred to me that my plan was kind of broken:  I’m not very experienced with either Java or PHP.  Most of my web programming experience has been writing web-based GM and operations tools in ASP.NET.  So today I’m switching over to ASP.NET.

So far I have:

  • My paper prototype, which defines all the elements in the game as well as the rules
  • A prototype UI in GWT that I’m about to throw away
  • A prototype database schema in MySQL that I’m about to convert to MS SQL

By the end of the day I hope to have:

  • The database schema converted to MS SQL
  • A quickly admin tool that lets me enter data from my paper prototype
  • All the code to generate a new mystery in the database

Wish me luck!

Anybody know a good web host?

I’m working on a project next week that requires a new web host. Anybody out there know a good ASP.NET 2.0 capable web host? Google finds me about a billion options, but sadly can’t tell me if any of them are any good.

Pointers to a site that rates hosting companies would be welcome too. None of the ratings sites I came across looked particularly objective.