SFML19 Roguelike Dungeon

Project Specification

  • Tools/Languages: C++, SFML (Source), Visual Studio
  • Environment: Personal Project
  • Timeline: 1 year (30 ~ 60 minutes every other day). Started in 2020.
  • Github: Repository

Description

I used SFML, a graphics library, in order to create a simple roguelike dungeon game. This genre is typically a game where the player character has to traverse a (usually endless) dungeon. They can fight enemies, collect items, purchase products in shops, and use spells.

I also created the sound effects and sprites.

Features:

  • Randomly generated (and potentially endless, as far as the int upper bound allows).
  • Randomly placed enemies that can seek and kill you if you get too close.
  • Randomly placed items and gold.
  • Use shops to buy and sell items and spells.
  • You can customize your character with different equipment and spells.
  • You can fight monsters and level up your characters to get stronger.
  • There's a stat system to roleplay and balance your character.
  • A save system to record your progress in the game.

Process

To implement these different features, I needed to apply the object-oriented programming paradigm. There are spells, items, the interface, enemies, and so forth. Many of these more general types of objects typically receive a parent class. Specific enemies, like zombies, are the sub-classes of one of these parent classes.

I use other techniques, like method overriding and overloading, in order to make my classes very flexible and extensible.

For my 2024 improvement of this game, I overhauled the UI by encapsulating the UI components further into subclasses. Because of that, it makes creating and switching screens extremely easy. I can now add new screens with minimal work and do not have to insert little codes in many different places.

With the UI changes, buttons are now more responsive. They can now be hovered over, and their appearance can change.

With the new way of adding screens, I added new features such as a setting screen that can maintain players’s preferences across game sessions, such as font or light/dark mode selection.

Disclaimer

I started this project back in 2020. I recently updated the documentation and tried to clean up the code a bit. I wanted to post it here to show how much I have grown as a programmer. Therefore, this project does not reflect my current programming capability (plus, C++ is somewhat old; I prefer C#, which makes things cleaner and shorter).

Instructions to use

1) Click “Start” to start the game.

2) Enter a name and hit “Continue”. Note that there are some restricted characters for the name.

3) Select your stats and click “Continue”.

4) You can now play the game! Use the arrow keys to move around. You can use the buttons on the bottom left to enable some QoL features.

5) Click “…” to view the menu. Click “Help” to get more instructions.

6) Click “Map” to view a minimap of the dungeon. You can exit using the “X” button on the top right.

7) Click “Equipment” to view your equipment and items.

8) Click “Spells” to view your spells. You can only cast spells if you have enough mana.

9) The enemy sprite is very obvious. Click on them to attack them if you are in the weapon’s range. You can click the “S” button on the bottom left to scan the enemy’s stats when you hover over them.

10) Items look like barrels. Walk over them to pick them up. Go to your inventory to check on your new item.

11) A coin and stair are shown here. Walk over the coin to pick it up. Go to the stairs and hit “Q” to go up a floor.

12) A shop has an “S” icon. Walk over it and hit “S” to buy and sell items.

13) You can click “Save” in the menu to save the game. A file should be created inside the game’s directory. You can then load the save file in the main menu.

14) You can then resume the game after loading the save.

15) You can go to the settings screen to adjus the game’s font family, theme, light mode, etc.

Address

Surprise, AZ, United States of America