Skip to content

Instantly share code, notes, and snippets.

@leafstrat
Created June 23, 2025 03:45
Show Gist options
  • Save leafstrat/02fc666917c030cd12b3924dc0b38711 to your computer and use it in GitHub Desktop.
Save leafstrat/02fc666917c030cd12b3924dc0b38711 to your computer and use it in GitHub Desktop.
Slark explanation - dota2bot-OpenHyperAI

Fretbots Slark Bot Analysis

This document provides a detailed analysis of the Fretbots Slark bot, focusing on its behavior, itemization, and ability usage, particularly when operating at the highest skill/difficulty levels within the Fretbots framework.

Overview

The Fretbots Slark is designed to be a carry hero (typically position 1 or 2). Its logic is primarily defined in BotLib/hero_slark.lua. The bot's overall performance and resource acquisition are significantly influenced by the general Fretbots settings found in FretBots/Settings.lua (for base difficulty) and FretBots/DynamicDifficulty.lua (for in-game performance adjustments).

Slark Bot Logic (hero_slark.lua)

1. Skill Build

The primary skill build defined for Slark is: {3,2,1,1,1,6,1,2,2,2,6,3,3,3,6}

This translates to:

  • Level 1: Essence Shift (3)
  • Level 2: Pounce (2)
  • Level 3: Dark Pact (1)
  • Level 4: Dark Pact (1)
  • Level 5: Dark Pact (1)
  • Level 6: Shadow Dance (6)
  • Level 7: Dark Pact (1) - Maxed
  • Level 8: Pounce (2)
  • Level 9: Pounce (2)
  • Level 10: Pounce (2) - Maxed
  • Level 11: Talent
  • Level 12: Shadow Dance (6)
  • Level 13: Essence Shift (3)
  • Level 14: Essence Shift (3)
  • Level 15: Talent (Essence Shift Maxed)
  • Level 18: Shadow Dance (6) - Maxed

Prioritization: Dark Pact > Pounce > Essence Shift, with Shadow Dance taken at levels 6, 12, and 18.

2. Talent Choices

The default talent choices are specified in tTalentTreeList:

  • Level 10: +0 (Right Talent chosen: special_bonus_agility_6)
  • Level 15: +0 (Right Talent chosen: special_bonus_unique_slark) (Likely +1s Pounce Leash or Dark Pact Damage) - Note: The script maps 0 to the right talent, 10 to the left. Actual talent choice depends on mapping in J.Skill.GetTalentBuild.
  • Level 20: +0 (Right Talent chosen: special_bonus_unique_slark_3) (Likely Shadow Dance Duration or Essence Shift Agi Steal)
  • Level 25: +10 (Left Talent chosen: special_bonus_unique_slark_2) (Likely +Pounce Damage/Range or Dark Pact Purges Stronger Debuffs)

The exact talents depend on the specific Dota 2 patch version the bot script is aligned with, as talent trees change. The script indicates a preference for offensive/utility talents that enhance Slark's carry potential.

3. Item Builds

Item builds are defined for different roles. For Slark (typically pos_1 or pos_2):

Position 1 (Carry) Build (sRoleItemsBuyList['pos_1']):

  1. item_melee_carry_outfit (Starting items: Quelling Blade, Stout Shield, Tangoes, Slippers of Agility)
  2. item_diffusal_blade
  3. item_yasha
  4. item_broadsword (Component for Silver Edge or Crystalys)
  5. item_blitz_knuckles (Component for Monkey King Bar or Silver Edge)
  6. item_invis_sword (Shadow Blade)
  7. item_sange_and_yasha
  8. item_aghanims_shard
  9. item_black_king_bar
  10. item_travel_boots
  11. item_abyssal_blade
  12. item_silver_edge (Upgrade from Shadow Blade)
  13. item_disperser (Upgrade from Diffusal Blade + Sange and Yasha)
  14. item_ultimate_scepter (Aghanim's Scepter)
  15. item_moon_shard
  16. item_ultimate_scepter_2 (Aghanim's Blessing)
  17. item_butterfly
  18. item_travel_boots_2

Position 2 (Mid) Build (sRoleItemsBuyList['pos_2']): This build is similar but may prioritize items like item_echo_sabre earlier and includes options like item_orchid into item_bloodthorn or item_nullifier.

Item Purchase Logic: The bot purchases items sequentially from this list as gold becomes available. It doesn't feature complex adaptive itemization beyond selecting a predefined list based on its assigned role.

4. Ability Usage (ConsiderQ, ConsiderW, ConsiderAS, ConsiderR)

The bot makes decisions to use abilities based on various conditions:

  • Dark Pact (Q - ConsiderQ):

    • Teamfight AOE: If in a teamfight (J.IsInTeamFight) and can hit 2+ heroes.
    • Attacking: When going on a target (J.IsGoingOnSomeone) at close range (400 units).
    • Retreating (Debuff Removal): If retreating (J.IsRetreating), recently damaged by a hero, movement speed is low, or rooted, and an enemy is nearby. This is a key defensive use.
    • Farming (Lane/Jungle): If pushing, defending, or farming, and mana allows (J.IsAllowedToSpam), to clear 4+ lane creeps or 3+ neutral creeps.
  • Pounce (W - ConsiderW):

    • Control/Engagement: When going on a target (J.IsGoingOnSomeone) that is not disabled, within pounce range, and Slark is facing the target.
    • Escape: If retreating (J.IsRetreating) at low health (or skill level >= 2), an enemy is nearby who recently damaged Slark (or 3+ enemies nearby), and Slark is facing towards his ancient and not too close to the enemy.
    • Unstuck: If the bot detects it's stuck (J.IsStuck).
  • Depth Shroud (AS - Aghanim's Shard - ConsiderAS):

    • Requires Aghanim's Shard (abilityAS:IsTrained()).
    • Not used if Slark has Shadow Dance active or HP is > 85%.
    • Attacking: If going on a target (J.IsGoingOnSomeone), the target is very close (200 units), Slark is attacking the target, and the target isn't running away. Casts it slightly in front of Slark.
    • Retreating (Self-Preservation): If retreating (J.IsRetreating), running towards base, an enemy is targeting Slark and recently damaged him. Casts it slightly in front of Slark to hide.
  • Shadow Dance (R - ConsiderR):

    • Not used if HP is > 80%.
    • Offensive (Teamfight/Gank): If going on a target (J.IsGoingOnSomeone), HP is < 76%, target is close (300 units), AND (2+ enemies nearby OR Slark's HP < 55%).
    • Defensive (Dodge/Escape): If retreating (J.IsRetreating), HP is < 60%, recently damaged by any hero, AND (an enemy is detected casting an ability OR Slark's HP < 50% OR an incoming stun projectile is detected).

Bot Difficulty and Simulation (Settings.lua, DynamicDifficulty.lua)

The Fretbots framework includes a system for setting bot difficulty and dynamically adjusting it during the game.

1. Base Difficulty (Settings.lua)

  • At the start of a match, human players can vote for a difficulty level (typically 0-10).
  • If no votes are cast, a DefaultDifficulty (usually 5) is applied.
  • This chosen difficulty is converted into a difficultyScale via the Settings:CalculateDifficultyScale() function.
    • For difficulty d < 5, scale is 1 + ((d - 5) / 10), resulting in a scale < 1.
    • For difficulty 5 <= d < 10, scale is 1 + ((d - 3.2) / 10). (e.g., diff 5 -> scale 1.18)
    • For difficulty d = 10, scale is 1 + (d / 10). (e.g., diff 10 -> scale 2.0)
  • This difficultyScale is intended to globally affect bot performance, making them stronger or weaker.

2. Dynamic Difficulty Adjustment (DynamicDifficulty.lua)

  • This system adjusts bot GPM (Gold Per Minute) and XPM (Experience Per Minute) based on the performance difference between human players and bots, primarily measured by kill advantage.
  • If human players have a significant kill advantage over bots (exceeding advantageThreshold), the system increases the GPM and XPM offsets for bots.
  • The MakeAdjustment function calculates these bonuses. The bonus amount depends on base values, incrementEvery (how many kills beyond the threshold trigger another increment), and incrementValue (the GPM/XPM amount per increment). These bonuses are also capped (cap).
  • This allows bots to catch up in resources if they are falling behind, making the game more challenging even if human players initially have an advantage.

Slark at Highest Skill Level Simulation

When Fretbots Slark operates at the "highest skill level," this implies:

  1. Maximum Base Difficulty: Players have voted for the highest difficulty (e.g., 10), resulting in the maximum difficultyScale (e.g., 2.0). This inherently makes Slark (and other bots) more formidable, likely affecting their base stats, reaction times, last-hitting precision, and possibly decision-making heuristics (though the direct application of difficultyScale to these aspects beyond GPM/XPM isn't explicitly detailed in hero_slark.lua).
  2. Aggressive Dynamic Adjustments: If human players are still outperforming the high-difficulty bots (maintaining a kill advantage), the dynamic difficulty system will provide substantial GPM and XPM bonuses to Slark.

Behavior and Performance:

  • Rapid Resource Gain: Slark will accumulate gold and experience at a significantly accelerated rate due to both the high base difficultyScale and any active dynamic difficulty bonuses. This means he will reach key levels and item timings much faster than expected under normal conditions.
  • Quick Item Progression: He will quickly work through his item build:
    • Early Core: item_diffusal_blade, item_sange_and_yasha (or item_echo_sabre if mid).
    • Mid Game: item_black_king_bar, item_aghanims_shard, and then situational items like item_abyssal_blade or item_skadi. item_travel_boots will also be acquired.
    • Late Game: Will aim for luxury/carry items like item_butterfly, item_moon_shard, item_silver_edge, item_disperser, and item_ultimate_scepter.
  • Efficient Farming & Ganking: Slark will efficiently farm lanes and jungle using Dark Pact. He will actively seek ganking opportunities based on his "GoingOnSomeone" logic, prioritizing vulnerable targets.
  • Precise Ability Usage: His ability usage will be rule-based but executed with the precision expected of a high-level bot.
    • Dark Pact for damage, farming, and crucial debuff purging.
    • Pounce for initiation and escape.
    • Depth Shroud (with Shard) for offensive invisibility/regen during attacks and defensive escapes.
    • Shadow Dance for aggressive engagements when low-ish on health or as a life-saving defensive measure to dodge abilities or disengage.
  • Snowball Potential: The combination of Essence Shift's permanent agility steal, rapid item acquisition, and strong escape/regenerative capabilities (Shadow Dance, Depth Shroud) makes a high-skill Fretbots Slark a potent snowballing threat. If human players do not effectively shut him down early, he will become extremely difficult to handle.

In summary, a Fretbots Slark at the highest difficulty is a highly efficient farming and fighting machine. He benefits from significantly increased resource gain, allowing him to hit his item timings very quickly. His AI will execute its predefined strategies for ability usage with high precision, making him a dangerous opponent in ganks and teamfights. The dynamic difficulty system ensures that even if human players are skilled, Slark (and his team) will receive boosts to remain competitive, creating a consistently challenging experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment