I have been plying the game Dicey Dungeons a lot recently. I really enjoy the game, but there's one thing I find rather irksome: the use of "dice" instead of "die" in singular contexts. I am huge advocate of linguistic descriptivism and accept that languages evolves — albeit begrudgingly at times, and this is definitely one of those times. It bothered me enough that I finally decided to poke around the game files to see if it could be easily changed.
A bit of grepping lead me to the "./data/text/" folder in the installation directory:
$ fgrep -wi "a dice" ... data/text/equipment.csv:Combat Roll,Reroll a dice|[gray](Reuseable),... data/text/equipment.csv:Lockpick,Split a dice in two,1,... data/text/equipment.csv:Lockpick_upgraded,Split a dice in two|On six[;] split into three,... ...
The text files at the root of the directory contain information about various things like attacks and dialog for the default locale which is English. Other locales override this data by specifying their own variants of the files with the same name in the locales directory. For example, "./data/text/locales/es/equipment.csv" contains the equipment information with Spanish text. Since I only play this game in English, those are irrelevant to me. I wrote a GNU sed(1) scripts to change the files. Initially I only changed "a dice," but went through a few iterations after playing the game and realized my changes missed some instances of singular "dice" and settled on the following command:
sed \ --in-place \ --regexp-extended \ -e 's:\b([Aa][Nn]?|[Oo][Nn][Ee]) ((\S+ )*)dice\b:\1 \2die:g' \ -e 's:\b([Aa][Nn]?|[Oo][Nn][Ee]) ((\S+ )*)DICE\b:\1 \2DIE:g' \ -e 's:\b([Aa][Nn]?|[Oo][Nn][Ee]) ((\S+ )*)Dice\b:\1 \2Die:g' \ -e 's:\breroll dice\b:reroll die:g' \ data/text/*.csv
The patterns match "a ... dice," "an ... dice," "one ... dice" and "reroll dice." This takes care of the most egregious instances of singular "dice" I am aware of at the time of this writing. I suspect there are instances of "the dice" that refer to a singular die, but I will fix those as I find them. I do not want to spoil the game by reading through all of the dialog. One notable remaining one is "Throw Dice." Changing this string in the locale text files does not fix the Witch's "Throw Dice" action.
What ultimately fixed this was replacing instances of "Throw Dice" in the Dicey Dungeons binary by running
perl -i -p -e 's/Throw Dice/Throw Die /g' diceydungeons. I used Perl for this because sed(1) is not designed for binary data. There is a space after "Die" in the replacement to ensure the size of the binary does not change since that could potentially break the program by shifting offsets of the data. I subsequently added a complementary script to the sed(1) command (
-e 's:\bThrow Dice\b:Throw Die :g') and also added "./data/text/scripts/diceydungeons/encyclopedia.txt" to the list of modified files since "Throw Dice" appears there, too. I believe "encyclopedia.txt" is used by the Encyclopedia equipment and represents the abilities it can use. I am not certain the equipment works correctly after my changes since it is possible the trailing space added after "Throw Die" is truncated which could lead to it not matching
"Throw Die " in the binary. Once I figure that out, I will update this post.
Update #1 ¶
While playing as the Witch in Parallel Universe, I noticed the text on the Mirror Cauldron was a little off. The first instance of "dice" was not replaced. This is because the sed(1) patterns are greedy, so they match the longest possible string. GNU sed(1) does not support non-greedy patterns, so I opted to use Perl for all of the substitutions. The other issue is that, contrary to what I originally thought, some cards contain "1" written as a digit instead of "one." When I originally saw the instances of "1 dice" in the files, I did not examine them all individually and I thought the matches were directives used by the game's scripting engine. For example, "skills.csv" contains "Refrigerator,Freeze [ice]1 dice,inflict(ICE);". Upon re-reading, I realized that the bracketed text is used to insert certain icons. With this in mind, I tweaked what I had to create the following script:
perl -i -p \ -e 's:\b([Aa][Nn]?|[Oo][Nn][Ee]|1)[ |](([^ ,|]+[ |])*?)dice\b:\1 \2die:g; s:\b([Aa][Nn]?|[Oo][Nn][Ee]|1)[ |](([^ ,|]+[ |])*?)DICE\b:\1 \2DIE:g; s:\b([Aa][Nn]?|[Oo][Nn][Ee]|1)[ |](([^ ,|]+[ |])*?)Dice\b:\1 \2Die:g; s:\breroll dice\b:reroll die:g; s:\bThrow Dice\b:Throw Die :g' \ data/text/*.csv
In addition to making the capture group preceding "dice" non-greedy, I replaced "\S" with a pattern that includes commas to ensure that substitutions in CSV files do not cross field boundaries and added "|" to patterns matching spaces since "|" is used to represent line breaks and is therefore whitespace. The CSV files use "[;]" to represent literal commas and "|" for line breaks, so I do not need to handle escaped characters.
Update #2 ¶
After looking through the mod documentation, I realized mods could change language settings. Conveniently and unsurprisingly, there are already mods that address this. I've opted to use One Singular Die for now. If more content gets released for the base game, I can always use my scripts to fix them before the mod author updates their code.