adamqqqplay / dota2ai

Ranked Matchmaking AI: An improved Dota2 AI based on Valve's default AI. Has more than 3 million subscribers on Steam.
http://steamcommunity.com/sharedfiles/filedetails/?id=855965029
GNU General Public License v3.0
309 stars 85 forks source link

Improve farming #119

Closed JoshdanG closed 11 months ago

JoshdanG commented 1 year ago

Improve Farming Desire Calculation

  1. Check for damage from enemy players instead of any player damage
    • Fixes issue with (incorrectly) detecting self damage interrupting farming
  2. Removed unhelpful conditions
    • Check for channeling removed
    • Check if current action is "idle" removed

Improve Farming Behavior

  1. Fix stacking location
    • Fixes runtime error
  2. Fix stacking without creeps
  3. Mostly fixes leaving tree-heavy camps uncleared (while still farming)
  4. Fixes leaving baby mud golems behind
  5. Farming now uses 4 states: travelling, near, farming, stacking

Misc Cleanup

  1. Remove commented out and debugging / obsolete code
  2. Add comments
  3. Use more constants
  4. Consolidate conditions required for farming
  5. Move rattletrap specific farming code to separate function
  6. Refactor / tweak camp refresh
    • Move refresh to before ancient check so it always runs when it should
    • Simplify 0:30 time check
    • Change starting value of numCamp and add clarifying comment
  7. New general use functions
    • Unit.WasRecentlyDamagedByEnemy in MiraDota.lua
    • utility.GetUnitsTowardsLocationGeneric in utility.lua
JoshdanG commented 1 year ago

Reviewing

Feature Status

adamqqqplay commented 1 year ago

Thank you very much for your continued contribution. I am a little busy at work recently, and code review will be slower. I'll find time to finish it though, thanks.

ArcherWayne commented 1 year ago

Thanks for your contribution. Farming has been a problem for this bot.

I reviewed the code and I think the code are functional and logical. Can you try to test the GPM improvements for these bots?

If the bots can farm as fast as human players do, then they would be more challenging to play against.

JoshdanG commented 1 year ago

Thank you very much for your continued contribution. I am a little busy at work recently, and code review will be slower. I'll find time to finish it though, thanks.

No worries. Definitely no urgency from my end.

JoshdanG commented 1 year ago

I reviewed the code and I think the code are functional and logical. Can you try to test the GPM improvements for these bots?

If the bots can farm as fast as human players do, then they would be more challenging to play against.

It's definitely not (good) human level, but it's pretty consistently higher than non-farming heroes. Some sample game scoreboards below (Alchemist: 690gpm, Bloodseeker: 632gpm, Bloodseeker: 775 gpm). These games happen to all be wins, but the farming hero generally does not carry the game.

Alchemist Alchemist_farm

Bloodseeker (bad game) Bloodseeker_farm

Bloodseeker (good game) Bloodseeker_farm2