From ce5714a6aa47116416a0bc83429dd1c2051bf1d8 Mon Sep 17 00:00:00 2001
From: fheinrich <fheinrich@techfak.de>
Date: Thu, 22 Feb 2024 16:23:44 +0100
Subject: [PATCH] Basic study

---
 overcooked_simulator/__main__.py              |  22 +-
 .../level1_config.yaml}                       |   9 +-
 .../level1_item_info.yaml}                    |   0
 .../level2_config.yaml}                       |  12 +-
 .../study/level2/level2_item_info.yaml        | 232 ++++++++++++++++++
 .../game_content/study/study_config.yaml      |  24 +-
 .../gui_2d_vis/overcooked_gui.py              |   1 +
 7 files changed, 263 insertions(+), 37 deletions(-)
 rename overcooked_simulator/game_content/study/{environment_config.yaml => level1/level1_config.yaml} (98%)
 rename overcooked_simulator/game_content/study/{item_info.yaml => level1/level1_item_info.yaml} (100%)
 rename overcooked_simulator/game_content/study/{environment_config_dark.yaml => level2/level2_config.yaml} (97%)
 create mode 100644 overcooked_simulator/game_content/study/level2/level2_item_info.yaml

diff --git a/overcooked_simulator/__main__.py b/overcooked_simulator/__main__.py
index c5a6343f..e077eaba 100644
--- a/overcooked_simulator/__main__.py
+++ b/overcooked_simulator/__main__.py
@@ -86,17 +86,17 @@ def main(cli_args=None):
 
         if USE_STUDY_SERVER:
             print("Start PyGame GUI:")
-            pygame_gui_2 = Process(target=start_pygame_gui, args=(cli_args,))
-            pygame_gui_2.start()
-            # #
-            print("Start PyGame GUI:")
-            pygame_gui_3 = Process(target=start_pygame_gui, args=(cli_args,))
-            pygame_gui_3.start()
-            # while (
-            #     pygame_gui.is_alive()
-            #     and pygame_gui_2.is_alive()
-            #     # and pygame_gui_3.is_alive()
-            # ):
+            # pygame_gui_2 = Process(target=start_pygame_gui, args=(cli_args,))
+            # pygame_gui_2.start()
+            # # #
+            # print("Start PyGame GUI:")
+            # pygame_gui_3 = Process(target=start_pygame_gui, args=(cli_args,))
+            # pygame_gui_3.start()
+            # # while (
+            # #     pygame_gui.is_alive()
+            # #     and pygame_gui_2.is_alive()
+            # #     # and pygame_gui_3.is_alive()
+            # # ):
             #     time.sleep(1)
 
         while pygame_gui.is_alive():
diff --git a/overcooked_simulator/game_content/study/environment_config.yaml b/overcooked_simulator/game_content/study/level1/level1_config.yaml
similarity index 98%
rename from overcooked_simulator/game_content/study/environment_config.yaml
rename to overcooked_simulator/game_content/study/level1/level1_config.yaml
index 00716059..ce382a5e 100644
--- a/overcooked_simulator/game_content/study/environment_config.yaml
+++ b/overcooked_simulator/game_content/study/level1/level1_config.yaml
@@ -5,16 +5,15 @@ plates:
   # range of seconds until the dirty plate arrives.
 
 game:
-  time_limit_seconds: 300
+  time_limit_seconds: 10
 
 meals:
-  all: true
+  all: False
   # if all: false -> only orders for these meals are generated
   # TODO: what if this list is empty?
   list:
-    - TomatoSoup
     - OnionSoup
-    - Salad
+    - TomatoSoup
 
 layout_chars:
   _: Free
@@ -95,7 +94,7 @@ orders:
 
 player_config:
   radius: 0.4
-  player_speed_units_per_seconds: 6
+  player_speed_units_per_seconds: 8
   interaction_range: 1.6
   restricted_view: False
   view_angle: 70
diff --git a/overcooked_simulator/game_content/study/item_info.yaml b/overcooked_simulator/game_content/study/level1/level1_item_info.yaml
similarity index 100%
rename from overcooked_simulator/game_content/study/item_info.yaml
rename to overcooked_simulator/game_content/study/level1/level1_item_info.yaml
diff --git a/overcooked_simulator/game_content/study/environment_config_dark.yaml b/overcooked_simulator/game_content/study/level2/level2_config.yaml
similarity index 97%
rename from overcooked_simulator/game_content/study/environment_config_dark.yaml
rename to overcooked_simulator/game_content/study/level2/level2_config.yaml
index 2520eff2..22f75107 100644
--- a/overcooked_simulator/game_content/study/environment_config_dark.yaml
+++ b/overcooked_simulator/game_content/study/level2/level2_config.yaml
@@ -8,13 +8,13 @@ game:
   time_limit_seconds: 300
 
 meals:
-  all: true
+  all: False
   # if all: false -> only orders for these meals are generated
   # TODO: what if this list is empty?
   list:
-    - TomatoSoup
-    - OnionSoup
     - Salad
+    - Burger
+    - TomatoSoup
 
 layout_chars:
   _: Free
@@ -95,11 +95,11 @@ orders:
 
 player_config:
   radius: 0.4
-  player_speed_units_per_seconds: 6
+  player_speed_units_per_seconds: 8
   interaction_range: 1.6
   restricted_view: True
-  view_angle: 70
-  view_range: 4.5  # in grid units, can be "null"
+  view_angle: 75
+  view_range: 6  # in grid units, can be "null"
 
 effect_manager:
   FireManager:
diff --git a/overcooked_simulator/game_content/study/level2/level2_item_info.yaml b/overcooked_simulator/game_content/study/level2/level2_item_info.yaml
new file mode 100644
index 00000000..c924241d
--- /dev/null
+++ b/overcooked_simulator/game_content/study/level2/level2_item_info.yaml
@@ -0,0 +1,232 @@
+CuttingBoard:
+  type: Equipment
+
+Sink:
+  type: Equipment
+
+Stove:
+  type: Equipment
+
+DeepFryer:
+  type: Equipment
+
+Oven:
+  type: Equipment
+
+Pot:
+  type: Equipment
+  equipment: Stove
+
+Pan:
+  type: Equipment
+  equipment: Stove
+
+Basket:
+  type: Equipment
+  equipment: DeepFryer
+
+Peel:
+  type: Equipment
+  equipment: Oven
+
+DirtyPlate:
+  type: Equipment
+
+Plate:
+  type: Equipment
+  needs: [ DirtyPlate ]
+  seconds: 2.0
+  equipment: Sink
+
+# --------------------------------------------------------------------------------
+
+Tomato:
+  type: Ingredient
+
+Lettuce:
+  type: Ingredient
+
+Onion:
+  type: Ingredient
+
+Meat:
+  type: Ingredient
+
+Bun:
+  type: Ingredient
+
+Potato:
+  type: Ingredient
+
+Fish:
+  type: Ingredient
+
+Dough:
+  type: Ingredient
+
+Cheese:
+  type: Ingredient
+
+Sausage:
+  type: Ingredient
+
+ChoppedTomato:
+  type: Ingredient
+  needs: [ Tomato ]
+  seconds: 3.0
+  equipment: CuttingBoard
+
+ChoppedLettuce:
+  type: Ingredient
+  needs: [ Lettuce ]
+  seconds: 3.0
+  equipment: CuttingBoard
+
+ChoppedOnion:
+  type: Ingredient
+  needs: [ Onion ]
+  seconds: 5.0
+  equipment: CuttingBoard
+
+RawPatty:
+  type: Ingredient
+  needs: [ Meat ]
+  seconds: 4.0
+  equipment: CuttingBoard
+
+RawChips:
+  type: Ingredient
+  needs: [ Potato ]
+  seconds: 4.0
+  equipment: CuttingBoard
+
+ChoppedFish:
+  type: Ingredient
+  needs: [ Fish ]
+  seconds: 4.0
+  equipment: CuttingBoard
+
+PizzaBase:
+  type: Ingredient
+  needs: [ Dough ]
+  seconds: 4.0
+  equipment: CuttingBoard
+
+GratedCheese:
+  type: Ingredient
+  needs: [ Cheese ]
+  seconds: 4.0
+  equipment: CuttingBoard
+
+ChoppedSausage:
+  type: Ingredient
+  needs: [ Sausage ]
+  seconds: 4.0
+  equipment: CuttingBoard
+
+CookedPatty:
+  type: Ingredient
+  seconds: 5.0
+  needs: [ RawPatty ]
+  equipment: Pan
+
+# --------------------------------------------------------------------------------
+
+Chips:
+  type: Meal
+  seconds: 5.0
+  needs: [ RawChips ]
+  equipment: Basket
+
+FriedFish:
+  type: Meal
+  seconds: 5.0
+  needs: [ ChoppedFish ]
+  equipment: Basket
+
+Burger:
+  type: Meal
+  needs: [ Bun, ChoppedLettuce, ChoppedTomato, CookedPatty ]
+  equipment: ~
+
+Salad:
+  type: Meal
+  needs: [ ChoppedLettuce, ChoppedTomato ]
+  equipment: ~
+
+TomatoSoup:
+  type: Meal
+  needs: [ ChoppedTomato, ChoppedTomato, ChoppedTomato ]
+  seconds: 6.0
+  equipment: Pot
+
+OnionSoup:
+  type: Meal
+  needs: [ ChoppedOnion, ChoppedOnion, ChoppedOnion ]
+  seconds: 6.0
+  equipment: Pot
+
+FishAndChips:
+  type: Meal
+  needs: [ FriedFish, Chips ]
+  equipment: ~
+
+Pizza:
+  type: Meal
+  needs: [ PizzaBase, ChoppedTomato, GratedCheese, ChoppedSausage ]
+  seconds: 7.0
+  equipment: Peel
+
+# --------------------------------------------------------------------------------
+
+BurntCookedPatty:
+  type: Waste
+  seconds: 5.0
+  needs: [ CookedPatty ]
+  equipment: Pan
+
+BurntChips:
+  type: Waste
+  seconds: 5.0
+  needs: [ Chips ]
+  equipment: Basket
+
+BurntFriedFish:
+  type: Waste
+  seconds: 5.0
+  needs: [ FriedFish ]
+  equipment: Basket
+
+BurntTomatoSoup:
+  type: Waste
+  needs: [ TomatoSoup ]
+  seconds: 6.0
+  equipment: Pot
+
+BurntOnionSoup:
+  type: Waste
+  needs: [ OnionSoup ]
+  seconds: 6.0
+  equipment: Pot
+
+BurntPizza:
+  type: Waste
+  needs: [ Pizza ]
+  seconds: 7.0
+  equipment: Peel
+
+# --------------------------------------------------------------------------------
+
+Fire:
+  type: Effect
+  seconds: 5.0
+  needs: [ BurntCookedPatty, BurntChips, BurntFriedFish, BurntTomatoSoup, BurntOnionSoup, BurntPizza ]
+  manager: FireManager
+  effect_type: Unusable
+
+# --------------------------------------------------------------------------------
+
+Extinguisher:
+  type: Tool
+  seconds: 1.0
+  needs: [ Fire ]
diff --git a/overcooked_simulator/game_content/study/study_config.yaml b/overcooked_simulator/game_content/study/study_config.yaml
index 8fb376a1..57c46cf9 100644
--- a/overcooked_simulator/game_content/study/study_config.yaml
+++ b/overcooked_simulator/game_content/study/study_config.yaml
@@ -1,24 +1,18 @@
+# Config paths are relative to game_content folder.
+# Layout files are relative to layouts folder.
+
+
 levels:
-  - config_path: study/environment_config.yaml
+  - config_path: study/level1/level1_config.yaml
     layout_path: overcooked-1/1-1-far-apart.layout
-    item_info_path: item_info.yaml
+    item_info_path: study/level1/level1_item_info.yaml
     name: "Level 1-1: Far Apart"
 
-  - config_path: study/environment_config.yaml
+  - config_path: study/level2/level2_config.yaml
     layout_path: overcooked-1/1-4-bottleneck.layout
-    item_info_path: item_info.yaml
+    item_info_path: study/level2/level2_item_info.yaml
     name: "Level 1-4: Bottleneck"
 
-  - config_path: study/environment_config.yaml
-    layout_path: overcooked-1/1-5-circle.layout
-    item_info_path: item_info.yaml
-    name: "Level 1-5: Circle"
-
-  - config_path: study/environment_config_dark.yaml
-    layout_path: overcooked-1/4-2-dark.layout
-    item_info_path: item_info.yaml
-    name: "Level 4-2: Dark"
-
 
 num_players: 2
-num_bots: 2
+num_bots: 0
diff --git a/overcooked_simulator/gui_2d_vis/overcooked_gui.py b/overcooked_simulator/gui_2d_vis/overcooked_gui.py
index 417b6176..5316859d 100644
--- a/overcooked_simulator/gui_2d_vis/overcooked_gui.py
+++ b/overcooked_simulator/gui_2d_vis/overcooked_gui.py
@@ -803,6 +803,7 @@ class PyGameGUI:
             self.tutorial_image,
             self.quit_button,
             self.continue_button,
+            self.fullscreen_button
         ]
 
         self.pregame_screen_elements = [
-- 
GitLab