The players have three minutes to find all the words they can. Words are scored based on length and if multiple players find the same word it scores zero points.
There have a few interesting problems to solve when creating this game:
- I needed a dictionary of words so that I could have an AI player and automatic spell checking. I ended up using Wiktionary (I’ll talk more about that in a later post) to get a list of words and their definitions. This ended up being a 9MB file. Torque has a zip library built in, so I can deliver the file zipped and load it at run time. To prevent a lengthy load time for the game, I created a second thread for loading the dictionary.
- I needed a way for the AI to play a realistic looking game. This kind of game is trivial for an AI to solve. With a dictionary and less than a second of computer time, it can find all the possible words. So the key is to limit the computer in a fair way. The total number of words that can be found on a board varies a lot, so the computer is limited to scoring some fixed percentage of the maximum score. The percentage is set between 5% and 30% depending on the AI difficulty selected. I also wanted it to pick “normal” words instead of words that the human players wont recognize or know the meaning of. So, using the definitions in the dictionary, I build a table of word frequency. Then, when the computer is picking which words to use, it starts with the most common words. Finally, if you have two computers in the same game, they can’t pick the same words or they would both score nothing. But they also can’t pick entirely different sets of words since that would look unfair. So, as each AI picks words, there is a 50% chance of each word being selected by each AI.
- Finally, I needed to build a scrolling region to display the words. The torque game builder has some built in GUI components, but we don’t use them because they don’t interact well with the rest of the system. So I built a scrolling region to display the words that each player finds. William suggested the Android convention of using a fade region at the bottom or top to show where words are being hidden:
The game is getting close to done. I still want to add an option to change the scoring so that multiple people can score the same word. And I still have some play testing to do to figure out how difficult the computers should be. This last part is more difficult because I am not very good at this type of game. To make the example above, I had to get help from my AI to find enough words to get the scroll effect to appear.