This is a game I worked on during the 48 hours of Global Game Jam 2016. The theme for the event was “Ritual”.
Source Code (Git): https://github.com/weis0061/GGJ2016.git
The objective of the game is to drag letters around and spell out as many demonic or ritualistic words as possible to summon demons and earn points.
I did the programming in Unity/C# and modelling in 3DS Max.
Some things I did during the game:
I refreshed my memory on how to give weighted random outcomes.
Weighted outcomes is important because we had a list of 30 or so “demonic” or “ritualistic” words that could be used to give you points. When your word list has 12 occurrences of “O” and only one occurrence of “G”, you don’t want the game to get cluttered with “G”s.
To do this, the pasta’s weight is determined by a human by listing the number of letter occurrences in the word list.
In code, look at WordDetector.cs, line 57, in the function AddPastas(). For every AlphaGhettiWeight struct made in-editor, the temporary total weight is incremented by the pasta’s weight, until the pasta list has been run through. Let’s say there are 116 letters in the entire word list, then the total weight will be 116.
At runtime, a number is generated between 0 and the total weight(this case, 116). A temporary weight is also made, starting at the maximum. We go down the list of weight structures and lower the temporary weight by the weight structure’s associated weight. Once that number reaches the generated number, the current pasta weight structure has its prefab referenced, and the prefab is created in the bowl.
Yes there’s a slightly better way of doing it(lowering a random number until it hits 0), but mistakes happen in 48 hours.
I Thought really, really hard about how spelling a word looks to the player, and how to detect when a word is spelled.
I’m extremely pleased with this solution.
We can’t have the player worrying about the orientation of letters, since the game would be far too difficult, and that wouldn’t accurately reflect what people do with alphabet soup. When we play with alphabet soup, we make the word oriented towards ourselves, but the letters may be at any angle. This fits quite well with how we actually read words.
The solution for the game is to recursively check letters and then perform raycasts from their position, in the direction of the camera’s right vector, but only for a short distance. The recursion continues on collided letters. Each step of the way, the word list is queried to see if the current chain contains a word, and if it does, go back a few letters equal to the word’s length, and take those letters out of play.
A problem could arise where nouns like “SEANCE” and “DEMON” could have an “S” at the end to make them plural, and the game won’t catch the “S”. This is a good thing in disguise, as otherwise, there would be a lack of “S”s since they don’t appear on the word list, and we didn’t have time to make longer word lists.
I have no idea where to find anything about Unity’s built-in buoyancy, so I made my own buoyancy feel, which suits my purposes here and should be more efficient anyway.
Super simple. If the rigidbody is below a certain position, add upward force on it.
Dealing with M and W
The problem with latin and alphabet soup is that M and W are indistinguishable when oriented in weird ways, such as while floating. For this reason, when making the word list, I replaced occurrences of “W” with “M”, and did not make a separate object for “W”. So, the word “WICCA” is actually registered in-game as “MICCA”.