Trying to make AI fun
Written by miechu   
Thursday, 28 July 2011 00:00

Being an experienced Game AI programmer I'm well aware of that AI in game needs to be above all fun. Intelligence is optional. In fact, having an AI opponent that makes no mistakes and reacts in milliseconds is not fun at all (well, not for the most players anyway).

Frosties gives you an option to play against AI. Making AI fun in Frosties was not at all a straightforward process - not that I claim it's as fun as possible, but does a good job at tutoring and making you think. Let me tell you about iterations I did while creating AI for Frosties.

Frosties is a kind of game you can write an unbeatable AI for. [Warning: geek talk] It's game tree is shallow enough you can write a full Mini-Max on it and get [geek mode off] unbeatable AI. This is not fun. But still "hard" AI in Frosties does some deep search so it's very tough to beat. Possible, but though as hell - I haven't managed to beat it ;) But this is the easy part - how to make a fun "easy" or "normal" AI is the tricky bit!


Hard AI kicking my butt 

I've started off by making "easy" AI pick the worst possible move. I've found it amusing to use an old and respected AI technique to find the most wrong choice ;). It worked like a charm - it was impossible to loose against it! And it was not at all fun :( 

Next iteration: do worst move with some probability, otherwise pick the best move available at the moment. Result: inconsistent behavior :( If you were lucky you beat him badly, if out of luck - high chance of loosing. It's not a good property of easy AI ;)

While looking for a solution I accidentally stumbled on  info on how game Greed Corp managed its AI difficulty levels. Not getting too much into details it boils down to picking the best possible move for "hard" AI, not the best one, but still good for "normal" and the worst one from a set of good moves for "easy".

And that's what I did. I've modified finding best move algorithm to retrieve not one but best three moves, and use the second best for "normal" and third best for "easy". This results in AI not doing totally stupid things and occasionally surprise player by scoring decent points.

So while looking or ways to implement "easy" AI I've also found a solution for "normal"... Almost. Using above solution "normal" AI was doing better than "easy", but was too easy, and was doing many obvious mistakes. But I've handled it with a bunch of special cases. Now "normal" is a bit challenging to a point you need to pay attention what's going on on the screen, otherwise you'll loose.

And no, I won't tell you the special cases - find out yourselves :P 

 

Add your comment

Your name:
Comment: