feat: Introduce a new modular bot AI system for decision-making, movement, and actions.

This commit is contained in:
Yogi Wiguna
2026-03-02 15:32:50 +08:00
parent 78634d6421
commit c16a0043bc
3 changed files with 13 additions and 17 deletions
+3
View File
@@ -1203,6 +1203,9 @@ func sync_game_start(player_list: Array, is_turn_based: bool):
stop_n_go_manager.name = "StopNGoManager"
add_child(stop_n_go_manager)
stop_n_go_manager.activate_client_side()
elif LobbyManager.game_mode == "Tekton Doors":
if portal_mode_manager:
portal_mode_manager.activate_client_side()
# Initialize leaderboard for all peers (after a delay to ensure players loaded)
call_deferred("_deferred_init_leaderboard")
+2 -17
View File
@@ -400,23 +400,8 @@ func _find_tile_to_grab(tiles_needed: Array) -> Dictionary:
print("[BotController] %s found HOLO tile %d at current pos." % [actor.name, item])
result = {"position": actor.current_position, "type": item}
# Check adjacent cells
var neighbors = enhanced_gridmap.get_neighbors(actor.current_position, 0)
# print("[BotController] %s has %d walkable neighbors" % [actor.name, neighbors.size()])
for neighbor in neighbors:
var cell = Vector3i(neighbor.position.x, 1, neighbor.position.y)
item = enhanced_gridmap.get_cell_item(cell)
norm_item = _normalize_tile(item)
# print("[BotController] %s checking neighbor %s. Item: %d" % [actor.name, neighbor.position, item])
if norm_item in tiles_needed:
print("[BotController] %s found NEEDED tile %d (normalized %d) at neighbor %s!" % [actor.name, item, norm_item, neighbor.position])
return {"position": neighbor.position, "type": item}
if item in HOLO_TILES and not result.position:
result = {"position": neighbor.position, "type": item}
# Refined: Only grab at current position (per user request)
# Removed neighbor check to prevent bots from "sucking" tiles from 1-tile away
return result
+8
View File
@@ -94,6 +94,13 @@ func _activate_hud():
hud_layer.visible = true
_update_hud_visuals()
func activate_client_side():
"""Called on clients to show HUD and prepare local state."""
print("[PortalModeManager] Activating client-side HUD")
_activate_hud()
# Initial update to catch any missed goal counts
_update_hud_visuals()
func setup_arena_locally():
"""Sets up GridMap size and walls. Called on host and clients."""
if arena_setup_done:
@@ -405,6 +412,7 @@ func _on_global_goal_count_updated(_peer_id: int, _count: int):
pass
func _on_goal_count_updated(peer_id: int, _count: int):
# Update HUD if relevant (always check if it's the local player whose count changed)
if peer_id == multiplayer.get_unique_id():
_update_hud_visuals()