Skip to content
daleelakhairil edited this page Oct 22, 2024 · 2 revisions

INTRODUCTION

This documentation will describe the structure and also the components of the JSON configuration used to define all the recipes in our system. Each recipe is represented as an object that contains the dish name, ingredients, cooking station and also the making time of the dish. ‘DishFactory’ is a factory class that is responsible for creating cooking entities in the game. It loads and manages recipe configurations from the JSON file and provides a method to retrieve recipes based on ingredients provided. This factory handles two config classes which are ‘SingleStationRecipeConfig’ and also ‘MultiStationRecipeConfig’.

Purpose

The ‘DishFactory’ class loads the recipe configurations from a JSON file into appropriate Java classes and provides a method to retrieve these recipes. This class also included a getter method to get recipes when associated ingredient/s are given. JSON file: Recipes are all defined in the JSON file and loaded by ‘DishFactory’ into instances of ‘SingleStationRecipeConfig’ and ‘MultiStationRecipeConfig’.

CookingConfig

The cookingConfig class aggregates several recipe configurations into a single, easily accessible object. Each of the recipes is represented by either a ‘SingleStationRecipeConfig’ or ‘MultiStationRecipeConfig’.

image

SingleStationRecipeConfig

This class defines the configuration of a simple recipe that only requires only one cooking station - the cutting board station. MultiStationRecipeConfig: This class extends the ‘SingleStationRecipeConfig’ and defines the configuration of a complex recipe that requires more than one cooking station and the burned time when the ingredient is in the frying pan or oven.

Creating Recipe

To add a new recipe to the system : Use direct addition by adding a new recipe directly to the JSON file using its specific configuration. Note: if the recipe only requires fryingPan or oven, you can simply put the empty list for cuttingBoard so that the file can still be loaded properly. However, the MultiSationRecipeConfig will be used as this config includes the fryingPan and oven.

image

Recipe retrieval method

To retrieve the recipes, we can use getSingleStationRecipes() or multiStationRecipes() method that will return a map of all the recipes based on whether it has more than one cooking station.

image

BASIC RECIPE STRUCTURE

There are several attributes that need to be defined in every recipe so that it can ensure that each of the recipes can be correctly processed and prepared in the game. For dishes that involve more than one cooking station, additional attributes are required. Hence, additional attributes which are optional are required to manage how other ingredients are handled.

Attribute Type Description
‘Ingredient’ List This is a list of ingredients required for each dish. Each ingredient is represented by a string, for example “banana” or “Strawberry”.
‘makingTime’ Int The total time (in seconds) required to complete each dish.
‘cuttingBoard’ List<String This is a list of ingredients that need to be processed on a cutting board. The ingredients that are listed in this list will be used at the cutting station.

OPTIONAL

Attribute Type Description
‘fryingPan’ List The list of ingredients that need to be cooked using a frying pan.
‘oven’ List The list of ingredients that need to be baked or cooked in an oven.
‘burnedTime’ Int The time (in seconds) after which the recipe will burn if not removed from the cooking station.

INTEGRATION WITH JSON

The ‘DishFactory’ is tightly integrated with the JSON configuration files. Each recipe in the JSON file corresponds to either a ‘SingleStationRecipeConfig’ and ‘MultiStationRecipeConfig’ in the game. These configurations are then used to dynamically generate and manage the recipes available to the player.

CODING STRUCTURE

image

Summary

‘DishFactory’ serves as the main access point for creating and managing recipes in the game. It loads recipe configurations from a JSON file into Java objects and provides methods to retrieve these recipes based on the ingredients provided. This system allows for easy expansion and management of recipes, ensuring that the game can handle a wide variety of cooking scenarios.

Table of Contents

Home

Team Design Document

Game Features

Inventory System
Scoring System
Food Recipes
Level System
Player Actions
Ordering System
Stations
Items
Map Design
Customers
Pause Menu
Upgrades
End of Day Display
Day Night Cycle
Moral System
Debug Terminal
Game Interactions Tutorial
Backstory Cutscenes

Game

Getting Started

Entities and Components

World Backstory

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Map Design

Test Plans

Sensor Component

Customer Sensor Component

Interaction Component

Inventory Component

Inventory Display

Station Meal Component

Station Progress Display

Keyboard Input Component

Fire Extinguisher Handler Component

Score System

HoverBox Component

MainGameActions Create Docket Triggers

End Day Display Component

Cutscene Area

Docket

Docket Line Display

Docket Meal Display

Main Game Order Button Display

Order Actions

Recipe

Ticket Details Component

BackstoryCutscene Test Plan

BackstoryCutsceneDisplay Test Plan

Test Plan for Tutorial

Keybinds

Keybinds Test Plan

Test Plan for MainGameOrderTicketDisplay

Test Plan for MainGameOrderBtnDisplay

Test Plan for Docket

Test Plan for DocketLineDisplay

Test Plan for OrderActions

Ticket Details

Test plan for RandomComboService

Test plan for LoanUpgrade

Test plan for UpgradesDisplay

Test plan for RageUpgrade

Test plan for SpeedBoostUpgrade

Test plan for DancePartyUpgrade

Test plan for ExtortionUpgrade

Troubleshooting

MacOS Setup Guide

Clone this wiki locally