Scoring System - UQcsse3200/2024-studio-3 GitHub Wiki
The scoring system for Beastly Bistro primarily implements the ScoringSystem Component, which is used to generate a customer feedback score based on the meal the customer receives. There are three variables that influence the score that the player receives: 1) The accuracy of the player's meal when compared to the customer's order, 2) The service speed that is the amount of time taken for the player to serve the customer, and 3) The completion status of the ingredients used in the meal (i.e. whether the ingredients are cooked or raw). A further detailed explanation of the Scoring System can be found in this page.
The accuracy parameter of the scoring system works by iterating through each ingredient within the player's ingredient list, and check if these ingredients are also found within the customer order's ingredient list. If matching ingredients are found, the matchingIngredients
variable increments. A score between 0 to 100 is calculated by (matchingIngredients / longerIngredientList) * 100
which provides the percentage accuracy of the player's meal compared to the customer's order.
The service speed parameter of the scoring system works by retrieving the time remaining on the order ticket as the player serves the meal to the customer, and the score is scaled based on the remaining amount of time. The higher the remaining time, the higher the score.
The completion status parameter of the scoring system works by retrieving the individual completion statuses of the ingredients that were used to create the meal in the player's inventory, of which the score is scaled to. The higher the completion status, the higher the score per ingredient.
Finally, all of the scores received from these variables are weighted evenly by taking the mean of all the scores combined. The mean score will determine the satisfaction level of the customer.
To simplify the scoring, a scale of 1-5 is to be implemented alongside visual cues (such as an Angry Face for a score of 1 and a Grin Face for a score of 5). This is done by taking the 0 to 100 score and dividing it by 20. Depending on the score, a visual cue in the form of emotive faces, ranging from Angry to Happy, will be shown.
As mentioned previously, the score is dependent on the accuracy of the player's meal, the time it takes for the player to complete the meal, and the completion status of the meal's ingredients (whether it is cooked or chopped properly). Therefore, the ScoringSystem Component currently contains three methods:
-
getAccuracyScore(List<String> playerIngredients, List<String> orderIngredients)
- iterates through the ingredients within player's ingredient list. IncrementsmatchingIngredients
if matches are found betweenplayerIngredients
andorderIngredients
. Calculates a score based on the accuracy of the meal. -
getTimeScore(String orderTime)
- assigns a score value based on how much time is left as the player submits the meal to the customer. -
getCompletionScore(List<Float> ingredients)
- scales the score based on the completion statuses of the ingredients used in the creation of the player's meal, and then retrieving a mean score based on the individual scores of the ingredients. -
getFinalScore(int accuracyScore, int timeScore, int completionScore)
- evenly weighs out the score by taking the mean of all of the scores from each variable combined, and then assigning the final score to display images as an indication of customer satisfaction to the player.
The display for the scoring system uses HoverBoxComponent which tracks the customer's movements as they walk around the store. When the customers initially spawn in, the HoverBoxComponent displays the image of the meal they ordered above their head.
After the player creates a meal and serves it to the customer, the HoverBoxComponent is updated, and the meal image is replaced with a face type (ranging from Angry, Frown, Neutral, Smiling, Happy) to display their satisfaction level with the meal that they received.
In the image below, a Smile Face is shown after the player submits the meal to the NPC.
The scoreMeal() method, which can be found in StationServingComponent.java, is responsible for calling compareLists() method from ScoreSystem to generate a score, determining the face type to be shown based on the score, and updating the HoverBoxComponent to display the face after the player serves their meal. It is also responsible for incrementing the gold amount the player has, which will be discussed in more detail below.
The gold amount is updated according to the satisfaction level of the customer and the actual price of the meal that the customer ordered.
For example, if the player starts with 50 gold, and they serve a customer who ordered a fruitSalad, and the customer is showing a Happy Face, the new gold amount would be (50 (initial gold amount) + 20 (fruitSalad price) + 10 (customer tip) = 80 gold).
On the other hand, if the player starts with 100 gold, and they serve a customer who ordered a steakMeal, and the customer is showing an Angry Face, the new gold amount would be (100 (initial gold amount) + 40 (steakMeal price) - 10 (customer underpaying) = 130 gold).
The tip/underpay amount is dependent on the face shown:
Angry Face = -10 gold
Frown Face = -5 gold
Neutral Face = 0 gold
Smiling Face = +5 gold
Happy Face = +10 gold
These values can be manually updated or programmed to reflect the game difficulty as the player progresses. The gold incrementation is done through the scoreMeal() method, which also updates the player UI to reflect the updated gold amount.
When the order ticket of a particular customer has expired, the customer immediately leaves the store without paying for the meal as the player has not served a meal to the customer. It would therefore be justifiable to implement an update to the HoverBox Component to reflect the customer's dissatisfaction by changing the HoverBox to display an Angry Face as soon as their order ticket expires.
The image below demonstrates a customer leaving the store empty-handed, which makes them upset.
Here's an explanation of the scoring system UML diagram:
-
Component
: The superclass from which all components inherit. -
ScoreSystem
: The component that handles and updates the score of the player based on the combination of ingredients when making a meal.