Customers - UQcsse3200/2024-studio-3 GitHub Wiki

Customers created by Team 8

Description

Sprites from: https://deepdivegamestudio.itch.io/animalassetpack

The customer system is designed to seamlessly integrate customers into the gameplay experience, allowing players to interact with a variety of customer profiles. Different customer types carry distinct features which are all included within the Customer.json file. The customer area is designed to encourage players to prioritise their attention on the customer while still maintaining an overview of the kitchen. This design allows for players to efficiently manage the customer’s needs and ensure their satisfaction.

Customer.JSON

Each customer will contain information rooted from a Customer.JSON file, within core/assets/images. Each customer contains several characteristics such as patience/wait time, food preferences (i.e. what the player will need to cook up to satisfy them), and a reputation meter. An example of one such customer file is seen below

"Gorilla": { "name": "Hank", "countDown": 20, "patience": 100, "spawnTimer": 100, "preference": 0, "reputation": 100, "texture": "images/animal_images/gorilla.png" },

  • name: customers will have unique names for players to have easy identification
  • countDown: timers to reflect how long each customer will stay that will be unique to each animal type. this is based on each customers patience level ie. countDown is the countdown of the patience level to 0
  • patience: timers to reflect each customers patience levels that will be unique to each animal type (this will be impacted if the player does not keep up with the order and/or if the player makes a moral decision)
  • spawnTimer: timers to reflect the frequency that each customer appears in the game per “level”/”day cycle”
  • preference: specific food preferences for each customer which will influence their orders
  • reputation: unseen reputation meter that tracks customer satisfaction and influences their behaviour in future interactions with the player (this will be impacted if the player does not keep up with the order and/or if the player makes a moral decision)
  • texture: placeholder images will be used to represent the design of each customer, allowing for future updates with actual character art and animation

We chose to use JSON files to represent the customer data as it is a future-proof method of data containment, so that if any drastic changes throughout development occur, this data will not have to be rebuilt from the ground up.

Sprites

The sprites for the customers were downloaded from DeepDiveStudio's Animal Asset Pack. For example, the sprite sheet of the Gorilla (Hank) is seen below: HulkingGorillaIdleSide

The following customer types have been implemented: Gorilla, Goose, Wolf, Monkey, Goat, Chicken and Sheep. Their atlas files were developed as well, as seen in images/animal images. More information about the animation process is seen in Customer Animation Page

Spawning and Movement

Customer Spawning

Number of Customers Spawning

Customer spawning should be staggered throughout the day, so that the player has time to complete orders and serve these to the customer without getting overwhelmed by many entities spawning at the very start of the day. It was decided to base this spawn time off the timers on the dockets (1 min for all meals except steak meal with a recipe timer of 2 mins). Therefore, each customer spawns 40 secs after each other, with caps to stop customers from spawning if the level spawn cap is reached.

Types of Customers Spawning

As only certain recipes can be created each day (based on the availability of ingredients, see here), only certain customers should be permitted to spawn on each day so that the player never has a customer spawn who they cannot make a meal for.

The list of ingredients, recipes, and thus customers who are able to spawn on each day is as follows:

Day 1

  • Ingredients: tomato, cucumber, lettuce
  • Recipe(s): salad
  • Customer(s): John (goat)

Day 2

  • Ingredients: banana, strawberry, lettuce, tomato, cucumber
  • Recipe(s): salad, fruit salad
  • Customers(s): John (goat), Hank (gorilla)

Day 3

  • Ingredients: tomato, cucumber, lettuce, beef
  • Recipe(s): salad, steak meal
  • Customers(s): John (goat), Silver (snow fox)

Day 4

  • Ingredients: banana, acai, chocolate, strawberry
  • Recipe(s): banana split, acai bowl, fruit salad
  • Customers(s): Moonki (monkey), Lewis (goose), Hank (gorilla)

Day 5:

  • Ingredients: all -> banana, acai, chocolate, strawberry, lettuce, tomato, beef
  • Recipe(s): all -> salad, steak meal, banana split, acai bowl, fruit salad
  • Customers(s): all -> John (goat), Silver (snow fox), Hank (gorilla), Moonki (monkey), Lewis (goose)

Customer Movement

Each customer sprite for the customer will be spawned at the entrance door of the restaurant as per given by Team 7 (maps) - see Maps Design.

1, 2, 3, 4, 5 represent the positions that the customers can move to in order to place their order. They will stay in their position until their order is fulfilled or until their patience timer has reached 0 seconds - this result will impact the customer's patience and reputation for the next time that they respawn to order.

Image 28-8-2024 at 7 47 pm

The PathFollowTask class is intended to manage an NPC's movements within a game. The objective of this task is to move the NPC, step by step, in a horizontal, vertical, or vice versa manner to a designated target place on the screen. Once it arrives at its destination, the NPC will cease its actions.

This task is a component of a larger AI system that manages and prioritises tasks to provide NPCs dynamic behaviours. The PathFollowTask effortlessly integrates with the AI task management system by extending DefaultTask and implementing PriorityTask.

Key Components and Fields

  • targetPos: The last location to which the NPC must travel.
  • currentTarget: The NPC's current target position, which it is traveling toward both horizontally and vertically.
  • movementTask: A MovementTask instance responsible for managing the mechanics of movement.
  • currentTask: The task that is being performed at the moment (movementTask by default).
  • predefinedTargetPos: A fixed target location that the NPC may travel to in response to a certain event.

Methods

The PathFollowTask uses a number of methods that defines it's functionality.

  • getPriority(): Returns the task's priority. This task has a low priority (1), which means it will be done when higher-priority tasks are not engaged.
  • start(): Sets up the initial conditions for the task for when it begins. It also triggers a wanderStart event which can be used to notify other systems of the start of the customer's movement.
  • update(): If currentTask is not active (i.e., it has finished its current movement step), the task determines if the target has been met. The current task ends if the NPC reaches the ultimate target position (targetPos).
  • startMoving(): generates a debug message that indicates when the subsequent movement step begins and also updates the movementTask with the new currentTarget. Finally, calls swapTask to switch to the new movement.
  • swapTask(Task newTask: It stops the active currentTask and sets the newTask as the currentTask and starts it.
  • triggerMoveToPredefinedPosition(): records a debug message that shows the NPC has moved to a designated location and puts targetPos (predefinedTargetPos) to the predefined position.
  • handleEvent(String event): Responds to custom events that are triggered within the game so if the moveToPredefined event is triggered, triggerMoveToPredefinedPosition() is used by the NPC to start movement toward the predetermined position.

UML

UML of customer spawning onto map

UML of which customers are spawned and movement of customer