From Brotato Wiki

< User:Darkly77

Notes, info and data that didn't quite make the cut for the wiki, and notes for future reference.

@todo: Mechanics

Info for the proposed Miscellaneous Mechanics page:


Attack Speed Calculations

In the game's code, a weapon's displayed "attack speed" is determined by both two of its stats: cooldown and recoil_duration, via weapon_stats.gd (see get_cooldown_text in ranged_weapon_stats.gd and melee_weapon_stats.gd)

Recoil Duration is almost always 0.1, except for 11 ranged weapons: Crossbow (0.15), Flamethrower (0.02), Laser Gun (0.2), Minigun (0.02), Nuclear Launcher (0.142), Obliterator (0.2), Rocket Launcher (0.142), Shredder (0.15), Slingshot (0.15), SMG (0.05), and Sniper Gun (0.2).

For ranged weapons, the displayed attack speed is calculated as:

(cooldown / 60) + (recoil_duration * 2)

For melee weapons, the displayed attack speed is calculated as:

(cooldown / 60) + recoil_duration + (atk_duration / 2) + back_duration

Here's what those melee variables mean:

  • back_duration = 0.2 / (1 + (stat_attack_speed * 3))
    • At 0 attack speed, this would be: 0.2
    • At 10 attack speed (0.1), this would be: 0.15
    • At 50 attack speed (0.5), this would be: 0.08
    • At 100 attack speed (1), this would be: 0.05
  • atk_duration = max(0.01, 0.2 - (stat_attack_speed / 10.0)) + range_factor * 0.15
  • range_factor = max(0.0, (WPN.max_range + (stat_range / 2)) / clamp(70.0 * (1 + (stat_attack_speed / 3)), 70.0, 120.0))
    • max gets the highest value, so here it can't be lower than 0
    • clamp makes sure the value isn't higher/lower than the specified numbers, so here it can't be lower than 70 or higher than 120