diff --git a/overcooked_simulator/__main__.py b/overcooked_simulator/__main__.py index 7b79494b06b5c03a01526a97caf124d2c08278e4..8dcd0fba4fe92cc8d16ba79fa16a74a4f3a2e853 100644 --- a/overcooked_simulator/__main__.py +++ b/overcooked_simulator/__main__.py @@ -8,7 +8,7 @@ from overcooked_simulator.utils import ( add_list_of_manager_ids_arguments, ) -USE_STUDY_SERVER = True +USE_STUDY_SERVER = False def start_game_server(cli_args): diff --git a/overcooked_simulator/game_content/study/environment_config.yaml b/overcooked_simulator/game_content/study/environment_config.yaml index eadb5b3dde08eddc106ffb0b8eb81ccf2aa77280..357c14aff5228c5b28be70943580c68904f65fb6 100644 --- a/overcooked_simulator/game_content/study/environment_config.yaml +++ b/overcooked_simulator/game_content/study/environment_config.yaml @@ -5,7 +5,7 @@ plates: # range of seconds until the dirty plate arrives. game: - time_limit_seconds: 20 + time_limit_seconds: 3 meals: all: true diff --git a/overcooked_simulator/game_content/study/environment_config_dark.yaml b/overcooked_simulator/game_content/study/environment_config_dark.yaml index b11ae4fdda0647e4cf772698dc961b0659e309d2..7890ad1265ba704253f546aadea3596e581a6531 100644 --- a/overcooked_simulator/game_content/study/environment_config_dark.yaml +++ b/overcooked_simulator/game_content/study/environment_config_dark.yaml @@ -5,7 +5,7 @@ plates: # range of seconds until the dirty plate arrives. game: - time_limit_seconds: 20 + time_limit_seconds: 3 meals: all: true diff --git a/overcooked_simulator/game_content/study/study_config.yaml b/overcooked_simulator/game_content/study/study_config.yaml index 883f4304842c768aaa8492da4acaef6a61fecb70..966dc3ec8bc88cfb81429ab541ffdb79eafd9c2b 100644 --- a/overcooked_simulator/game_content/study/study_config.yaml +++ b/overcooked_simulator/game_content/study/study_config.yaml @@ -1,23 +1,23 @@ levels: - - config_path: environment_config.yaml + - config_path: study/environment_config.yaml layout_path: overcooked-1/1-1-far-apart.layout item_info_path: item_info.yaml name: "Level 1-1: Far Apart" - # - config_path: environment_config.yaml - # layout_path: overcooked-1/1-4-bottleneck.layout - # item_info_path: item_info.yaml - # name: "Level 1-4: Bottleneck" - # - # - config_path: 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.yaml + layout_path: overcooked-1/1-4-bottleneck.layout + item_info_path: 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: environment_config_dark.yaml + - 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_players: 1 diff --git a/overcooked_simulator/gui_2d_vis/overcooked_gui.py b/overcooked_simulator/gui_2d_vis/overcooked_gui.py index 2804fd6891c5a91090cbb069f529bce8fa6de2ca..7af511240459362ce2cac711559b8cc2e67e0da8 100644 --- a/overcooked_simulator/gui_2d_vis/overcooked_gui.py +++ b/overcooked_simulator/gui_2d_vis/overcooked_gui.py @@ -1342,6 +1342,15 @@ class PyGameGUI: # self.last_level = answer["last_level"] # print("\nAT LAST LEVEL:", self.last_level, "\n") + def button_continue_postgame_pressed(self): + if not self.CONNECT_WITH_STUDY_SERVER: + self.current_layout_idx += 1 + if self.current_layout_idx == len(self.layout_file_paths) - 1: + self.last_level = True + else: + log.debug(f"LEVEL: {self.layout_file_paths[self.current_layout_idx]}") + self.menu_state = MenuStates.PreGame + def manage_button_event(self, event): if event.ui_element == self.quit_button: self.running = False @@ -1438,15 +1447,7 @@ class PyGameGUI: self.menu_state = MenuStates.PreGame case self.next_game_button: - if not self.CONNECT_WITH_STUDY_SERVER: - self.current_layout_idx += 1 - if self.current_layout_idx == len(self.layout_file_paths) - 1: - self.last_level = True - else: - log.debug( - f"LEVEL: {self.layout_file_paths[self.current_layout_idx]}" - ) - self.menu_state = MenuStates.PreGame + self.button_continue_postgame_pressed() case self.finish_study_button: self.menu_state = MenuStates.End @@ -1508,16 +1509,25 @@ class PyGameGUI: print("Number of joysticks:", pygame.joystick.get_count()) # Press key instead of mouse button press - if self.menu_state == MenuStates.Start: - if event.type in [pygame.JOYBUTTONDOWN, pygame.KEYDOWN]: - self.menu_state = MenuStates.ControllerTutorial - self.update_screen_elements() - elif self.menu_state == MenuStates.PreGame: - if event.type in [pygame.JOYBUTTONDOWN, pygame.KEYDOWN]: - self.setup_game() - self.set_game_size() - self.menu_state = MenuStates.Game - self.update_screen_elements() + if ( + event.type in [pygame.JOYBUTTONDOWN, pygame.KEYDOWN] + and event.key == pygame.K_SPACE + ): + match self.menu_state: + case MenuStates.Start: + self.menu_state = MenuStates.ControllerTutorial + self.update_screen_elements() + case MenuStates.PreGame: + self.setup_game() + self.set_game_size() + self.menu_state = MenuStates.Game + self.update_screen_elements() + case MenuStates.PostGame: + if self.last_level: + self.menu_state = MenuStates.End + else: + self.button_continue_postgame_pressed() + self.update_screen_elements() if event.type == pygame_gui.UI_BUTTON_PRESSED: self.manage_button_event(event)