From f74496288e509367c89ca62a6bdf1cb69a4ac784 Mon Sep 17 00:00:00 2001
From: fheinrich <fheinrich@techfak.uni-bielefeld.de>
Date: Fri, 8 Mar 2024 15:48:27 +0100
Subject: [PATCH] Added game event recording to study configs

---
 .../configs/study/level1/level1_config.yaml   | 42 +++++++++++++++++++
 .../configs/study/level2/level2_config.yaml   | 42 +++++++++++++++++++
 .../configs/study/study_config.yaml           | 24 +++++------
 3 files changed, 96 insertions(+), 12 deletions(-)

diff --git a/cooperative_cuisine/configs/study/level1/level1_config.yaml b/cooperative_cuisine/configs/study/level1/level1_config.yaml
index a0d0fe8b..94641a0a 100644
--- a/cooperative_cuisine/configs/study/level1/level1_config.yaml
+++ b/cooperative_cuisine/configs/study/level1/level1_config.yaml
@@ -142,6 +142,48 @@ extra_setup_functions:
   #      callback_class: !!python/name:cooperative_cuisine.recording.FileRecorder ''
   #      callback_class_kwargs:
   #        log_path: USER_LOG_DIR/ENV_NAME/json_states.jsonl
+
+  # Game event recording
+  game_events:
+    func: !!python/name:cooperative_cuisine.hooks.hooks_via_callback_class ''
+    kwargs:
+      hooks:
+        - post_counter_pick_up
+        - post_counter_drop_off
+        - post_dispenser_pick_up
+        - cutting_board_100
+        - player_start_interaction
+        - player_end_interact
+        - post_serving
+        - no_serving
+        - dirty_plate_arrives
+        - trashcan_usage
+        - plate_cleaned
+        - added_plate_to_sink
+        - drop_on_sink_addon
+        - pick_up_from_sink_addon
+        - serve_not_ordered_meal
+        - serve_without_plate
+        - completed_order
+        - new_orders
+        - order_expired
+        - action_on_not_reachable_counter
+        - new_fire
+        - fire_spreading
+        - drop_off_on_cooking_equipment
+        - players_collide
+        - post_plate_dispenser_pick_up
+        - post_plate_dispenser_drop_off
+        - on_item_transition
+        - progress_started
+        - progress_finished
+        - content_ready
+
+      callback_class: !!python/name:cooperative_cuisine.recording.FileRecorder ''
+      callback_class_kwargs:
+        log_path: USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl
+        add_hook_ref: true
+
   actions:
     func: !!python/name:cooperative_cuisine.hooks.hooks_via_callback_class ''
     kwargs:
diff --git a/cooperative_cuisine/configs/study/level2/level2_config.yaml b/cooperative_cuisine/configs/study/level2/level2_config.yaml
index 6ebb7fb3..e47528aa 100644
--- a/cooperative_cuisine/configs/study/level2/level2_config.yaml
+++ b/cooperative_cuisine/configs/study/level2/level2_config.yaml
@@ -164,6 +164,48 @@ extra_setup_functions:
       callback_class_kwargs:
         log_path: USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl
         add_hook_ref: true
+
+  # Game event recording
+  game_events:
+    func: !!python/name:cooperative_cuisine.hooks.hooks_via_callback_class ''
+    kwargs:
+      hooks:
+        - post_counter_pick_up
+        - post_counter_drop_off
+        - post_dispenser_pick_up
+        - cutting_board_100
+        - player_start_interaction
+        - player_end_interact
+        - post_serving
+        - no_serving
+        - dirty_plate_arrives
+        - trashcan_usage
+        - plate_cleaned
+        - added_plate_to_sink
+        - drop_on_sink_addon
+        - pick_up_from_sink_addon
+        - serve_not_ordered_meal
+        - serve_without_plate
+        - completed_order
+        - new_orders
+        - order_expired
+        - action_on_not_reachable_counter
+        - new_fire
+        - fire_spreading
+        - drop_off_on_cooking_equipment
+        - players_collide
+        - post_plate_dispenser_pick_up
+        - post_plate_dispenser_drop_off
+        - on_item_transition
+        - progress_started
+        - progress_finished
+        - content_ready
+
+      callback_class: !!python/name:cooperative_cuisine.recording.FileRecorder ''
+      callback_class_kwargs:
+        log_path: USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl
+        add_hook_ref: true
+
 #  info_msg:
 #    func: !!python/name:cooperative_cuisine.hooks.hooks_via_callback_class ''
 #    kwargs:
diff --git a/cooperative_cuisine/configs/study/study_config.yaml b/cooperative_cuisine/configs/study/study_config.yaml
index 006b080e..28c420aa 100644
--- a/cooperative_cuisine/configs/study/study_config.yaml
+++ b/cooperative_cuisine/configs/study/study_config.yaml
@@ -1,18 +1,18 @@
 levels:
-  #  - config_path: STUDY_DIR/level1/level1_config.yaml
-  #    layout_path: LAYOUTS_DIR/overcooked-1/1-1-far-apart.layout
-  #    item_info_path: STUDY_DIR/level1/level1_item_info.yaml
-  #    name: "Level 1-1: Far Apart"
+  - config_path: STUDY_DIR/level1/level1_config.yaml
+    layout_path: LAYOUTS_DIR/overcooked-1/1-1-far-apart.layout
+    item_info_path: STUDY_DIR/level1/level1_item_info.yaml
+    name: "Level 1-1: Far Apart"
 
-  - config_path: CONFIGS_DIR/environment_config.yaml
-    layout_path: LAYOUTS_DIR/basic.layout
-    item_info_path: CONFIGS_DIR/item_info.yaml
-    name: "Basic"
+  #  - config_path: CONFIGS_DIR/environment_config.yaml
+  #    layout_path: LAYOUTS_DIR/basic.layout
+  #    item_info_path: CONFIGS_DIR/item_info.yaml
+  #    name: "Basic"
 
-#  - config_path: STUDY_DIR/level2/level2_config.yaml
-#    layout_path: LAYOUTS_DIR/overcooked-1/1-4-bottleneck.layout
-#    item_info_path: STUDY_DIR/level2/level2_item_info.yaml
-#    name: "Level 1-4: Bottleneck"
+  - config_path: STUDY_DIR/level2/level2_config.yaml
+    layout_path: LAYOUTS_DIR/overcooked-1/1-4-bottleneck.layout
+    item_info_path: STUDY_DIR/level2/level2_item_info.yaml
+    name: "Level 1-4: Bottleneck"
 
 
 num_players: 1
-- 
GitLab