Given below is a higher-level overview of the main components for the app to work.
Main has methods which are responsible for:
listed below are a collection of classes used by multiple components which will be generalised as Commons.
TextBox which is used to set all the messages and narrations for the user.FileReader to read our design.txt files in order to print certain screens.PlayerStatus which stores the status and inventory of the player.Ui responsible for displaying the game’s UI, interactions and narrations to the user.
Storage responsible for saving the current state of the game when quitting the app.
Parser is a collection of classes that converts the user’s commands and starts the command execution process.
Map is a collection of classes that handles the data that is being printed to the main portion of the screen.
Below is how some of the architecture components would interact with each other when the user inputs the command to move.
The section below gives more details of each component.
The Ui class is responsible for managing the user interface aspects of the application. It handles the display
of various elements such as player status, text boxes, maps, inventory, help menu, and messages.
The Ui Component,
Ui.java for Ui related jobmapData or shopItems in other classes to print
The Parser class package is designed to analyze and parse user commands in a text-based adventure game scenario.
It processes user input and determines the appropriate action to take based on predefined command types.
The parser component,
User can type command to do things on the Map.
If the user type the command, parseCommand function will be called. After that, the original input will be
analyzed by analyseCommand function to see if it matches a kind of CommandType. Then, we will return new
Command back to the main based on the command type. The Final step is to call the execute function. If the command
is the type of fightCommand, we will call the execute function with one parameter Scanner. For all other
conditions, we will call the execute function with no parameter.
The API of this component is defined in BaseMap.java.
Each map instance is associated with a 2-dimensional array of characters which represents the
printed map for the player, all the printable data is stored in the MapData for each instance of a map.
All maps will come with a given height and width, all of these attributes are inherited
from the AMap abstract class. Currently, the FirstMap and BattleInterface classes
extend AMap. FirstMap is the first map displayed upon entering the game and it displays the position of the player.
The BattleInterface is the map displayed when the player interacts with an interactable.
The MapGenerator is a class that handles the random generation of the enemies and the location of the shop, and is
only used in FirstMap only.
The following image shows the architecture of the Map component
The reason why the player’s map(FirstMap), the shop’s interface and the battle interface all extend off of the BaseMap
class is because during the game loop, these maps are being cycled through as the main screen the user will view. When
an Enemy is interacted with and the [FIGHT] command is used, the enableFight is executed for either the Enemy, this
also applies for the Shop. enableFight is another game loop that handles all the user - Enemy or user - ShopKeeper
interactions.
The API of this class is defined in ShopMap.java.
There exists only 1 shop at any given time during gameplay. During an interaction with the shop. A new separate gameloop
will execute. This comes from the execution of enableFight. Below is the diagram that displays how the enableFight
method works.
This is the general flow of enableFight.
This general flow is also similar to that of the battleInterface’s enableFight. However, in the battleInterface, the fight loop only ends when either the player or the enemy dies.
The API of this component is defined in InteractingCommand.java
This component happens when the user chooses to key the interact command e.
Here is how it works:
CalculaChroniclesOfTheAlgorithmicKingdom component then calls the execute() method in InteractingCommand.Enemy and ShopKeaper components which are responsible for the
entity classes in the game and also BattleInterface and ShopMap which are responsible for displaying these entities among other things.BattleInterface or ShopKeeper will then read from a .txt file to store their displays by creating the FileReader object and
running their respective methods.CalculaChroniclesOfTheAlgorithmicKingdom object.The API of this component is defined in FightCommand.java.
This component occurs when the user chooses to fight an enemy after interacting with it using the command
f or fight.
Here is how it works:
CalculaChroniclesOfTheAlgorithmicKingdom object then calls the execute() method in FightCommand and enables the fighting.MathPool object is created, which is responsible for the math questions to answer and another Ui object is created to interact with the user.CalculaChroniclesOfTheAlgorithmicKingdom.The API of the following component is defined in OpenInventoryCommand.java.
This component occurs when the user decides to open up the inventory. The user opens up the inventory using the command i
or inventory.
Here is how it works:
CalculaChroniclesOfTheAlgorithmicKingdom object then calls the execute() method in OpenInventoryCommandto get
the inventory from the stored maps in BaseMap.The API of the following component is defined in UseCommand.java.
This component occurs when the user decides to use an item after navigating to the inventory page containing consumable items.
Here is how it works:
CalculaChroniclesOfTheAlgorithmicKingdom object then calls the execute() methodPlayerStatus object. The inventory is then searched to check if it
contains the item.PlayerInventory object is called if the item is found. Subsequently,
an error message is printed outlining the error.In the main class, the saving is done in every loop through a method called saveAllGameFile.
The following sequence diagram shows how methods are called during saving mechanism.
Our target users are young students who are hoping the revise their mathematical skills.
It allows the target user to supplement their existing revision with a more fun and interacting way to revise their mathematics knowledge.
| Priority | As a … | I want to … | So that I can … |
|---|---|---|---|
| *** | new player | get access to a help menu | refer to them when I don’t know the commands to proceed |
| *** | player | see a map of the play area | see the map and location in real-time |
| *** | player | move around at will | explore the world as I want to |
| *** | player | have an ending to the game | win the game |
| *** | player | be able to track stats/items | gauge how my characters progress |
| *** | player | save my game | come back and finish it when I have time |
| *** | player | have a death and restart mechanic | add challenge to the game |
| ** | player | be able to fight entities | battle in and interactive way |
| ** | player | collect items | enhance my character |
| ** | player | interact with things in the environment | be more immersed into the game |
| ** | player | see an actual image of the characters | know what I am fighting against |
| ** | student player | have variations in the questions asked | revise more stuff rather than the same questions |
| ** | player | have clear distinctions between entities I interact with | have a clearer picture of what I’m doing |
| ** | student player | refresh my knowledge of math | revise as I play at the same time |
| * | player | know the background of this game | follow the storyline |
| * | player | see funny and engaging dialogue | enjoy the story |
| * | player | have access to hints to the questions | make calculations easier |
java -jar Release.v2.1.jar.quit or q.w is for moving upwards,
a is for moving leftwards, s is for moving downwards and d is for moving rightwards.s in the command line and the character represented by the symbol P will move 1 space downwards. A space is denoted by a . on the map.s 3# character denotes the shop to buy items and the rest is for you to explore and find out.e to interact with it.r or run will allow u to eun away if you’re not ready to face the enemy.f or fight will trigger the battling sequence where the aim is to get the math questions correct
in order to chip away at the enemies health to defeat it.1.i or inventory command.use 1 .