extends GameMode # Spectate: bot vs bot exhibition — both ships are AI-driven so two trained # policies can be watched playing each other. Score tracking and kickoff # resets like Match, but no timer. R resets the ball, Esc returns to the menu. signal score_changed(score: Dictionary) @export_group("Team 0 bot") @export_file("*.json") var bot_a_model_path: String = "" @export_range(1, 60) var bot_a_reaction_ticks: int = 8 @export_range(0.0, 1.0) var bot_a_action_noise: float = 0.0 @export_group("Team 1 bot") @export_file("*.json") var bot_b_model_path: String = "" @export_range(1, 60) var bot_b_reaction_ticks: int = 8 @export_range(0.0, 1.0) var bot_b_action_noise: float = 0.0 func _get_arena_scene_path() -> String: return ArenaRegistry.random_path() func _start() -> void: spawn_ball() # The main menu's dropdown selections (GameSettings autoload) win over the # scene's exports, which stay as the fallback for direct-scene runs. var path_a := bot_a_model_path if GameSettings.spectate_bot_a_path.is_empty() else GameSettings.spectate_bot_a_path var path_b := bot_b_model_path if GameSettings.spectate_bot_b_path.is_empty() else GameSettings.spectate_bot_b_path var ship_a := spawn_ship(0, 0, _build_opponent(path_a, bot_a_reaction_ticks, bot_a_action_noise, "SpectateMode")) spawn_ship(1, 0, _build_opponent(path_b, bot_b_reaction_ticks, bot_b_action_noise, "SpectateMode")) spawn_camera_rig(ship_a) func _on_goal_registered(conceding_team: int) -> void: var scoring_team := 1 - conceding_team _record_goal(scoring_team) score_changed.emit(score.duplicate()) func _on_goal_scored(_conceding_team: int) -> void: reset_ball() reset_ships() func _unhandled_input(event): if event.is_action_pressed("reset_ball"): reset_ball() else: super(event)