Treasure Cave
A text-based dungeon crawler game, but with a visual representation of the cave map.
It was the final assignment of the course. The base task (which one could build upon or change) was to make a bus, with passengers and methods for the bus to stop and pick up new passengers.
I immediately thought that I should make a litte game instead. Nobody needs a bus simulator. But I still used the idea with a group with several attributes and them moving as one.
The immediate idea was the most basic kind of game, a dungeon crawler with warriors in a group entering a cave to fight monsters and find treasure.
A nice challenge.
I don’t remember if I thought about the visual map right away or a while in, but I was inspired by the possibility to print a grid in the command window. And have it clear itself and print again made it possible to have a map where a character could move around. So when the player presses any direction button and there isn’t a wall in the way, the map is updated, cleared and then printed again, giving an illusion of moving around the map with a little, very atmospheric, flicker…
I chose blue for the walls, so the blue blocks are walls here on the screenshot to the left, and the only things visible from the start. All other elements require moving over them to become visible.
Yellow are treasure chests!
Turquoise are paths to other cave rooms.
The red X is the last defeated monster.
The game has classical random encounters, but there are a limited amount of monsters in each room, so a room can be emptied of monsters.
The green P is the party of warriors moving about, thus the player.
Time is seen on this screen shot, but it wasn’t there in the first version, so I’ll go into it further down.
You collect Branzen, this game’s name for gold, with which you can recruit new warriors at the tavern, in the village outside the cave.
There’s only one cave entrance so you have to find your way back to it when you need to get out and recruit new people or rest from the monster fighting.
As of now I have decided that the game is a rogue. If you die it’s over. You play until you beat the cave or until it beats you.
That might change until the game is finished.
My first future goal is to release it on PC, for free or a small price, I don’t know yet. Maybe I will look into android app programming via Visual Studio to convert the game into an app. I’ve heard apps are all the rage these days.
If you want to check it out, I have now created a repository with the game on GitHub. There’s the yellow button thing at the top of this page taking you there, or you can be relieved from the work load of scrolling up there and just click this:
https://github.com/Alyxes/Treasure-Cave
If you’re not used to GitHub, and aren’t technical and can’t start the game through Visual Studio, here’s how to get to testing the game:
On my GitHub page there is a green button saying ”Code”, press it. There’s a pop up menu, at the bottom it says Download ZIP, press that.
It downloads, then unpack the ZIP-file. The game is already an .exe-file in one of the folders, this is where it is:
Treasure-Cave-Project-Treasure-Cave\Treasure Cave\Treasure Cave\bin\Release
Yeah… It’s a mouthful of treasure caves, I know, I’m gonna fix that some day.
In that folder lies Treasure Cave.exe, just double click it and the game should start.
Versions and their added components:
- V0.1 Everything above. Warriors were all barbarians with two-handed swords, giving 4 damage.
I had actually from the start decided to randomize a gender to each new warrior, and therefore really felt the need to create a pronouns-list. Otherwise all writing about the warriors would be ”warrior name has low health! Warrior needs food!”. Too much cave man and good old game Gauntlet over that…
And there’s three genders from the start. Male, female and non-binary.
Three different monsters existed. 8 cave rooms. Moving between the rooms worked.
In battle, one could choose Attack, Defence, Use Item or Check Team.
Use Item consisted only of drinking a potion for health.
Defence was only passive, leaving the warrior to regain stamina and increase defence.
Check Team was letting you see the status of each warrior in your team.
All warriors attacked the monster in order and it tried to attack each warrior back. Attack and defence depended on several stats in each combatant.
Every defeated monster left a red X, they all stayed on the visual cave map.
The pause screen allowed for checking, healing and reorganizing your team using sorting methods.
Each cave room had a set amount and type of monsters, and a set risk of meeting monsters. Cave rooms’ positions in the cave system and exits were randomized.
There’s no ending, and no leveling up.
This was the version that I conjured up in a week or so and entered as my final assignment for the course.
I continued, although later, as I had other courses taking up most of my time. - V0.2 Added different types of warriors, and different starting stats for them. Now there’s 12 cave rooms.
- V0.3 Added a new class for items, and one for weapons, to make it possible to wield different weapons, have different attacking stats and upgrade warrior arsenal.
The weapon class inherits from the gear class. I created a set list of types of different weapons and a good batch of different weapons for each type. - V0.31 Created a list of weapon preferences that differs with each warrior type. Made it so that each warrior type randomizes a weapon from the gear-list that matches their weapon preference. Made changes in the fighting system, incorporating the new weapon stats to the battle.
- V0.32 Added a class for armor, which inherits from gear class. Created a small amount of different armor. Armor has defence and weight stat mainly.
Randomizes an armor to each new warrior. Its defence and weight adds to correct places on the warriors stats. - V0.35 Once weapons and armor was more than a random number I wanted to make one of the big important parts of an rpg. The character building.
This took some time, first creating an extensive menu with all the options to alter, then methodically creating each of them.
Especially the weapon choosing part was a big job, and the armor choice as well. And making it a choice whether to carry a shield or dual wield an extra weapon was a bit hard, but a lot of fun.
I also created a player class, eliminating issues with having to switch class when switching warrior type.
The part where one gets to distribute points to different stats needed a few new methods, and stat and max stat was no longer enough. I needed to add addedStatPoint to each stat type.
With all this, lots of new variables and booleans had to be added to the base hero class. A much more detailed and advanced version of the warriors were emerging, and it had to be adopted by all warrior classes of course and the randomizing of new warriors had to be upgraded by each new big part.
Eventually I had created a pretty good character builder, and I even made it so certain things had to be filled in before being able to continue.
Of course, after having tested the game tons later on, I had to bypass this by making a cheat code to just let the game randomize a warrior for me… - V0.4 I wanted to finish the item part finally, so I created the item class, also inheriting from gear.
The base class ’gear’ wasn’t smooth to use for that as I thought since letting classes inherit from it made it troublesome to let it have it’s own constructor.
The item class has all other stuff that isn’t weapons or armor. Here I created potions, food, trinkets and artifacts, and among some more things also disposable weapons… Yes, they are only items! Not real weapons!
It comes down to function of course. A disposable weapon is used as an item, not equipped like a regular weapon.
In all three classes there is a possibility to add a string that will become an option in the battle menu. That option will activate the item’s functionality. It was not coded yet, but would be. - V0.42 Since all sorts of gear was created, I felt it was time to start letting them randomize in chests. I made it so there is a certain chance for an item to appear in a chest, and a slightly lower chance for there to be a second item. With this I added a party gear list that all found items is added to.
- V0.43 It was time to make items work. In the gear class I created several methods with different functionalities, including raising health and stamina, and also diminishing them.
I connected the party gear list to the Use Item of the battle menu, and there I had to create a whole new set of menus, among others the Use Item Menu.
It ran the connected method for the chosen item.
Life potions and some food items now worked. - V 0.45 It was time for a store, in the village where one could only recruit new warriors yet, I created three choices, Market Street, The Tavern and The Inn.
And in the market street, one could buy a set number of different wares, affecting health, stamina, composure, strength and a little bit of other things.
I couldn’t resist creating the ability to sell stuff at the same time, so I did.
While I was on this I made the tavern a little bit more advanced and created the inn where the party can pay to rest and be fully rejuvenated.
Before, the tavern forced a new warrior upon you if you had the money. From here on, there came up to three new warriors, letting you choose each time if you wanted to hire them or not. - V 0.48 With a bit of different potions working, ailments had to become a thing. Bleeding, poisoned, fatigue and berserk was created as real problems that could happen to warriors during battle. This was also a big thing to add, demanding a lot of testing and adding new variables.
I added the risk of starting to bleed or being poisoned when monsters got critical hits.
In its wake, lots of new functionality for many different items was created and finalized. Especially items that could fix ailments. - V 0.5 Monsters was given a possibility to choose to run from a battle. Composure is the stat that affects that outcome. Composure is affected by some variables keeping track of consecutive damage, big damage and so on, deciding how much composure is lost and regained, both for monster and warriors.
Low composure on warriors make them weaker in battle, completely drained composure exposes the risk that the warrior runs off, disappearing in the darkness. - V 0.52 The pause menu was updated. Before, it had a simple Rest Party-option which just gave all warriors some health and stamina back.
There was a boolean so you couldn’t spam it. But that was all.
It became Pause And Rest, and it gives some stamina back to all warriors, but also gives more choices.
Among those are to use item or equip gear.
Pausing and resting comes with the risk of being found and assaulted by a monster, giving it a chance to strike first. After the battle, resting can’t continue in that location and the party must venture forth before trying to rest again.
Each time you do something while resting, there’s a risk to be found. Resting longer gives more stamina and composure back, but the risk of being attacked increases all the time.
This is the only way to use items outside a battle or equip gear at all inside the cave.
Eventually I made it so that the red Xes only was after the last battle. And you can’t rest on a red X, a cave path, or on a treasure chest. - V 0.54 Equipping gear came with the new pause menu functionality, and it’s a big thing. An important part for this kind of game, and a major change in this game particularly.
I added an array of spots on warriors, that each can be equipped with specific things. The helmet spot can only have helmets equipped and the weapon spot can only hold weapons. Then there’s the clothing spots, and jewelry spots and so on.
The shield spot and the secondary weapon spot are actually two different spots, they just can’t both be occupied at the same time. - V0.57 Finally I had added so much of the functionality with items, weapons, resting, shopping and equipping that I felt that the game needed levels to level up.
I had secretly (from… myself?) made it so fighting and defeating monsters gave experience points, that was saved in each warrior.
I created an array of increasing numbers, being the leveling up ladder. Each new reached number (in experience points) means a new reached level.
Then a way of getting anything for it was needed, so I created a menu where one gets to add one point to either health, strength, stamina or speed.
As dual wielding was a thing already, I created a separate leveling up ladder-array for it and dual wield level.
One only gets dual wield experience when dual wielding.
Monsters needed to adapt as well. Each time a new monster comes along, it gets about the same level as the party’s average level. And its stats are upgraded based on its level. - V 0.6 From the very beginning, I had an idea about counter attacks, and it was strangely enough incorporated in the possible outcomes of battle, even though it just couldn’t happen yet.
So somewhere here I thought it was time to make it real.
If a monster misses the warrior, the warrior has a slight chance to counter attack. That chance increases sometimes with leveling up, and it is slightly increased by dual wielding.
I plan to create weapons that enhance the counter chance.
Monsters cannot counter yet, and I’m uncertain if I want them to. - V 0.62 Time was added with time units passing at certain points. A time unit was decided to be 15 minutes.
With time as an actual parameter I could make ailments affect when time units passed. Time units pass after battles (but ailments affect warriors each round in a battle, even though time units doesn’t pass each round, and that’s is canonically because the adrenalin pumping during battle also speeds up ailments affecting you!).
But time units also pass when finding treasure, when entering a cave path (but not if you’re spamming the same door way back and forth, I made sure) and when resting.
Oh, and also in the tavern in the village, when you walk to the cave, and back, and of course when you sleep at the inn.
I created night and day. At night all monsters are stronger. - V 0.66 I created save and load methods for starting characters.
Using System.IO.StreamWriter and XmlSerializer made it pretty easy.
Although I did have to change equipped gear to strings instead of objects for it to work in the end.
A bit later I made a list of saved characters to load from with the help of Directory.GetFiles instead of writing the file name to load.
This made it a lot more fun to put time into creating a character, because it isn’t completely lost when you die. - V 0.7 When I started planning the item class, I planned for some of them being able to add options in the battle menu.
All items has a boolean for it, and a blank or filled string depending on if it’s supposed to give an extra option.
Some items, like disposable weapons and some artifacts, are possible to use directly in the battle.
I had to make a quite complex touch up of the very old battle menu, allowing it to become longer, while still having certain options at the bottom of the menu.
Selecting the special options activates certain methods connected to the items.
Only a few of these items were functional as of yet, but many more are planned.