Results 1 to 9 of 9

Thread: GetBotNames() should pick without repetition

  1. #1
    Basic Member axetion's Avatar
    Join Date
    Jan 2017
    Posts
    40

    GetBotNames() should pick without repetition

    Currently names will sometimes be picked multiple times, since it appears to simply pick randomly as opposed to shuffling the list and then assigning each name once.

    Example:

    Code:
    function GetBotNames()
        return {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}
    end
    Result:



    As you can see bot names 1, 8 and 10 are repeated (took me only one try).

  2. #2
    Basic Member
    Join Date
    Mar 2012
    Posts
    2,012
    Already reported
    You will notice that if you switch to default bots without closing DOTA you will get custom names with default bots. Both issues were reported to Chris.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  3. #3
    I'm gonna start using only if I can select who has which name! I don't know why it is randomized in the first place!

  4. #4
    Basic Member
    Join Date
    Oct 2016
    Posts
    247
    yea i would also like to be able to assign names to certain bots (by hero, not slot), but i think random as default is best.... its the way the valve bots work.

  5. #5
    Basic Member
    Join Date
    Mar 2012
    Posts
    2,012
    Quote Originally Posted by Platinum_dota2 View Post
    I'm gonna start using only if I can select who has which name! I don't know why it is randomized in the first place!
    Prolly for diversity. The defaults are also randomized.

    However, I agree with you. I think a better option would be this:
    • replace the global GetBotNames() event with SetBotNames()
    • add a global function GetBotNames() that either returns the default ones (if SetBotNames() is missing) either the custom ones (added with SetBotNames())
    • add a global AssignBotNames() event that gets called once after SetBotNames()


    ... and add the following behavior:
    1. if AssignBotNames() is missing, then keep the as-is behavior
    2. if AssignBotNames() exists, call it and make it use an indexed table similar to the lane assignment

    This is what I am thinking:
    Code:
    function SetBotNames () -- this event is called once as it is now, replaces GetBotNames(), fills up the bot names table that is used for the bots
        return 
        {
            "bot_name1", "superbot", "dota bot", "no name", "unknown", "secret name", "me"
        }
    end
    
    function AssignBotNames() -- called once at the beginning of the game when bots "connect", after SetBotNames()
        local names = GetBotNames();  -- this is the new func that returns the bot name table (either the default names or the custom ones defined if SetBotNames() exists)
    
        return 
        { 
            [1] = names[2],
            [2] = names[10],
            [3] = names[1],
            [4] = names[11],
            [5] = names[6]
        }
    end
    Just a thought
    Maybe you guys have a better approach
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  6. #6
    Quote Originally Posted by The Nomad View Post
    Prolly for diversity. The defaults are also randomized.

    However, I agree with you. I think a better option would be this:
    • replace the global GetBotNames() event with SetBotNames()
    • add a global function GetBotNames() that either returns the default ones (if SetBotNames() is missing) either the custom ones (added with SetBotNames())
    • add a global AssignBotNames() event that gets called once after SetBotNames()


    ... and add the following behavior:
    1. if AssignBotNames() is missing, then keep the as-is behavior
    2. if AssignBotNames() exists, call it and make it use an indexed table similar to the lane assignment

    This is what I am thinking:
    Code:
    function SetBotNames () -- this event is called once as it is now, replaces GetBotNames(), fills up the bot names table that is used for the bots
        return 
        {
            "bot_name1", "superbot", "dota bot", "no name", "unknown", "secret name", "me"
        }
    end
    
    function AssignBotNames() -- called once at the beginning of the game when bots "connect", after SetBotNames()
        local names = GetBotNames();  -- this is the new func that returns the bot name table (either the default names or the custom ones defined if SetBotNames() exists)
    
        return 
        { 
            [1] = names[2],
            [2] = names[10],
            [3] = names[1],
            [4] = names[11],
            [5] = names[6]
        }
    end
    Just a thought
    Maybe you guys have a better approach
    GetBotName is fine (and I think it should be as it is) , but having an additional function like your AssignBotNames suggestion would be useful and also enough (just set the names you like inside it). If someone is not overriding it, it can fall back to the random assignments behavior (then people won't have to change anything if they don't want to).

  7. #7
    Basic Member
    Join Date
    Mar 2012
    Posts
    2,012
    Quote Originally Posted by Platinum_dota2 View Post
    GetBotName is fine (and I think it should be as it is) , but having an additional function like your AssignBotNames suggestion would be useful and also enough
    No, you are right, of course! It would break other custom bots. Then the cleanest method to get the names AND not break code is this:

    Code:
    function AssignBotNames (tNames)
    Where tNames is a table that holds the names of the bots: if GetBotNames() doesn't exist, then tNames holds the default list (Mordecai, Archy etc.) and if GetBotNames() exists then tNames returns the custom names set by GetBotNames().

    And yes, as we both said, if the function is missing, to fall back to the as-is code.


    EDIT: the pciture also shows another issue: since each team has a different VM, there should be a way to exclude the same name from appearing twice if the same script is executed on both teams.
    Last edited by The Nomad; 08-22-2017 at 01:49 PM.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  8. #8
    Basic Member
    Join Date
    Jan 2012
    Posts
    42
    The issue with repeated names is due to you submitting the same name list for both teams.

    Do a check on GetTeam() and submit different lists with at least 5 names for radiant/dire to get unique names.

    That said, a way to set names for specific slots (and with that heroes) would be nice.

  9. #9
    Basic Member
    Join Date
    Dec 2016
    Posts
    46
    Yeah, I also think it is nice to assign a specific name to a particular hero. So that we can give a specific hero to assign a suitable professional player nickname!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •