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

WIP - hero selection #51

Closed
wants to merge 0 commits into from
Closed

Conversation

Nostrademous
Copy link
Collaborator

WIP for now. Starts setting us up for better hero selection and various game modes other than 1v1.

This works and does not break current code but is not fully complete yet in terms of providing us a way to specify hero selections through API.

@Nostrademous
Copy link
Collaborator Author

Dotaservice is ready for solving #50

Need Dotaclient to write the 'bots/selections_t' .. GetTeam() file though


-- Function below sets the lane assignments for default bots
-- Obviously, our own agents will do what they belive best
function UpdateLaneAssignments()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we care about lane assignments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's only if we plan on playing with the default bots. It forces the default bots to not try and assume the mid-lane is empty for example when all your bot (or you as a human) did was go get the off-lane rune at spawn time.

If we are just doing 5v5 full-agent (or 1v1 self-play) than it doesn't matter to us at all.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah i would love to have 1v1 against default bot working to validate my self play. I actually want that ASAP.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw can you add what you just said as comment

dotaservice/__init__.py Outdated Show resolved Hide resolved
@@ -16,25 +61,67 @@ function GetBotNames ()
}
end

local bot_heroes = {"npc_dota_hero_nevermore"}
local function mode1v1()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there per-mode picks?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it this way as if we ever want to extend to non AllPick game modes we will have the flexibility.

Captain's Mode - the traditional tournament mode is - has Ban, Pick, Ban, Pick, Ban, Pick sequence which is not present in All Pick for example. Hence why the logic would have to be different. Additionally, only in Lobby's can you pick all the heroes at once and not worry about pick order.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we generalize abilities enough we could support Ability Draft game modes too which would be super amazing.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well yeah but its often easier to work in small chunks of work at a time to unblock. If you get this working it'd amazing though. It will involve a bunch of back and forth between dotaservice and the agent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my worry is that I don't think the protobuf messages during hero selection work properly though. In all my testing a year ago they did not notify you of hero selections performed thus far... all the protobuf parameters were empty..... :(

I need to see if that's been fixed. If not, might be a good question to ask OpenAI since they had it working.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think OpenAI has their own addon

@TimZaman
Copy link
Owner

TimZaman commented Feb 7, 2019

What's your high level view and flow of things?
To keep it manageable we probably want to communicate only 1x with an initial static config of what we want to pick and control

@Nostrademous
Copy link
Collaborator Author

I don't think we can do only a one-time in any mode other than generic bot mode. We should not be picking heroes already picked by the other side for one (so we need to be able to send updated picks in response to enemy picks); for two the concept of counter-picking can only be achieved through iterative picks; for three under Captain's Mode there is also the concept of bans (which should be strategic). Obviously, some of these are way out there in the future as we are not ready yet, but I tend to architect for the future case if it doesn't detract or distract from the current need.

@TimZaman
Copy link
Owner

TimZaman commented Feb 7, 2019 via email

@TimZaman
Copy link
Owner

TimZaman commented Feb 7, 2019 via email

@Nostrademous
Copy link
Collaborator Author

I think we have no choice for now. I did verify and all the world-state protobufs during Hero Selection (game_state == 2) are basically empty and do not contain hero_selected values. So I have no way of knowing what heroes were picked (short of reading the console.log)

@TimZaman
Copy link
Owner

TimZaman commented Feb 8, 2019 via email

@Nostrademous
Copy link
Collaborator Author

Got the data extracted from our monitor_logs() function.

AGMP:dotaservice andrzej.gorski$ python -m dotaservice
2019-02-08 13:22:51,461 INFO     DotaService 0.3.8 serving on :13337
2019-02-08 13:22:56,040 INFO     DotaService::reset()
2019-02-08 13:23:00,399 INFO     PlayerID: 0, NAME: npc_dota_hero_nevermore
2019-02-08 13:23:00,399 INFO     PlayerID: 5, NAME: npc_dota_hero_nevermore
2019-02-08 13:23:00,807 INFO     PlayerID: 1, NAME: npc_dota_hero_antimage
2019-02-08 13:23:00,807 INFO     PlayerID: 6, NAME: npc_dota_hero_antimage
2019-02-08 13:23:01,410 INFO     PlayerID: 2, NAME: npc_dota_hero_lion
2019-02-08 13:23:01,411 INFO     PlayerID: 7, NAME: npc_dota_hero_lion
2019-02-08 13:23:01,816 INFO     PlayerID: 3, NAME: npc_dota_hero_bane
2019-02-08 13:23:01,816 INFO     PlayerID: 8, NAME: npc_dota_hero_bane
2019-02-08 13:23:02,423 INFO     PlayerID: 4, NAME: npc_dota_hero_rattletrap
2019-02-08 13:23:02,423 INFO     PlayerID: 9, NAME: npc_dota_hero_rattletrap

@Nostrademous
Copy link
Collaborator Author

For now I'm just printing them... need help in the software architecture side of how you would want to "record" them or "store" them.

@Nostrademous
Copy link
Collaborator Author

@TimZaman Implemented a gRPC Hero Selection protobuf Message format. Still need to hook it up to dota_game actions but the messaging format should be done barring objections or recommendations from you

setup.py Outdated
@@ -5,7 +5,7 @@

setuptools.setup(
name="dotaservice",
version="0.3.7",
version="0.3.8",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave this to me

SELECTION_TYPE_PICK = 0;
SELECTION_TYPE_BAN = 1;
// For Ability Draft
SELECTION_TYPE_ABILITY_PICK = 2;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only add this in if it actually works, otherwise comment out of not add

message Empty {}

message HeroSelection {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is really great to get us started - how do you envison the information of the opposite pick to be returned?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how do we specify how we set up the game? How do we specify if we want to control the bots, or if we want to use default bots?

@TimZaman
Copy link
Owner

TimZaman commented Feb 9, 2019

Looks great. I'm hoping to add ability usage to the dotaclient this weekend. Also, I tested the optimizer on a Titan Volta, and I can train 20.000 steps/s (in CPU I currently max out at ~300 steps/s). Notice that at 2 ticks per second, that's 3 hours of dota per second (!). The bad thing is, that the agents go at ~15 steps/s. That saturates around 150% CPU. So to saturate 20.000 steps/s, i need something in the order of 1300 CPUs.

@Nostrademous
Copy link
Collaborator Author

Can you hold off on abilities if possible?

I want to have a discussion on embedding parameters for units and abilities first. Not sure if you enabled the wiki extension for this github project but please if you can so we can discuss without having to use issues to have a conversation.

@Nostrademous
Copy link
Collaborator Author

Starting writing some notes here:
https://github.com/Nostrademous/dotaservice/wiki/Discussions

@TimZaman
Copy link
Owner

TimZaman commented Feb 9, 2019 via email

@TimZaman
Copy link
Owner

TimZaman commented Feb 9, 2019

Your design is fair, but it's too ambitious for now, I want to just take incremental steps while maintaining sanity and make sure that things work, and not to add too much complication. Your suggested new rewards help with that, but I like to have independent rewards because that really helps debugging.

@Nostrademous
Copy link
Collaborator Author

So I have tested this and it works, but not at 10x timespeed... the drafting ends before we can make enough decisions going pick, wait for other team to pick, then pick, then wait, then pick...

@TimZaman
Copy link
Owner

TimZaman commented Feb 12, 2019 via email

@Nostrademous
Copy link
Collaborator Author

I agree with you, but I'm not as familiar with async io in Python 3.7 and all you can do with it. Perhaps you can take a look?

I will do a PR on the dotaclient side as well that works with this dotaservice

@TimZaman
Copy link
Owner

TimZaman commented Feb 12, 2019 via email

@Nostrademous
Copy link
Collaborator Author

Did you do while True to force blocking in Lua? I feel like that's why you did that and now I get why... although I don't like it.

@TimZaman
Copy link
Owner

TimZaman commented Feb 12, 2019 via email

@Nostrademous
Copy link
Collaborator Author

Okay, using same type of setup (meaning I'm blocking) I can support individual hero drafting at any time-speed.

@Nostrademous
Copy link
Collaborator Author

@TimZaman pushed working hero selection system.

The way it works is that currently it picks a randomly (I did this for future fun, it can be made non-random, but it is deterministic across the complete selection) un-picked player index slot on RADIANT TEAM (default - we can have it randomly choose which side picks first in the future) and picks a hero for that slot. For 1st slot on each side Nevermore is chosen, for all other slots it's Sniper. Once a RADIANT pick is detected, the DIRE team then picks a hero following same rules. This goes back and forth like this until 10 heroes are chosen and accounted for.

Code was written like this so that future pivots to Captain's Mode which include Ban Phases is trivial.

Example of DotaService INFO:

AGMP:dotaservice andrzej.gorski$ python -m dotaservice
2019-02-12 15:31:10,037 INFO     DotaService 0.3.7 serving on :13337
2019-02-12 15:31:17,733 INFO     DotaService::reset()
2019-02-12 15:31:22,295 INFO     PlayerID: 0, NAME: npc_dota_hero_nevermore
2019-02-12 15:31:23,308 INFO     PlayerID: 9, NAME: npc_dota_hero_sniper
2019-02-12 15:31:24,519 INFO     PlayerID: 4, NAME: npc_dota_hero_sniper
2019-02-12 15:31:25,734 INFO     PlayerID: 6, NAME: npc_dota_hero_sniper
2019-02-12 15:31:26,950 INFO     PlayerID: 2, NAME: npc_dota_hero_sniper
2019-02-12 15:31:28,160 INFO     PlayerID: 5, NAME: npc_dota_hero_nevermore
2019-02-12 15:31:29,178 INFO     PlayerID: 1, NAME: npc_dota_hero_sniper
2019-02-12 15:31:30,385 INFO     PlayerID: 7, NAME: npc_dota_hero_sniper
2019-02-12 15:31:31,594 INFO     PlayerID: 3, NAME: npc_dota_hero_sniper
2019-02-12 15:31:32,810 INFO     PlayerID: 8, NAME: npc_dota_hero_sniper
2019-02-12 15:32:29,944 INFO     DotaService::reset()
2019-02-12 15:32:34,736 INFO     PlayerID: 4, NAME: npc_dota_hero_sniper
2019-02-12 15:32:35,746 INFO     PlayerID: 5, NAME: npc_dota_hero_nevermore
2019-02-12 15:32:36,956 INFO     PlayerID: 3, NAME: npc_dota_hero_sniper
2019-02-12 15:32:38,168 INFO     PlayerID: 6, NAME: npc_dota_hero_sniper
2019-02-12 15:32:39,184 INFO     PlayerID: 0, NAME: npc_dota_hero_nevermore
2019-02-12 15:32:40,393 INFO     PlayerID: 7, NAME: npc_dota_hero_sniper
2019-02-12 15:32:41,409 INFO     PlayerID: 1, NAME: npc_dota_hero_sniper
2019-02-12 15:32:42,614 INFO     PlayerID: 9, NAME: npc_dota_hero_sniper
2019-02-12 15:32:43,821 INFO     PlayerID: 2, NAME: npc_dota_hero_sniper
2019-02-12 15:32:45,033 INFO     PlayerID: 8, NAME: npc_dota_hero_sniper
2019-02-12 15:33:53,798 INFO     DotaService::reset()
2019-02-12 15:33:58,591 INFO     PlayerID: 4, NAME: npc_dota_hero_sniper
2019-02-12 15:33:59,605 INFO     PlayerID: 8, NAME: npc_dota_hero_sniper
2019-02-12 15:34:00,820 INFO     PlayerID: 1, NAME: npc_dota_hero_sniper
2019-02-12 15:34:02,026 INFO     PlayerID: 6, NAME: npc_dota_hero_sniper
2019-02-12 15:34:03,237 INFO     PlayerID: 0, NAME: npc_dota_hero_nevermore
2019-02-12 15:34:04,447 INFO     PlayerID: 9, NAME: npc_dota_hero_sniper
2019-02-12 15:34:05,660 INFO     PlayerID: 3, NAME: npc_dota_hero_sniper
2019-02-12 15:34:06,870 INFO     PlayerID: 5, NAME: npc_dota_hero_nevermore
2019-02-12 15:34:07,888 INFO     PlayerID: 2, NAME: npc_dota_hero_sniper
2019-02-12 15:34:09,095 INFO     PlayerID: 7, NAME: npc_dota_hero_sniper
2019-02-12 15:35:19,603 INFO     DotaService::reset()

@Nostrademous
Copy link
Collaborator Author

Moving code to a branch until you are ready for it so I can continue working on other stuff.

@TimZaman
Copy link
Owner

TimZaman commented Feb 15, 2019 via email

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

Successfully merging this pull request may close these issues.

2 participants