Closed Keithenneu closed 7 years ago
The code I put in for jungling constants and utility functions highly borrows from the Meepo bot made by ironmano. Check the Think() https://github.com/furiouspuppy/Dota2_Bots/blob/master/mode_farm_meepo.lua for how it can be used
@Nostrademous Need some help with this: Some problems i came across:
As i don't have the big picture, I rather ask you than tinker somethin myself.
I will look at this tonight
Here is what you should do:
I assume you have made an "bot_enigma.lua" - in there you should do the same thing I do for "bot_lina.lua" to setup the skilling and necessary variables.
Additionally in the bot_enigma.lua you should add a function called "enigmaBot:DoJungle(bot)" and define what you have in X:DoJungle() and jungling_generic.Think(bot) inside of that function. What that will do is over-write the functionality of the general decision_tree DoJungle with this new implementation "ONLY FOR ENIGMA". That way you can do the same thing for Bloodseeker but with minor modifications.
Similarily, in bot_enigma.lua you can define a function called: function enigmaBot:DoRetreat(bot) if self:GetAction() == ACTION_JUNGLING then "INSERT YOUR CODE HERE" else dt:DoRetreat(bot) -- this says to use the default retreat code define in decision_tree.lua end end
In the mean time I have an idea for how to call bot specific functions from a generic implementation but I have to do some testing tonight first.
seems to work, thanks. Isn't that already calling a bot specific function from a generic one?
Can Lua check if a certain function exists for a bot? jungler could override CleanCamp(), while a default implementation is used for bots who just want to clear camps in the later stages of the game.
Providing a default implementation for CleanCamp() would have the same effect though.
Overwriting DoRetreat doesn't help, because the tree still returns after it. DoJungle will never be reached. and calling DoJungle from the bots DoRetreat doesn't seem like a good thing to do. Guess i should override AmISafe instead.
No, b/c then you would never retreat if you encounter enemies in jungle. What we need to do is change all the Do functions to return a Boolean indicating if we should return after completion or not. They would be called with local bRet = DoRetreat(bot) if bRet then return end
I will do this for all the Do functions tonight (in 2 hrs)
ok, sounds good.
Okay, it's checked in.
1) I added a boolean return to all DoXYZ functions which dictates if we return all allow fall-through to next Determine_XYZ function. This will allow you to enable Enigma's DoRetreat() to not return and fall-through to your jungle code.
2) I added a "Self" variable at initialization time of each bot to the global hero data so you can always obtain a reference to the highest level bot object (meaning the derived class, not the parent class which is decision_tree) in any generic implementation state machine which is not part of the inheritance tree. I added a test showcasing this into "laning_generic.lua" on lines 76-77. which is just a "Test()" function. I then added a "viperBot:Test()" and a "amBot:Test()" in their files, but no one for linaBot. As a result both Viper and AM will print their over-loaded message, but Lina will print instead the decision_tree Test() implementation which is the default if the derived class doesn't instantiate a called function.
Trying this in my fork. Just in case anyone is wondering.