Learning Outcomes
This assignment is intended to develop and assess the following unit learning outcomes:
LO1. Iteratively apply object-oriented design principles to design small to medium-size software systems, using standard software engineering notations, namely UML class diagrams and UML interaction diagrams.
LO2. Describe the quality of object-oriented software designs, both in terms of meeting user requirements and the effective application of object-oriented design concepts and principles.
L03. Apply object-oriented programming constructs, such as abstraction, information hiding, inheritance, and polymorphism, to implement object-oriented designs using a programming language (namely, Java).
LO4. Apply effective programming strategies to refactor and debug object-oriented implementations systematically and efficiently using available programming language tools.
LO5. Apply principles of software engineering practice to create object-oriented systems with peers using tools including integrated development environments (IDEs), UML drawing tools, and version control systems.
To demonstrate your ability, you will be expected to:
- read and understand UML design documentation for an existing Java system
- propose a design for additional functionality for this system
- create UML class diagrams to document your design using a UML drawing tool such as diagrams.net, UMLet or plantuml – you are free to choose which one
- write a design rationale evaluating your proposed design and outlining some alternatives
- implement the features of the system that you designed
- use an integrated development environment to do so
- use git to manage your team's files and documents
The marking scheme for this assignment will reflect these expectations
Learning Materials
The base code will be automatically available in your group's repository (Gitlab).
Repeat this mantra: Design, write code, test, fix design, fix code, repeat 🚀
Note: You must NOT follow demo apps' design decisions; they only show how to use the engine, NOT how to design a proper system with object-oriented principles.
Introduction
Heavy penalty will apply for editing (add, modify, delete) any classes in the game engine as it breaks the purpose of the whole learning experience.
Before working on assignment 2, you and your team members need to agree on which design diagram, rationale and implementation will be used for the starting point for assignment 2.
You need to push the diagram, rationale and implementation to the new group repository.
IMPORTANT: You may change your design if you find that you need to. It is normal for the design to evolve alongside the codebase as the developers’ understanding of the requirements improves. If your design changes, you should document the changes. This includes your design rationale as well as your diagrams.
REQ1: The Ancient Woods
After fighting their way out of the burial ground, the player somehow managed to escape successfully in one piece. After looking within their surroundings, the player finds themselves in a new area, the Ancient Woods.
"....+++..............................+++++++++....~~~....~~~",
"+...+++..............................++++++++.....~~~.....~~",
"++...............#######..............++++.........~~.......",
"++...............#_____#...........................~~~......",
"+................#_____#............................~~......",
".................###_###............~...............~~.....~",
"...............................~.+++~~..............~~....~~",
".....................~........~~+++++...............~~~...~~",
"....................~~~.........++++............~~~~~~~...~~",
"....................~~~~.~~~~..........~........~~~~~~.....~",
"++++...............~~~~~~~~~~~........~~~.......~~~~~~......",
"+++++..............~~~~~~~~~~~........~~~........~~~~~......"
A sample Ancient Woods map
The Ancient Woods must be implemented as a new map (separate from the abandoned village and the burial ground maps). The player still needs to unlock a gate and go through it to be able to move to the new map.
Make sure to add another Gate in the Ancient Wood map to go back to the Burial Ground map. You can assume that this is a separate gate that the player also needs to unlock.
If you don’t change your implementation of moving between maps from assignment 1, you don’t need to include this feature in the class diagram since it has been documented in the assignment 1 diagram. However, if you made any changes to this functionality, you need to include them here.
After arriving at the new area, the player sees several seemingly empty huts (represented as “h”). Watching them from afar, the player sees a humanoid creature coming out of the huts. This creature is another enemy that the player has to fight against, known as the “Forest Keeper”, displayed as “8” in the game. The huts can spawn this enemy with a 15% chance at each turn. The “Forest Keeper” has 125 hitpoints and can attack the player with their limbs, dealing 25 damage with 75% accuracy.
As the player attempts to run away to hide in nearby bushes (represented as “m”), they get ambushed by a “Red Wolf”, displayed as “r”. The bushes can spawn this enemy with a 30% chance at every turn. The “Red Wolf” has 25 hit points and can attack the player by biting them, dealing 15 damage with 80% accuracy.
Similar to the previous enemies from Assignment 1, if the player is not within the surrounding of the enemies, they will wander around. However, when the player is nearby (within the surrounding of the enemies), they will attack the player. An enemy cannot attack another enemy.
The enemies cannot enter a floor, represented by the display character “_”, so that the player can run back to safety if their health is low. Furthermore, both the player and the enemies cannot enter walls. They, however, can walk around freely in the Void*, on puddles and dirt.
* with consequences
All enemies in the Ancient Woods can follow the player if the player is within the surrounding of the enemies. For simplicity, you can assume that once an enemy follows the player, they will keep following until either the player is unconscious or the enemy is unconscious.
Once defeated, the “Forest Keeper” has a 20% chance to drop a healing vial. While the “Red Wolf” has a 10% chance of dropping a healing vial.
REQ2: Deeper into the Woods
After defeating the inhabitants of the ancient woods, the player notices that the enemies dropped “Runes” (represented by “$”), which is the currency used in the world of “Designborne”.
“Runes” must be picked up and used/consumed by the player to increase their wallet balance.
Don’t forget to print out the number of runes that is being held by the player at a particular turn.
The “Forest Keeper” drops 50 runes, while the “Red Wolf” drops 25 runes. Going back to the enemies from Assignment 1, the “Wandering Undead” drops 50 runes, while the “Hollow Soldier” drops 100 runes.
In this game, you can assume that all enemies drop “Runes” once they have been defeated by the player, but the amount they drop varies from one enemy to another. The enemy will not drop runes if they are unconscious due to environmental hazards, such as the Void.
Going deeper into the woods, the player decides to drink from the nearby puddle of water (represented by “~”). In the game, since the player does not carry around a container for the water, they should be able to consume the water from the ground directly without having to add anything to their inventory. Drinking from the puddle of water heals the player by 1 point and restores the player’s stamina by 1% of their maximum stamina.
Edit (18/09): The player can only drink water from the puddle that they are standing on.
The player should also be able to drink water from the puddles of water found in the previous maps (the burial ground and the abandoned village).
Nearby, the player notices a bloodberry (represented by “*”) lying on the ground, which the player can pick up and consume. After consuming the bloodberry, the player’s maximum health is increased by 5 points permanently.
You can add Bloodberry manually with the following code:
gameMap.at(x, y).addItem(new Bloodberry());
REQ3: The Isolated Traveller
Deep within the forest, the player comes across an old building where a suspicious traveller lives (represented by “ඞ”). Approaching the traveller inside the building allows the player to purchase items from the traveller’s inventory. The player can also sell items from their inventory to the traveller.
You can assume that the traveller does not move around (that is, they will only stay at one spot in the building).
A reminder: a building is simply several squares of floor (`_`) and dirt (`.`), surrounded by walls (`#`).
The traveller offers the following items from their inventory that can be purchased by the player:
- Healing vials for 100 runes each (when the player purchases a healing vial, there is a 25% chance that the traveller asks the player to pay 50% more. If the player’s balance is less than what the traveller asks for, the purchase fails).
- Refreshing flasks for 75 runes each (when the player purchases a refreshing flask, there is a 10% chance that the traveller gives a 20% discount to the player)
- Broadswords for 250 runes each (when the player purchases a broadsword, there is a 5% chance that the traveller takes the player's runes without giving the broadsword)
For simplicity, you can assume that the traveller has an unlimited supply of items that they can sell to the player.
The player can sell all items in their inventory to the traveller for the following price:
- Healing vials for 35 runes each (when the player sells a healing vial, there is a 10% chance that the traveller pays 2x the original price)
- Refreshing flasks for 25 runes each (when the player sells a refreshing flask, there is a 50% chance that the traveller takes the item without paying the player)
- Broadswords for 100 runes each
- Bloodberries can be sold for 10 runes each
- Old keys cannot be sold
Edit (22/09): For simplicity, you can assume that the same item will have a fixed selling price across different traders. So, Trader A and Trader B will buy Item J at the same price from the player. Different traders, however, may sell the same item for different prices.
For simplicity, the traveller can buy items from the player regardless of the traveller’s wallet balance.
The traveller cannot be attacked by the player.
REQ4: The room at the end of the forest
Before leaving the traveller’s building, the traveller offers the player to purchase a new weapon: a Great Knife. This weapon deals 75 damage with 70% attack accuracy. It is represented by the character “>”. Also, this weapon has a special skill, “stab and step”, which allows the player to attack an enemy and step away to safety within the same turn. This weapon is sold by the traveller for 300 runes each. This special skill consumes 25% of the player’s maximum stamina.
When the player purchases a great knife, there is a 5% chance that the traveller will ask the player to pay 3x the original price of the weapon. If the player’s balance is less than what the traveller asks for, the purchase fails.
The player can sell the weapon back to the traveller for 175 runes, but there is a 10% chance of the traveller taking the runes from the player instead. If the player has less than 175 runes, the traveller will only take what the player has left (the player’s balance will never be negative).
For simplicity, you can choose a new location randomly within the player’s surroundings after attacking with the “Stab and step” skill using the great knife. You don’t need to make sure that the new location is the exact opposite of the enemy.
At the end of the forest, the player notices another locked gate that can be unlocked by the old key.
"~~~~.......+++......~+++++..............",
"~~~~.......+++.......+++++..............",
"~~~++......+++........++++..............",
"~~~++......++...........+..............+",
"~~~~~~...........+.......~~~++........++",
"~~~~~~..........++++....~~~~++++......++",
"~~~~~~...........+++++++~~~~.++++.....++",
"~~~~~..............++++++~~...+++.....++",
"......................+++......++.....++",
".......................+~~............++",
".......................~~~~...........++",
"........................~~++...........+",
".....++++...............+++++...........",
".....++++~..............+++++...........",
"......+++~~.............++++...........~",
".......++..++++.......................~~",
"...........+++++......................~~",
"...........++++++.....................~~",
"..........~~+++++......................~",
".........~~~~++++..................~~..~"
A sample Abxervyer battle map
For now, don’t add a separate gate in the new map to go back to the Ancient Woods. Refer to REQ 5 as to why.
Inside the room, there are several huts and bushes that the player encountered earlier in the Ancient Forest (see requirement 1), which spawn the “Forest Keeper” enemy and the “Red Wolf” enemy, respectively.
If you don’t change your implementation of moving between maps from assignment 1, you don’t need to include this feature in the class diagram since it has been documented in the assignment 1 diagram. However, if you made any changes to this functionality, you need to include them here.
When entering the room, the player notices yet another weapon: the Giant Hammer (represented by the character “P”). This weapon deals 160 damage with 90% attack accuracy. It has a special skill: “Great Slam”. This lets the player slam a specific enemy, dealing 100% of the weapon damage to only that enemy while also dealing 50% of the weapon’s original damage to any actor within the enemy’s surroundings, including the player themselves. This special skill consumes 5% of the player’s maximum stamina.
This weapon can be sold to the traveller for 250 runes, but it cannot be bought from the traveller.
REQ5: Abxervyer, The Forest Watcher
In the middle of the room, There is a tall figure standing, known as “Abxervyer, the Forest Watcher” (represented by “Y”). This triggers the first boss encounter that the player has to fight against in the game. The boss has 2000 hit points and can attack the player with its limbs, dealing 80 damage with 25% accuracy.
As with the previous enemies, if the player is not within the surrounding of the boss, they will wander around. However, when the player is nearby (within the surrounding of the enemies), they will attack the player. The boss cannot attack another enemy.
The boss cannot enter a floor, represented by the display character “_”, so the player can run back to safety if their health is low. Furthermore, both the player and the enemy cannot enter walls. They, however, can walk around freely on puddles and dirt.
All enemies, including the boss, in the Ancient Woods can follow the player if the player is within the surroundings of the enemies. For simplicity, you can assume that once an enemy follows the player, they will keep following until either the player is unconscious or the enemy is unconscious.
Note that the boss will not get hurt if they walk around in the Void.
The boss has a special ability: they can control the weather in the forest.
When the weather is sunny:
- The huts spawn the “Forest Keeper” enemy at 2 times the original spawning rate (i.e. 30% instead of 15%)
- The “Red Wolf” enemy deals 3 times the original damage when attacking the player (i.e. 45 damage points instead of 15 damage points)
- Bushes’ spawning rate returns to normal
When the weather is rainy:
- The bushes spawn the “Red Wolf” enemy at 1.5 times the original spawning rate (i.e. 45% instead of 30%)
- The “Forest Keeper” enemy is healed by 10 points.
- Huts’ spawning rate and red wolf damage return to normal The weather alternates every three turns. This repeats until the boss is defeated by the player.
For simplicity, you can assume that the boss can control the weather as long as the player has not defeated the boss, even when the player is outside of the boss room.
The boss room must be implemented as a new map (separate from the other maps). The player still needs to unlock a gate and go through it to be able to move to the new map.
Once the boss is defeated, the location where the boss last stood turns into a Gate, which can be unlocked by the player. If the player enters this gate, it will bring the player back to the Ancient Wood. The boss also drops 5000 runes when defeated. Additionally, you should print a message when the boss is defeated.