Software Development with C++
Assignment 1
Dungeon Crawler
Introduction
The assignment will require you to design, implement, test, and debug a text-based Rogue like dungeon crawler game using object-oriented methods and the application of appropriate design patterns. In addition, it will require to document your classes appropriately using Doxygen comments. The work in this assignment is to be performed in groups of 4–5 and will be submitted via Cloud Campus in week 17. Please refer to the Cloud Campus website for exact due dates and times.
Learning Outcomes
After completing this assignment, you will have learnt to:
• Design a class hierarchy using UML
• Apply Object-Oriented principles (encapsulation, reuse, etc.) and Design Patterns to the software design
• Implement the software design in C++ using class inheritance and polymorphism features
• Write well-behaved constructors and destructors for C++ classes
• Use C++ pointers (including smart pointers) and dynamic memory allocation and management
• Use stream I/O and manipulators for formatted input and output
• Write code adhering to coding standards, guidelines and good programming practices
Task Description
Roguelike Dungeon Crawler games are a genre of game that exhibit features typically attributed to the 1980s computer game Rogue1. In general, the goal of a Roguelike game is to clear a dungeon, level-by-level, until the final level is completed. Common features of a Roguelike game include:
1. procedurally generated dungeons,
2. character creation,
3. randomised items and weapons,
4. permanent death, and
5. a variety of creatures to fight that get progressively more difficult deeper into the dungeon.
In this assignment, you will complete Features 1 and 2 from the above list. You will design and implement a simple text-based Roguelike Dungeon Crawler game that fulfils the following specification. The assignment will be driven by a text-based menu interface.
The aim of the assignment is to allow you to practise creating an object-oriented design and implementing it in C++ using the features learnt so far: class inheritance and polymorphism, dynamic memory allocation, and smart pointers. The focus of the assignment is on identifying and applying appropriate Design Patterns to help develop the game in such a way that components are easily reusable and extensible.
First, you need to develop a class design using UML class diagrams based on the requirements in the remainder of this specification. The UML class diagram must include all classes, public data members, public member functions, protected data members and member functions (if any), and associations between classes. For this assignment the game has been simplified. Some of the underlying elements (such as the basic menu interface code) will be provided to get you started. The provided code will be incomplete and may need to be modified to fit your class design. Parts of the provided code that must not be modified will be marked as such.
You will then need to implement the rest of the game according to the specifications and your design.
A brief example of how the game will be played is provided below. The remainder of the section describes the requirements of the game in more detail.
> dungeon_crawler.exe
Welcome to Ashes of Software Development: Rite of Passage!
Developed by Matt Selway
COMP 3023 Software Development with C++
*Press any key to continue*
> [Enter]
What would you like to do?
(p)lay the game
(q)uit
> p
You need to create a character... what is your name?
> Dungeon Crusher
Welcome Dungeon Crusher, you have *6* stat points to allocate.
A high Strength stat will boost your damage in combat.
How many points do you want to add to your Strength?
> 3
You have *3* stat points remaining.
A high Dexterity stat will increase your ability to dodge creature attacks.
How many points do you want to add to you Dexterity?
> 2
You have *1* stat point remaining.
A high Wisdom stat will boost the effectiveness of magical items.
How many points do you want to add to your Wisdom?
> 1
*** Character Summary ***
Dungeon Crusher
Strength: 4
Dexterity: 3
Wisdom: 2
Health: 50 / 50
Damage: 10 – 10
Dodge: 20%
Weapon: you look down at your fists and shrug, "these will do"
Item: you look into your backpack, emptiness looks back.
if only you had something to put in it.
While roaming the country side you encounter a strange fork in the road.
To the left lies a dark cave, the foul stench of rotting flesh emanates from it.
To the right is a mysterious tower, a strange magical energy lights the path.
What would you like to do?
Go left: create a (b)asic dungeon
Go right: create a (m)agical dungeon
Go (b)ack the way you came (return to main menu)
> l
You enter the dark cave and see...
A dark and empty chamber.
To the NORTH you see an opening to another chamber.
To the SOUTH you see the entrance by which you came in.
What would you like to do?
Go (n)orth
Go (b)ack the way you came
View your (c)haracter stats
Return to the main (m)enu
> m
After exploring *0* levels, you run out of the cave as quick as your legs can carry you.
As you emerge from the cave you are startled by the bright light and pause while your eyes
adjust.
What would like to do?
(p)lay the game
(q)uit
> q
*Are you sure you want to quit? (y/n) *
> y
Goodbye!
Note: the following conventions will be used when illustrating example output:
• a ‘>’ at the beginning of a line indicates the command line prompt
• bold orange text indicates input entered by the user
• user input surrounded in square brackets ‘[…]’ indicates a specific key press
• hitting [Enter] after other input is implied
Workplan
In order to complete this assignment, it is important that you take a planned approach to the assignment. You will need to think about how to break down the assignment into smaller chunks of functionality that can be implemented and tested one at a time. Working in an incremental manner, and testing as you progress, helps to limit errors.
This assignment should be completed in the following stages:
1. Read the assignment specification (more than once)
2. Ensure you understand the 2 design patterns
3. Design a class hierarchy using UML class diagrams that addresses the requirements and applies the
design patterns to the game appropriately. Note: the design does not have to be perfectly complete from the outset, you can revise it as you progress through the assignment. However, it is good to start by conceptualising your approach before diving into the implementation.
4. Implement character generation—refer to section Player Character
5. Implement the basic dungeon: walls and doors, no creatures nor items (standardised layout)—refer to section Dungeon (Rooms, Walls, Doors)
6. Implement dungeon navigation: at this point you should be able to play the game and transition between rooms and dungeon levels without combat—refer to sections Dungeon (Rooms, Walls, Doors) and General Gameplay
As you implement the functionality, you should tick, highlight, or otherwise mark the requirements that you have completed. This will help you keep track of your progress and ensure you have addressed all the requirements in your submission.
General Gameplay
The gameplay state will be controlled by a Game object. There can only ever be one game in play at one time. The game allows a player character to explore a dungeon of your choice, room-by-room.
When the game is first started, a welcome message will be displayed and the user will be given the option to play the game or quit from the main menu.
If the user chooses to quit, the game will prompt the user to confirm that they want to quit the game:
• If the user selects ‘yes’, the game will end.
• If the user selects ‘no’, the game will return to the main menu.
If the user chooses to play the game (from the main menu), the game will prompt the user to create a character. Refer to section Player Character for details on character creation.
After the user has created their character, the game will prompt the user for the type of dungeon they would like to explore. In this assignment, there is only one type of dungeon: a “basic” dungeon. Refer to section Dungeon (Rooms, Walls, Doors) for details on the types of dungeon and their construction.
Once the user selects a dungeon type, the game must create the first dungeon level according to the selected type, place the character in the first room, display the room’s description, and prompt the user for the next action. The user can take various actions depending on the configuration of the current room. The following actions must be supported, as appropriate:
• Move the character to the next room: North, South, East, or West
• Move the character to the previous room (whether this is North, South, East, or West depends on the door the user “came through”)
• Return to the main menu
In most cases, after a choice is made, the action menu is displayed again.
If the user chooses to move to another room, the current room will be updated to the room that was selected, the new room’s description will be displayed, and the user prompted for the next action.
If the user chooses to return the main menu, the current dungeon and character will no longer be playable, i.e., a new character will have to be created. Therefore, the user must be warned that progress will be lost and prompted for confirmation. If the user confirms their intent to return to the main menu, the number of dungeon levels successfully completed must be displayed followed by the main menu.
Once the user reaches the final room of the dungeon the door to the next level will be revealed. If the user chooses to go through that door (via the appropriate direction, North, South, East, or West), the game will return the user to the main menu. If the user chooses to play the game (again), a new dungeon level must be built (of the currently selected dungeon type) but the existing character will be used.
General Requirements
At any time a valid character exists, the user must be able to view their character details (stats, items, etc.). After viewing the character details, the user will be able to view the weapon specific details, the item specific details, or return to the main menu.
All user inputs must be validated. If an invalid input is given, a warning must be displayed to the user and the menu options redisplayed.