So, recently I have been pretty obsessed with the game Boggle. I have a friend who is really into it and he keeps getting me to play. Because of how much I’ve been enjoying it and my desire to use the Starcraft 2 level editor I decided to remake Boggle within Starcraft 2′s editor. I didn’t spend too long on this project as most of it was just getting used to some of the tools I had never used within the Starcraft 2 editor before. My biggest disappointment from a personal standpoint was that this project was almost entirely menu-based and I didn’t get to spend any time working with the terrain tools or using actual units.
One of the most interesting challenges to deal with while developing this was to get the board working like an actual Boggle board. Specifically, I wanted to make sure that only boards you could actually get in the current version of Boggle were possible in this game. I wanted to do this because it’s important for the feel of the game that this be accurate. In Boggle every single die has a different combination of 6 letters and because of the way the game works this means that the words you can make in an official Boggle game are limited in a very specific way. I felt that making Boggle without making sure it functioned in the same way as the actual board would be less interesting and less appealing to players, so I made this a priority.
To get the board working correctly I created a 2-Dimensional Array which is 16×6. Each of the X slots in the Array represents one of the dice from Boggle, and each of the Y slots represents a side found on the given die. The exact letters on each die are hard coded based on the actual dice in the game. To populate the game board I look at each position and then randomly assign a die from the array to that spot with a recursive function that continues until every spot has a unique die in it. Then, the system goes through each position and randomly selects a side for that die to be on by taking the die number as the X position within the array, and a number between 0 and 5 as the Y position which represents which side of the die that is showing.
The biggest challenges I had to deal with while working on this were all related to importing and accessing the dictionary so that the system could look up words and give the player points for valid words. To get the dictionary working I ended up using a system called Banks. Banks are the tool that Starcraft 2 maps use to save user data. The idea is that if you have a map where the player has a persistent character that can be loaded whenever they open the map, or a story which the player can progress through over multiple play sessions, then you can use Banks to store the player’s information. It’s also not uncommon to use Banks to track high-scores in arcade-style games. While I was able to use Banks effectively within my level as the dictionary to find words in, there were a couple things I had to get past, and some issues which can never be resolved due to limitations of the Banks system and Starcraft 2 itself.
The first issue I had was actually getting the dictionary into the Banks. The problem here was that the Banks were limited in size and couldn’t have too much information in them and the dictionary I was using was almost 30,000 words long. To solve this issue I broke up my dictionary into sections based on the first letter in the word. This greatly cut the size I needed each Bank to be, and made it so that when the player tries to submit words the system can check the dictionary more easily since it can use the first letter to greatly narrow don the search.
The next issue I hit was actually putting all of the words into a Bank. Banks in Starcraft 2 have a very specific formatting, and getting all of the different words in would take far too long if I had to do it by hand since every single word would have to be its own entry within the Bank, and every entry had to have a number of characteristics which made it unique from every other entry. To solve this I created a simple program with C# that would take in a txt file that had the full word list in it and then spit out a number of files with all of the correct formatting applied. Essentially the program looked through each line of the dictionary txt and appended the appropriate information to the beginning and end of each word so that it could be understood by the Bank system in Starcraft 2. This was a strong solution and also meant that I could easily add more words to the dictionary if I needed, as I could just modify the tool to append to whatever dictionary it was editing, rather than re-write it. From here I simply modified the file types so that they were what Starcraft 2 could take in, and created the Trigger system which would actually access the Banks and look through them when the Player submitted a word.
This was a relatively successful system and I wanted to publish the map, but sadly this is where issues started coming up. As I said earlier, the Banks system is intended primarily for storing user data about high-scores or character stats. Because of this, there is no system in place that allows you to attach a Bank to a map when you upload it to the Starcraft server. Since Banks are supposed to store personal information only, the expectation is that your map will create a default Bank for the player if they have never played it before. The problem here is that the dictionary I was working with was relatively big and if you tried to hard code every word into the system so that it could build the dictionary for the player you would hit the complexity limit of Triggers within Starcraft 2. In this case this was a fatal flaw. The thing about Boggle is that it only works when you can use any word you can make, and if you start cutting down the size of the dictionary that is no longer the case. I attempted to work with other systems within Starcraft 2 but the problem of Trigger complexity persisted. No matter what system I used, I found I had too many words in my dictionary to bring them all in and thus the only way to publish would be to cut out large portions from the dictionary.
Since I knew that this map was by no means something the Starcraft community was excitedly waiting for, I decided I would rather have a final map which was a strong recreation of Boggle then one where the dictionary was so limited it wouldn’t be fun to play. Sadly, this meant I couldn’t publish my map. Despite this I still got a lot out of the experience, and learned a decent amount about the Starcraft 2 editor, so overall I consider it to be worthwhile.
If you would like to see the map in action you can check out the video above, or download the map below. The map files include all of the necessary Banks and simple instructions on where they should go so that they can be accessed correctly.