For the final assignment in my computer science course, my team and I decided to make a text-based adventure game. The main goal of this project was to apply and showcase our understanding of the course material we learned throughout the semester.
We emphasized decision-making as a pivotal element throughout the game but also randomization to create a unique experience for each player. Inspired by adventure games such as Dungeons and Dragons, we successfully created an interactive RPG with C++.
Playable here: https://replit.com/@Lipikan/Deserted-by-lessioTeamgreater?v=1
Background
My specific contributions to the game include:
Being the main coder where I coded a majority of the game in C++
The battle system which is how combat is done between the player and enemies they encounter throughout the game
Consolidating individual and team-member coding branches/functions into a single delivery package.
Debugged and troubleshot team code to ensure a bug-free game.
The team consisted of 4 members including myself, and we went under the name <ioTeam> which was a play-on with the library header <iostream> for C++.
We named our game Deserted based on the theme of our game where you play as an adventurer who was abandoned on an unknown island.
The Battle System
The battle system included a random number generator (RNG) and a variety of enemies with certain strengths and weaknesses based on their type (e.g. Undead, Beast, Human, etc). This was to ensure that the battles did not get too repetitive and to increase the difficulty as the player would not be able to predict what would happen during each encounter.
In this example, a skeleton can inflict a base damage of 3 however there is a 20% chance it will inflict damage plus a 1.15 multiplier (A critical hit which increases damage to 3.45). This change is based on whether the RNG outputs the value 1 when the skeleton attacks during its turn.
This also applies to the player and the weapon they choose, in this case, the sword has a base damage of 4 but there is a 25% chance this will increase to 6 from the 1.5 multiplier. Additionally, similar to the enemies, hits do not always land, offering more unpredictability to the player experience. Specifically, for players using the sword, there is a 40% chance hits will miss when attacking an enemy with a strong attack.
The main battle function uses nested while loops to handle player decisions and their outcomes during enemy encounters. Players can choose between light and strong attacks, each with varying damage and hit rates, or heal if they have a potion. The enemy also makes randomized decisions based on difficulty, with bosses more likely to heal and use strong attacks.
Turns are randomized, alternating until one runs out of health. If the player’s health reaches zero, it’s game over, requiring a restart; if the enemy's health reaches zero, the player wins gold based on difficulty. Input validation ensures only valid commands are accepted, prompting the player to re-enter commands like 'l', 's', or 'h' for attacks or healing.
Text-Based Images
Images were also incorporated during encounters to give players a visual of what they were fighting or seeing rather than have them just read lines of descriptive text. This was intended to enhance the immersive experience for players as it helps convey the atmosphere, characters, and details of the in-game world.
Some examples are seen on the left which showcases 4 different enemy images
(The Knight, Skeleton, Bandit Mimic)
Story Scenarios
Outside of combat, the story presents events where players can choose to engage or ignore them, potentially aiding or hindering their progress.
For example, players might encounter a mysterious house. Ignoring it means missing out on potential loot, while entering offers the option to open a chest, which could turn out to be a mimic—an enemy.
Our team designed many events like this, providing players with meaningful choices and creative freedom throughout their journey.