Sarmatians Wiki

Profile

World_Hero_Utility_Adventure_Map

Declarative utility profile for an AI-controlled hero on the world map. The hero repeatedly spends movement points during its turn on discovered development goals: pickups, production sites, valuable guarded rewards, and exploration. Player hero attacks are opportunistic fallback actions, not the primary plan, and are suppressed while useful economy or exploration remains.

Root
node_check_owned_city_threat
Conditions
5
Utility nodes
4
Existing Go coverage
15

condition

Owned city threatened

implemented

owned_city_threat_score >= 0.7

backend/src/player_ai scores this from visible enemy heroes near owned cities and maps true to defend_home_city movement.

condition

Army needs reinforcement

logical_existing

hero_army_power_ratio < 0.65

backend/src/player_ai estimates hero army power from army slot counts and compares it with nearby visible enemy risk.

condition

Stronger enemy spotted

implemented

stronger_visible_enemy_nearby == true

backend/src/player_ai considers discovered enemy heroes within local threat range and compares army slot power.

utility

Evade or reinforce

implemented
  • Evade: evasion_hex_utility x 1 -> action_evade_to_safe_hex min 0.2 distance_from_threat + city_direction_bonus - distance_cost
  • Reinforce: reinforce_city_utility x 0.9 -> action_reinforce_at_city min 0.15 garrison_value + safety_bonus - distance_cost

backend/src/player_ai evaluates evasion and reinforce targets through this utility node.

condition

Known objective exists

implemented

known_world_goal_available == true

backend/src/player_ai treats discovered pickups, production sites, and fallback player attacks as known goals; exploration remains the fallback when none exist.

condition

Neutral blocks only worthwhile route

implemented

best_known_goal_blocked_by_neutral == true

True when a discovered neutral guards known nearby reward value and the AI has enough power to make the fight a utility candidate. The next utility node still compares it against safe pickups and production sites.

utility

Fight for reward or detour

planned
  • Guarded reward: guarded_resource_net_utility x 1.2 -> action_attack_neutral_for_reward min 0.35 unlocked_reward_value + blocker_unlock_bonus + urgency_bonus - distance_cost - battle_risk_cost; eligible only when unlocked_reward_value >= combat_policy.guarded_reward_thresholds.minimum_nearby_reward_value and score >= best_safe_score + safe_target_margin
  • Safe pickup: safe_resource_pickup_utility x 1 -> action_move_to_safe_resource min -1 reward_value + urgency_bonus - distance_cost
  • Safe resource site: safe_production_site_utility x 0.95 -> action_capture_safe_production_site min -1 production_value + urgency_bonus - distance_cost

This is the risk-aware strategic choice: fight for discovered treasure behind discovered guards only when removing this specific guard unlocks clustered value and the guarded utility clearly beats safer known map goals.

utility

Choose open map goal

planned
  • Pickup: resource_pickup_utility x 1.15 -> action_move_to_safe_resource min -1 reward_value + urgency_bonus - distance_cost
  • Resource site: production_site_utility x 1 -> action_capture_safe_production_site min -1 production_value + urgency_bonus - distance_cost
  • Player hero: enemy_hero_attack_utility x 0.25 -> action_attack_player_hero min 0.85 enemy_value - distance_cost - battle_risk_cost - development_opportunity_cost

Backend chooses among discovered development goals first. Player hero attack is allowed only after development and exploration have no positive target.

utility

Explore unknown map

planned
  • Frontier reveal: frontier_reveal_utility x 1 -> action_scout_frontier min 0.15 unknown_tiles_revealed + route_branching_bonus - distance_cost - local_risk_cost
  • Safe perimeter: safe_frontier_utility x 0.8 -> action_scout_frontier min 0.1 unknown_tiles_revealed - distance_cost - local_risk_cost

Exploration is the fallback when no discovered reward has positive net utility, and it still takes priority over hunting weaker player heroes.

action

Defend owned city

implemented

defend_home_city

backend/src/player_ai emits move-hero toward an owned city footprint when a visible enemy threatens it.

action

Reinforce at owned city

logical_existing

reinforce_at_city

backend/src/player_ai currently emits move-hero toward the nearest owned city; future city-garrison transfer can be appended when that command exists in the event-sourced backend.

action

Evade stronger enemy

implemented

evade_to_safe_hex

backend/src/player_ai emits move-hero toward the best discovered safe hex.

action

Fight for guarded reward

implemented

attack_neutral_for_reward

backend/src/player_ai emits start-battle with sourceType neutral, mobId, and a neutral battle preview after moving adjacent to the exact neutral that unlocks the best known reward cluster.

action

Collect safe resource

logical_existing

move_to_resource

backend/src/player_ai classifies collectible pickups from game_definition/map_objects/objects.json metadata and emits move-hero plus collect-pickup commands.

action

Capture safe resource site

logical_existing

capture-production-site

backend/src/player_ai classifies capturable production sites from game_definition/map_objects/objects.json metadata and emits move-hero plus capture-production-site commands.

action

Attack weaker player hero

implemented

attack_player_hero

backend/src/player_ai emits start-battle against a weaker discovered player hero only when pickup, production-site, and exploration targets are unavailable.

action

Scout frontier

implemented

scout_frontier

backend/src/player_ai chooses exploration as a development fallback and emits move-hero commands toward discovered frontier tiles.

action

Wait

implemented

wait

backend/src/player_ai returns Strategy: wait when no target is selected.