Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Generic Hero Values #31

Open
Nostrademous opened this issue Jan 4, 2019 · 4 comments
Open

Using Generic Hero Values #31

Nostrademous opened this issue Jan 4, 2019 · 4 comments

Comments

@Nostrademous
Copy link
Collaborator

Nostrademous commented Jan 4, 2019

As we train the AI to do actions we should train on general data values rather than values trained to specific hero names/IDs. What I mean, rather than training an Antimage bot and then separately on say Earthshaker, we should rather train on a hero with certain characteristics like "base move speed", "turn rate", "attack range", etc.

The learned behavior for map navigation say for a hero with same base movement speed and turn rate should be the same irregardless of what hero it actually is.

Similarly, we can do this for units and abilities/items to generalize the learning process.

I have written a python file to auto-generate JSON files for heroes, units, and abilities from the Dota2 provided .txt files. I've pushed the script in the other repo to separate it from the dotaservice.

Link: https://github.com/pydota2/pydota2/blob/master/patching/generate_json_files.py

Here is what the python file pulls from the Dota2 resource files for Antimage:

    "1": {
        "Name": "npc_dota_hero_antimage",
        "Talents": {
            "Talent_1": "special_bonus_strength_10",
            "Talent_2": "special_bonus_attack_speed_20",
            "Talent_3": "special_bonus_unique_antimage_3",
            "Talent_4": "special_bonus_agility_15",
            "Talent_5": "special_bonus_unique_antimage_5",
            "Talent_6": "special_bonus_unique_antimage",
            "Talent_7": "special_bonus_unique_antimage_4",
            "Talent_8": "special_bonus_unique_antimage_2"
        },   
        "ArmorPhysical": -1,
        "AttackRate": 1.4, 
        "AttackRange": 150, 
        "ProjectileSpeed": 0,
        "AttributeBaseStrength": 23,
        "AttributeStrengthGain": 1.3, 
        "AttributeBaseIntelligence": 12,
        "AttributeIntelligenceGain": 1.8, 
        "AttributeBaseAgility": 22,
        "AttributeAgilityGain": 2.8, 
        "MovementSpeed": 310, 
        "MovementTurnRate": 0.5
    }, 

Reason for this design is to allow for much faster/easier response to new Dota2 patches coming down in the future. All you need to do is run the python script and it will auto generate the data which we can use in agent training.

@TimZaman
Copy link
Owner

TimZaman commented Jan 4, 2019 via email

@TimZaman
Copy link
Owner

TimZaman commented Jan 4, 2019 via email

@Nostrademous
Copy link
Collaborator Author

Nostrademous commented Jan 4, 2019

Hmmm.. but all this information is already in the worldstate though?
Not all. Talents are not. Turn Rate is not. Per-Level-Gain for Str/Agi/Int is not.

More important, for abilities, the casting point, casting behavior and targeting values are not in the protobuf. Here is an example of what I dump:

    "5012": {
        "Name": "bane_enfeeble",
        "TargetMask": 2,
        "TargetTeam": 1,
        "Castpoint": [
            0.3   
        ],    
        "Cooldown": [
            12.0, 
            10.0, 
            8.0,  
            6.0   
        ],    
        "Manacost": [
            70.0, 
            90.0, 
            110.0,
            130.0 
        ]     
    },
    "5006": {
        "Name": "antimage_mana_void",
        "Ultimate": 1,
        "AOE": 1,
        "TargetMask": 2,
        "TargetTeam": 1,
        "DamageType": 2,
        "Castpoint": [
            0.3,  
            0.3,  
            0.3,  
            0.3   
        ],    
        "Cooldown": [
            70.0, 
            70.0, 
            70.0  
        ],    
        "Manacost": [
            125.0,
            200.0,
            275.0 
        ]     
    }, 

Although indeed talents are not. Can you get the levelable abilities?

I implemented code for that before based on world state
https://github.com/pydota2/pydota2_archive/blob/master/pydota2/lib/world_data.py#L538

@Nostrademous
Copy link
Collaborator Author

To clarify some of the values:
TargetMask:

                    if line.find("DOTA_ABILITY_BEHAVIOR_POINT") >= 0:
                        tgt_mask |= 1
                    if line.find("DOTA_ABILITY_BEHAVIOR_UNIT_TARGET") >= 0:
                        tgt_mask |= 2
                    if line.find("DOTA_ABILITY_BEHAVIOR_NO_TARGET") >= 0:
                        tgt_mask |= 4  

TargetTeam:

                    if line.find("DOTA_UNIT_TARGET_TEAM_ENEMY") >= 0:
                        tgt_team = 1 
                    elif line.find("DOTA_UNIT_TARGET_TEAM_FRIENDLY") >= 0:
                        tgt_team = 2 
                    elif line.find("DOTA_UNIT_TARGET_TEAM_BOTH") >= 0:
                        tgt_team = 3 
                    elif line.find("DOTA_UNIT_TARGET_TEAM_CUSTOM") >= 0:
                        tgt_team = 4 

DamageType:

                    if line.find("DAMAGE_TYPE_PURE") >= 0:
                        dmg_type = 3 
                    elif line.find("DAMAGE_TYPE_MAGICAL") >= 0:
                        dmg_type = 2 
                    elif line.find("DAMAGE_TYPE_PHYSICAL") >= 0:
                        dmg_type = 1 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants