JerryZhao275 / Realms-of-the-Bermuda-Isles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

“Realms of the Bermuda Isles”

Contributions

  • Coordinatd meetings and documented meeting minutes
  • Wrote the report for the overview of the game
  • Established a structure on how classes will function/interact with one another
  • Implemented majority of GameEngine.java code
  • Created thorough sets of unit tests and an execution of test commands, simulating a game run
  • Implementing additional game features such as using RNG and game difficulty

Game Introduction

  • Realms of the Bermuda Isles is a Text-based RPG Game, that solely runs in a terminal. Its creation is inspired by the text-based game website Zork.

Background Story

  • In the enigmatic expanse of the Bermuda Triangle, an area where time and space mysteriously intertwine, lies a realm unknown to most.
  • This place, known as the heart of the Bermuda Triangle, is the Bermuda Isles.
  • Its inhabitants, mostly sailors and aviators who vanished over the years, have formed a unique community in this lost world.
  • You, i.e. the player, will play the role of a brave adventurer to solve the secret of Bermuda.

Basic Commands

  • Enter “quit” to quit the game.
  • Enter “help” for a list of commands.

Game Modes

  • Easy:      HP limit = 5, Initial Items (sword x1, potion x1, gold x4)
  • Normal: HP limit = 4, Initial Items (sword x1)
  • Hard:     HP limit = 3, Initial Items (empty)
  • Commands for choosing a mode:

    - Enter “play easy” to play on an Easy mode.

    - Enter “play normal” to play on a Normal mode.

    - Enter “play hard” to play on a Hard mode.

  • game_mode

HP System

  • The HP system is designed for the player. It will decrease when the enemy gains the upper hand. It is recoverable by using supplementary Items.
  • When your HP comes lower than 1, the game ENDs.
  • 0HP
  • If you want to check your HP, you can enter the command “hp”. Your remaining HP will then be presented.
  • HP

Moving on the Map

  • You will be starting your adventure on a 4x4 grid map.  The areas on the map contain one of the entities (Enemy, NPC, or Item).
  • Sample Map:

- # # # B   (e.g. “B” stands for the location of the boss(3,3))

- # # # #   (e.g. “#” stands for the undiscovered areas)

- # # # #

- S # # #   (e.g. S stands for the starting point(0,0))

  • If you want to move to a new area, you can enter a command “move + (The direction)”, where the directions can be left, right, forward or backward.
  • move
  • Once you move on to a new area, the game will tell you what entity exists in that area (Enemy, NPC, or Item).

Inventory

  • The Inventory saves the Items you get during the adventure.
  • You may hold more than one of the same items in your inventory.
  • If you want to check your inventory, you can enter the command “inventory”. The names of the items in your inventory will be listed.
  • inventory

Items

  • You will have a chance to come across certain items in the game, including weapons (Sword, Bow), supplements (Potions, Armor) and currency (Gold).
  • Weapons are useful when you attack the enemies. Challenging enemies without a weapon may cause a loss on your HP.
  • Supplements provide support on your HP. “Potion” recoveries 1 HP if your HP is lower than your HP limit. “Armor” gives you 1 extra HP, which is independent of the HP limit. It performs better than potions, but it is also more difficult to obtain.
  • Pieces of “Gold” are used as the currency along the Bermuda Isles. You can use them to trade with some particular NPCs.
  • If you find an item, you can add the item to your inventory by entering the command “take”. Each item can only be taken ONCE.
  • If you want to use a supplement, you can use the item from your inventory by entering the command “use + (The name of the Item)”.
  • use_potion
  • use_armor
  • There is a Durability for the weapons and supplements. You can use:

    - Sword & Bow: Three times

    - Potion: Twice

    - Armor: Once

    - ps. The durability of weapons means the time for using them to attack

  • When the durability comes to 0, the item will be removed from your inventory.
  • durability

NPC Interaction

- There are several types of NPCs scattered throughout Bermuda:

    - Blacksmith: The skilled blacksmith will gift you his hand-made sword.

    - Dwarf: The friendly dwarf will gift you a piece of gold.

    - Thief: The sneaky thief will steal all the items (except swords) from you and escape.

       - ps. The identity of the thief is not published before you talk to him.

  • thief

    - Merchant: You can purchase items from astute Merchant using “Gold”, with a pricing of

       - Sword: 2

      - Potion: 1

       - Armor: 2

       - Note that each item can only be purchased ONCE.

- You can interact with the NPCs by entering a command “talk + (The name of the NPC)”.

- After "talking" with the merchant, if you want to purchase an item, you can enter the command “trade + (The item you want to buy)”.

  • merchant

Enemy Interaction

  • On the Bermuda Isles, there is a risk of encountering enemies such as Goblins, Spiders, and Ogres.
  • You can attack the enemies by entering the command “attack + (The lowercase name of the Enemy)”.

    - Weapons are essential for defeating your enemies.

    - After defeating all the enemies in an area, you will find a treasure Chest as your trophy.

  • normal_enemy_fight_win

    - The Chest will open automatically, giving you a random weapon or supplement, with 0-2 pieces of Gold.

    - The items from the chest will be automatically saved in your Inventory.

    - If you attack an enemy without having a weapon, the enemy will prevail against you, resulting in a loss of 1 HP.

  • normal_enemy_fight_lose
  • The “Boss”, who is the king of all the Bermuda monsters, is guarding the exit. Defeating him is the ONLY way for you to WIN the game.

    - To challenge the Boss, you need to be equipped with a weapon.

    - The Boss is much more powerful than normal enemies. To defeat him, you need to attack it 3 times in total.

    - For the intense hit-back from the Boss, you will lose 2 HP from each of your attacks.

  • hit_back_from_boss

    - During your challenge, logical planning on the usage of your supplement may be useful.

    - After defeating the Boss, you WIN the game! (p.s If the boss and you both die in the final duel, it will still count as your victory.)

  • Alternatively, you can also choose not to fight but simply move to the next area. The enemies will NOT leave unless they are defeated.

Saving & Loading

  • If you need to leave during a play, you can choose to save your current progress (maximum storage: 1 file)
  • The command for Saving is “save”, all the parameters (Inventory, HP, player location, The state of NPCs, Enemies, and Items) will all be saved.
  • save
  • When you come back, you can load the game and continue playing.
  • The command for Loading is load. The data saved will be loaded as parameters for continuing the game.
  • load

Features Planned without Implement

  1. The RNG for the size and entities for the map: We give up this feature simply because of the difficulty for the developers on testing, the difficulty for the players and other uncontrollable factors. The alternative solution we finally implemented is a fixed 4x4 map, which has manual-set entities for each area (something like a game level). This ensures that the difficulty for players is manageable, but on the other hand, it also loses some fun brought by randomness. (We still have RNG for opening chests!)

    As a result, it is hard for the current version to get players to play repeatedly. If the project continues, the RNG Map feature will be the primary goal for further development.

Game Tester

Realms of the Bermuda Isles are thoroughly tested through a combination of JUnit tests and simulated playthroughs with simulated inputs.

JUnit Testing

JUnit testing was performed to write basic unit tests for methods independent of other classes. This included writing tests to ensure dialogue was printed correctly, the player's inventory and map position were correct, and further attributes such as HP and equipment durability. The JUnit tests consist of:

  • EnemyTest
  • EntityTest
  • InventoryTest
  • ItemTest
  • MapTest
  • NPCTest

All of the above test classes covered all, if not, the majority of lines within their respective classes. There are certain exceptions, i.e. the Merchant NPC in the NPC class can only be tested within simulated runs as inputs must be directly provided for that specific instance.

Automatic Game Tester

An Automatic tester was implemented similar to JUnit testing syntax, but rather than performing unit tests, this AutomaticGameTest.java class was responsible for running through as many lines of code in both GameEngine.java and MainMenu.java, ensuring the game is error-free from a user perspective.

This tester was implemented by utilising the ByteArrayOutputStream class, allowing us to hardcode inputs in a list of Strings that are sequentially fed into the game engine. However, to allow this input feeding process, we were required to re-architecture our GameEngine.java class, parameterising it with a list of strings, allowing testing to be performed. This re-architecture was performed for specific class methods that require the use of a scanner, further allowing a list of string inputs to be processed by several unique scanners functioning in different classes. For the case of a normal playthrough, we would simply process a key within a singleton, and write additional logic for the program to not perform testing.

Through using both JUnit testing and Automated game testing, our team was able to provide coverage of 82.7% of all lines within the project. Note that some methods are duplicated for the sake of testing and running a playthrough, but retain the same functionality, hence the true coverage is much higher.

coverageMore information on the coverage report can be found in coverage-report/index.html.

About

License:MIT License


Languages

Language:HTML 69.7%Language:Java 30.3%Language:Dockerfile 0.1%