Enter the story game.

The latter part of this weekend and memorial day were spent debugging the PHP/Ajax story game I wrote about earlier. Why all this debugging you may ask? Well, as insta had put it, I dove in way too fast. I decided that I should move everything over to MySQL and custom database session management. This promptly led me to the brink of insanity and nearly giving up the project entirely. Well, while I have gone insane, I didn’t give up, and sure enough – last night I actually got it working.

Yay! This switch to a database backend has given me the control I needed to implement some new ideas from the past week. After some more MySQL tinkering, and throwing in some JSON magic to pack several variables into one refresh request, things are actually starting to look pretty cool.

For one, you’ll notice a new realtime user counter on the right hand side of the page. This is updated periodically along with the story. You’ll instantly know when people come in, and the counter will decrease once sessions time out. Also, with the added session monitoring capabilities added by MySQL, I’ve switched the refresh data from containing the full, complete story data to incremental additions. This should seriously speed up the transfer times, and make it scale much better as the story gets longer.

Since I was on a roll with this JSON stuff, I also added a variable to monitor whether or not the user has posted the most recent word. This allows me to gray out the input boxes when not available, making the user interface a lot more reactive and intuitive. To top it off, I am now utilizing the very awesome Fade Anything Technique to do those neat Ajax-y fades in the story and the user counter when information is changed.

Try it out and you’ll see what I mean. With these new changes I think this app is really starting to show promise. I’d love to have some feedback on the general feel of the thing and any feature requests. Right now, the next two items on my list are colored underlines to differentiate senders, and an adaptive “smart” refresh timeout to maximise responsiveness and minimize my bills over at NearlyFreeSpeech