Dungeon of Doom: Localizing C# Console Game

After a semester of C#, we localized a simple C# console game about dungeons, monsters, and adventures!

GitHub link: https://github.com/Lin-bg4bza/DungeonOfDoom


What’s New Pussycat?

Loot system

What kind of dungeon game is it if there’s no loot system? What would be the point of defeating monsters and advancing further in the dark underground world? Therefore, I added a loot system to the game where everyone the player defeats a monster, there’s a chance of dropping loot.

Below is a list of what was added!

Potions

Regular Items

Legendary Items

Health Potion
+5 health
Health Elixir
+15 health
Bandaid
+2 health
Poison Potion
-5 health
Fatal Poison
-20 health

Blizzard Flame
+3 dmg
+2 hit
Odin’s Eye
+4 hit
+1 block
Dragon Tear
+2 dmg
+3 hit

King of Internationalization
+2 dmg
+8 hit
+3 block
Armor of the Titans
+3 dmg
+2 hit
+8 block
Crown of Destruction
+8 dmg
+3 hit
+2 block

Both item.cs and potion.cs are made from the weapon.cs file created by the original author. For potion.cs, I deleted most entries and added heal and dmg to calculate the effects of the potion on the player’s health.

Potions and items have two separate .cs files because even though they both belong to the loot system, potions are automatically used while items are equipped.

And now, what we’ve all been waiting for……how does the loot system calculate the drop rate?

As you can see, this is a pretty straightforward and simple drop rate calculation. With more time, I can definitely add levels to the monsters and correlate the drop rate with the monster defeated, so the higher the monster’s level is, the higher the drop rate of rare items will be. That would be a fun little project to work on, but sadly I did not have enough time to work on that.
One thing I struggled with was setting up the random percentage generator. I read some sample codes online and used one of the more self-explanatory ones. I’m sure there are better ways to do this, but I’m happy with the result.
Another mechanic I wanted to implement but eventually gave up was to ask the user whether they wanted to equip the item or not. The code shown above is embedded in a much larger switch() statement that reads the player’s key input. It would be a lot of trouble to break this part from the rest of the switch() statement and give it its own selections, so I didn’t. In the end, what I did was that if the dropped item’s rarity is lower than the item equipped, the player will automatically discard it, else, the player will equip it, even if both items are legendary items.

New weapon, monster, and race

The game originally had 3 types of monsters: rabbit, gorilla, and vampire. Both rabbit and gorilla have two versions: fluffy and not fluffy, demonic and standard, with different stats. The vampire’s stats are determined by a random time generator, if it generates to “night”, the vampire will be stronger, and vice versa.

A newly added monster is the zombie. Similar to the rabbit gorilla, the zombie comes in either a single zombie or a flood of zombies. This was the first thing I added to the game, so it wasn’t very creative. Maybe when I have time in the future, I can add some features like infection or bleeding damage.

To add some fun to the game, I added one new weapon and one new player/race, more like an easter egg and a tribute to the class.

Race: Localization Professional
Default Weapon: The Power of C#

And did you notice this little eastern egg from the codes in the loot system sections…?
I thought about adding a bonus drop rate if the user selected localization professional as their player, but I got too lazy and ended up not doing that. Still, there’s a very good chance of you getting this item, maybe even more so than the other legendary items…?

Localization, How do we do it folks?

Extracting Strings

Since this is a typical C# console program, we used the good-old CultureUI and resource files method to localize the program. The program consisted of two C# programs: Dungeon and DungeonLibrary. Therefore we had to create two resource files.
The hardest thing about extracting strings from the program is that there was a lot of formatting. Almost everything string started with a $ symbol or \n and \t all over the place. At first, my method was to put line breaks in the resource files by using shift+enter, but I soon realized that this is not a bullet-proof way of approaching localization, for translators may accidentally delete the blank line breaks. So I went back into the files and hard-coded all the line breaks and tabs so that no matter what the translator did, it wouldn’t affect the formatting.

Translation

Each of our group members was in charge of a language. I was in charge of translating the Japanese resource files. I translated directly into the resource files instead of taking it into a CAT tool. That would’ve definitely been more helpful, but I didn’t want to waste time on figuring out whether Phrase (aka Memsource) is capable enough to translate C# .resx files.

Behold, the Final Outcome!

Let’s compare the original and the new in English!

Boy, there sure is a lot of new stuff added to this simple program! The items will intrigue the user into continuing the game in hopes of finding more items, and the potions are there to help prolong game time!
A couple of details you may have spotted are that: firstly, stead of “Viking”, it’s “Seafaring Viking”; secondly, there is no more player description (refer to the fourth image); and thirdly, in the beginning of the game, when you type in an invalid key, the system will automatically make you a goblin instead of a Viking in the original game (hence a “cunning goblin”)!

The first change is to add a little more fun to the game. I’ve added a fun adjective to all the character names so that it will be a fun surprise when the player chooses “Goblin” and sees “Cunning Globlin”.
There is no more character description because the description is actually displaying the character’s race, stored as an enumeration type. These are much harder to localize, and they can’t even have spaces, which is why instead of “localization professional”, it’s just “localization”. I found the description unnecessary because besides the “Chief” whose race is the “Fallen” and the “Deathwing” whose race is the “Dragon”, everyone else has the same race as their name. Plus, it would be a hassle to localize them. So, in the end, I decided to get rid of the Console.Writeline(“Description:“ + race) line of code.

Too many words? Here’s the program in action!

Afterthoughts

By doing this project, I feel like I have used what I learned in the past semester. This was a really fun project for me to do, especially where I got to add all kinds of quirky things into the game! Too bad I came across this game late in the semester and didn’t have enough time to play around with it. Here are things I wish I had time to add:

  • Instead of randomly printing a room description, add conditions to the room and monsters that appear in the room
  • More monsters and more damage mechanics, like infection, bleeding, mute, etc.
  • Different players will have different effects on monsters. For example, a light elf will be able to deliver more damage to the vampire.
  • Events (item drop, gain/lose stats, and other fun things)
  • More freedom of what to do!

Overall, I have learned quite a lot from doing the project. Hopefully, I’ll be able to work on this more in my own free time!