Saturday, December 29, 2007

Yavalath and Teiglith

Readers may have noticed my obsession with connection games this year, culminating in me voluntarily playing Ticket to Ride last night. The more I know about games the more I have to admit that Ticket to Ride is a sweet design and a perfectly decent game. I lost to Scrabblette, by the way. Anyway, that's not the point of this article. The point is that my obsession comes from reading a book called Connection Games by Cameron Browne. That book was probably one of the defining characteristics of my 2007 gaming year.

Somehow late one night I looked up Cameron Browne on the internet and discovered that he was actually a Ph.D. student at the Queensland University of Technology (sound of jaw dropping here) which is the same university that Scrabblette is a student at. And he's in the same faculty. In stunned amazement I stalked him a little further, only to discover that he currently lives overseas and is finishing his Ph.D. remotely. But, it was amazing to find that the author of such a good book used to live in Brisbane, and with a slight twist of fate we would have met years ago.

Anyway, I contacted him by email and just over a week ago Scrabblette and I attended his final seminar for his Ph.D. I sort of assumed his research was on Hex but it was actually on computer generation of (what BGG calls) abstract strategy games. He implemented a rule description language, an algorithm to combine games using a genetic algorithm, and some automatic criteria to judge the goodness of the games. He then generated some games and tested them with real people and with the automatic criteria. The correlation between those results told him which of the automatic criteria corresponded to what people wanted in a game. He then generated some more games. In his seminar he present 4 games generated by Ludi, his computer program.

The games sounded pretty decent to me (in a Hex / Go / Connect 4 sort of way), so I emailed him asking for the rules. So now I present Yavalath and Teiglith, by Ludi and Cameron Browne.

Yavalath

For two players. The board starts empty. Players take turns adding a piece of their colour to an empty cell. A player wins if they make 4-in-a-row of their colour, but lose if they make 3-in-a-row of their colour without also making 4-in-a-row.

Teiglith
For two players. The board starts with a White piece on each edge cell. Players take turns moving a piece to a connected cell (diagonals are not connected). The destination cell need not be empty; pieces may stack. The first player who cannot move wins.

(I think there's a rule that you can't unstack pieces, and presumably that you can't move stacks.)

I'll see if I can get someone to play Yavalath with me. Let me know if you try it.

Monday, December 24, 2007

Recent Scrabble Scores

Hoo boy have I been playing a lot of Scrabulous recently! I've been on leave and have had enthusiastic opponents. I don't know whether it's because of what I learnt from Joe Edley's book, but I've been making a lot more bingos and some poor opponents have been hit with 2 or 3 a game. In one game I got 3 of them and my opponent got 2. My scores from the last 15 games: 309, 398, 393, 374, 373, 394, 462, 321, 409, 359, 451, 289, 334, 343, 377. That's an average of 372, which is about what I reported in November. I've been working on learning the 3 letter words, but there's lots of weird ones in there. FUB FUD FUG FUM.

Call Me "Deacon Blues"

They've got a name for the winners in the world,
I want a name when I lose.

They call Alabama "The Crimson Tide".
Call me "Deacon Blues".

Scrabblette 368 Friendless 295

Scrabblette 353 Friendless 339

Scrabblette 351 Friendless 343

Scrabblette 369 Friendless 356

Scrabblette 377 Friendless 339

Scrabblette 505 Friendless 301

Sunday, December 23, 2007

A Labour of Love

No, this is not another post about Kevin Rudd. This is a post about Facebook.

A few months ago Aldie asked for testers for his Facebook board game app. Of course I joined Facebook to see what the story was. I found a few people that I know there, so I hung around for a couple of days adding friends. Somehow I started playing Scrabulous, and that was when I realised what a great site this really was. I was playing Scrabble against people I didn't see very often (because they lived in London, for example) and with people who never had the time for a proper game (even though they lived in the same house, for example). I' ve played 47 games of Scrabulous so far.

So I realised Facebook was a great site for playing games against friends you just can't get to in real life. And other games, as well as Scrabble. I decided to write my own. To avoid copyright issues, I decided to write Hex.

Of course, I had no idea how to. I didn't know whether Aldie had written his app in MSVC or Java or Flash or what, and I had no idea how it got deployed on Facebook. But that was the fun part. I was pretty sure that I could program it, whatever it was. Besides, I wanted to know about this Web 2.0 thing Yehuda was into.

I did some research and found out that Facebook apps are very clever indeed. You write your application as a web service and Facebook delegates requests to your app on Facebook through to your web server. So you can write your app in whatever you like and you host it on your own machine, so Facebook doesn't care about your database maintenance or CPU or anything. It just cares that your app responds to requests. I had used Apache in the past, so I installed it on my home machine. I also wanted to write my application in Python because Java bores me sometimes, so I installed mod_python (lets you write Apache services in Python) as well. I already had Linux and MySQL running, so I'd finally got myself a complete LAMP stack.

I couldn't even get the test example going! I did everything it told me to do and it just didn't work! It was very frustrating! It turned out I was running Apache 1.3 and reading the Apache 2 documentation. You can see at this stage that I didn't know much about what I was doing.

Then there was the Facebook API. It talked all about authentication (yawn) and making requests to the Facebook server. I really struggled with how that was relevant to me. I googled and found something called minifb.py which was Python code for doing Facebook stuff. All of the Facebook doco refers to PHP which I don't speak. minifb did more authentication stuff, and I still didn't get it. Eventually by following examples I figured out what I was supposed to do, and I loaded a Facebook page which made a request to my web server. A small victory, at last.

I've glossed over a few things here. Firstly, my ISP gives me a dynamic IP address, so whenever that changed I'd have to go to Facebook and reconfigure my app to point to the new address. A mate at work told me about dyndns.org which provides DNS services for exactly my situation, and I figured out that my router supports it. So now whenever the router is restarted it connects to dyndns.org and tells it that friendless.servegame.org is at this new IP address now. It's very cool. I also had to deal with the network security - our router was configured to not allow any requests from the outside to come into our home network. I had to tell it to route requests for the HTTP service through to my desktop. Not that hard to do, but tricky to realise that you have to do it.

OK, so we were at the "one request got through once" stage. Nothing got any easier. Facebook uses HTML, but it extends it with FBML (Facebook Markup Language) which implements all of the cool widgets that you use to invite friends to do stupid stuff. So I needed to learn a little about that. I also needed to figure out how I was going to implement the user interface. JavaScript looked pretty handy, so I learned that as well.

JavaScript really is pretty cool. You can do all sorts of programming on the client side, and with AJAX you can even make calls back to the server from within the web page. Without worrying about the Facebook thing, I coded up some JavaScript to render the board in the web page, figure out which cell the user clicked on, then make an AJAX RPC back to the server to make the move. It took a while, but it was sweet. After I got it going I hooked it into the Facebook code, and Facebook said "JavaScript not allowed". They're afraid you'll hack around with there HTML and corrupt the site experience.

Well that was a wasted week! It was fun, but ultimately got me no closer to having a working game. I experimented with many solutions. I knew that Scrabulous used Flash, but Flash is not free and I wasn't particularly motivated to learn it, so I couldn't copy from them. My goal was to do as much work as possible in the client, but as JavaScript wasn't allowed I couldn't see how to do much at all. I probably could have written a Java applet (I mean, I know I could do it, I just don't know whether Facebook would allow it), but even I understand that users don't want to install Java.

This was all complicated by the fact that I couldn't get Facebook to display my images. In fact, I still can't. Any image included in my app has to come direct from my web server - if it goes through Facebook its gets interpreted as text. Yes I'm setting the content type. I still don't understand that one. I have another app in progress using the Django framework and it does the same thing. So I had to solve the client technology problem and the image serving problem at the same time.

The solution I eventually came up with was to generate the board image on the server side, serve it direct from my own machine, into a HTML form, so when the user clicked on a cell it would send me back the (x,y) coordinates of the click. I could then convert that back to a cell on the server side. Nothing at all happens on the client, but at least it seems to work.


I got the game basically working. The code about detecting wins and so on was EASY compared to all of the technology nonsense. The game requires two real players so there's no AI involved. However them I needed to add some of the bells and whistles, for example, notification to your opponent that you've started a game.

That was when the authentication tarrasque bit me. You see, Facebook has this completely sensible system where your page is treated as a form with lots of hidden fields. Some of those fields, e.g. user id, Facebook session id, and so on, come from Facebook and tell you Facebook stuff. Those fields are digitally signed and you use your application secret to check they're kosher. EXCEPT, if you have a form on your page like I do, it sends some of that stuff twice, and digitally signs it twice. So you have to figure out what is authenticated by what signature. I ended up changing minifb to deal with it, because of course I was the first person to use minifb to receive a form submission and nobody else cared that it didn't work.

So after I figured out authentication I was able to get the session key which allowed me to send notifications to the server. At the moment I send a notification only when a game is started, as if your application sends too many notifications in one day your application gets classified as spam. Given the spamminess of many Facebook applications, the fact that they monitor that is a good thing.

Anyway, it's all sort-of working. I need some users to try it out.

http://apps.facebook.com/hexgame/

Please.

Lightning Strikes Twice

Only twice in Unspeakable Words have I played a word worth more than 20 points. Both times I have rolled a 20 so I didn't lose sanity. It's a good strategy if you can pull it off.

Maria, you should get that game.

Monday, December 17, 2007

Another Classification For Games

I've been thinking for a long time about a classification for games that are missing from BGG. It's somewhat underspecified which is part of the problem, but it's to do with the role the game plays in your collection. There will be some consensus on this, which is why it might belong on BGG (like the weight ratings). Particular values of the classification might be:
  • Filler - a light game to be played while waiting for others to finish. Examples - Coloretto, Bluff.
  • Capital game - a serious game that is one of the reasons you play games. Examples - Age of Steam, Domaine.
  • Kids' games - games you mostly want to play with kids. Examples - Gulo Gulo, Bratz Mall Crawl.
  • Gateway games - lighter games you play because your opponents may not see the fun in a 3 hour session of Age of Steam and you don't mind playing them. Examples - TransAmerica, Ticket to Ride.
  • Two player games - games you mostly play because your partner will play them with you. Examples - Lost Cities, Lord of the Rings: the Confrontation.
  • Two player abstracts - traditional abstract games. These get their own category because they can be treated very lightly or very seriously depending on how good you are at them. You might play them against your partner or you may compete internationally. Examples - Chess, GIPF.
Are there other classifications? Be careful not to veer into the realm of BGG categories when thinking of new ones.

There are lots of connections between the classifications. If your partner is Scrabblette for example, two player games and two player abstracts are very closely related. However Asterix and Obelix is plainly in the two player game category. And for a lot of people, gateway games and capital games have very strong overlap.

When I look at my games played tally I think to myself that it's only the capital games that really count - St Petersburg, Amazonas, Trias, Domaine - the games I really love that get me thinking. That's not to say that I don't enjoy the others, but those are the games I'd rather be playing, and I think the amount I enjoy a games session is related to how many of those games I play. The difficult part of course is finding opponents who share the same capital games as you do.

Wednesday, December 12, 2007

New Year's Ambitions... Planning Ahead

Having achieved this year's ambition of getting my Friendless metric up to 1, I've been thinking about what to aim for next year. The ultimate goal of course is to have a game collection that I'm happy with, that fits in my house, and that I enjoy playing, but I really think to achieve that it has to be consciously managed. So, my ambition for next year is to halve the number of games I own that I've played 0 or 1 times.

That can be either by playing them or by dumping them - either way is fine! As I have leave now and not at the beginning of next year I'm making the resolutions now. So the resolution is to decrease my zero plays to 25 and my single plays to 40. Also, I plan to continue to increase my utilisation to at least 55% (currently 47.33%), but that should happen anyway if I achieve the first part.

Yes, gaming by metrics is silly. The art is in designing metrics that encourage good behaviour.

Got a Bit Bored

I'm on leave. Can't you tell? Actually I like jigsaw puzzles, and I thought I recognised the picture in this one.

Sunday, December 09, 2007

Balance of Trade

I had a session this morning where I went through and put some games up for trade, and also added a lot that I would like to receive in trade. If you're in Australia it might be worth checking for trades with me. After sister gets back from Cuba (don't ask) I'll be doing a bit of a cleanout of the trade pile in preparation for a general improvement of the game collection next year.

Saturday, December 08, 2007

Local Warming

Last night we hosted the Gathering of Friendless Episode 8, "Local Warming". We had six players - all the usual suspects and the kid. As we weren't sure what time everyone was arriving we played a quick throwaway game which CyberKev had to teach several times as everybody inevitably arrived just as the rules explanation was almost complete again.

The game was Throwing Golden Sevens which is one of Reiner Knizia's dice games from "Dice Games Properly Explained". Basically you roll 3 dice, and you're trying to minimise your score. Any number of dice which add up to seven count as 0. You can reroll any, all or no dice twice. Scoring high is bad, as when you reach 21 you're eliminate from the game. It's somewhat a game of luck, but also somewhat a game of maths. If you roll 1, 2, 6 on your first throw you could take the 2 points, (6 + 1 is 7, which counts as 0), or you could roll the 6 again hoping to get a 4. If you get a 4 you're better off, if you get 6 you're the same, if you get a 5 you score 1. Other rolls are not as good, but you're still scoring 6 or less (though 6 is quite a lot). As the game progressed players were eliminated due to blowouts - Hubertus scored a 14, Kevin a 16, Scrabblette a 9. I hung out to win, but it was noted that I had had a turn less than everyone else.

We then progressed to a serious game, I'm the Boss! This is one of the very few "fun" games that I really enjoy. The kid started by being a hard-nosed vindictive bargainer, and fairly soon people were refusing to trade with him. He needs to learn about the velvet glove and the big stick. CyberKev somehow got into his head that Jane was losing and Scrabblette was winning, so directed his deals towards Jane at Scrabblette's expense. Sadly, he was wrong, and managed only to give the game to Jane. At the crucial part of the game I was left holding some quite useless cards and couldn't make much of an impact.

CyberKev had brought Rumis+ (the 5-6 player expansion for the German edition of Rumis, which I have), so we tried that. This is a very good game, but with 6 players crowding to see the board from above I began to feel claustrophobic. Through some good management and some good fortune I saved some easy-to-place pieces till last, and was the only player to place all of my pieces and managed to win comfortably. I do like Rumis, though I sometimes feel I succeed because other people make mistakes which help me.

Hubertus and Jane had to leave to get up early, so we had 4 players and brought out TechnoWitches. I played this once about a year ago, and I was very bad at it, and this time I was no better. CyberKev parked his broom in front of me and I was unable to move. I should have thought my play through a bit better. BTW, we play that if you crash into something on your first move you MAY discard your tiles. The official rules say that you do not discard them, which is an awful problem if you crash into a castle, or into a witch who keeps crashing into a castle. Anyway, while CyberKev and I went nowhere Scrabblette and the kid headed off towards the cat. The kid was very close to the cat before I even crossed the start line. He won easily. Scrabblette was a close second, and CyberKev and I played on for third place. Showing that crime never pays, I pushed the evil blocker into last place.

The evening ended with a couple of games of Unspeakable Words while the kid whined that we never get to play Star Munchkin, or Battle of the Bands, or some other thing I don't need to play very often. Scrabblette won the first game, as she always does, but I did beat her in the second game - for the first time in maybe a dozen plays. Woohoo!