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

how to cast skill? #39

Open
sijiaxu opened this issue Jan 15, 2019 · 20 comments
Open

how to cast skill? #39

sijiaxu opened this issue Jan 15, 2019 · 20 comments

Comments

@sijiaxu
Copy link

sijiaxu commented Jan 15, 2019

I look the dotaclient code, it seems right now it can only use three types of actions: move, attack and do nothing.
I want to cast the q,w,e,r skills in NeverMore, so is there a way to do that?

@TimZaman
Copy link
Owner

TimZaman commented Jan 15, 2019 via email

@sijiaxu
Copy link
Author

sijiaxu commented Jan 15, 2019

Oh, sad info..
but is there some ways in lua script to cast the skill, the skills of NeverMore is quite simple, no direction needed, just press q,w,e,r button..
for dataservice, can we add some custom action proto definition which refers to the lua script logic.

@Nostrademous
Copy link
Collaborator

I will implement this today if I have time in my code branch.

@Nostrademous
Copy link
Collaborator

Nostrademous commented Jan 15, 2019

In my code I currently return the following at level 1 with no abilities selected:

npc_dota_hero_nevermore abilities that can be leveled ['nevermore_shadowraze1', 'nevermore_shadowraze2', 'nevermore_shadowraze3', 'nevermore_necromastery', 'nevermore_dark_lord']

That was printed by this:
https://github.com/Nostrademous/dotaclient/blob/3201220925d790d9006977c295ff4757d947e3fa/agent.py#L525

I need to next implement the action selection, but this begs a question since certain actions are "atomic" and thus don't prevent other actions from being taken at the same time.

How do we want to model that?

@sijiaxu
Copy link
Author

sijiaxu commented Jan 16, 2019

I think it needs hard code some rules, like if I cast q skill of NeverMore, then in the following 1 second cannot execute other actions. but how do you plan to transfer this action info to Lua sides?

another problem, it also needs to check whether the skill is ready to cast right now, like check the mana, cooldown and casting distance. I look at the message Ability, maybe can get something from that.

@Nostrademous
Copy link
Collaborator

I think it needs hard code some rules, like if I cast q skill of NeverMore, then in the following 1 second cannot execute other actions. but how do you plan to transfer this action info to Lua sides?

another problem, it also needs to check whether the skill is ready to cast right now, like check the mana, cooldown and casting distance. I look at the message Ability, maybe can get something from that.

That part is easy and learnable with delays as well as hard-coded cast points if we want to be more modeled vs model-free.

Honestly, hard coding "don't do anything for next 1 second" is bad, as there will be times where it is better to cancel a cast then die trying to execute it.

All the info you ask for: 'mana, cd, distance, fully castable' I can get already

@TimZaman
Copy link
Owner

TimZaman commented Jan 16, 2019 via email

@Nostrademous
Copy link
Collaborator

Nostrademous commented Jan 16, 2019

It does via a queue trick I believe... hm... maybe not.

Perhaps we should implement a way for sending a "queue" of "atomic" actions and they get executed 1 per frame ?

@Nostrademous
Copy link
Collaborator

Nostrademous commented Jan 16, 2019

All of these can be done while doing other things. I agree, not "at the same time", but sequentially 1 per frame.

int ActionImmediate_PurchaseItem ( sItemName )
Command a bot to purchase the specified item. Item names can be found here.

ActionImmediate_SellItem( hItem )
Command a bot to sell the specified item

ActionImmediate_DisassembleItem( hItem )
Command a bot to disassemble the specified item

ActionImmediate_SetItemCombineLock( hItem, bLocked )
Command a bot to lock or unlock combining of the specified item

ActionImmediate_SwapItems( index1, index2 )
Command a bot to swap the items in index1 and index2 in their inventory. Indices are zero based with 0-5 corresponding to inventory, 6-8 are backpack and 9-15 are stash

ActionImmediate_Courier( hCourier, nAction )
Command the courier specified by hCourier to perform one of the courier Actions.

ActionImmediate_Buyback()
Tell a hero to buy back from death.

ActionImmediate_Glyph()
Tell a hero to use Glyph.

ActionImmediate_LevelAbility ( sAbilityName )
Command a bot to level an ability or a talent. Ability and talent names can be found here

ActionImmediate_Chat( sMessage, bAllChat )
Have a bot say something in team chat, bAllChat true to say to all chat instead

ActionImmediate_Ping( fXCoord, fYCoord, bNormalPing )
Command a bot to ping the specified coordinates with bNormalPing setting the ping type

@TimZaman
Copy link
Owner

TimZaman commented Jan 16, 2019 via email

@TimZaman
Copy link
Owner

TimZaman commented Jan 16, 2019 via email

@sijiaxu
Copy link
Author

sijiaxu commented Jan 16, 2019

I have a question, after we fill the protobuf message of skills/leveling/buy items, it also need to hard code the corresponding Lua execution code, is that right?

@Nostrademous
Copy link
Collaborator

I'm not sure I understand what you are asking or trying to do.

I would think that if our agent decides it wants to level an ability it would just send a message to the Lua side of our bot to do so.

https://github.com/Nostrademous/dotaservice/blob/526df38ff4b69c62d61f9e011c470de1adff73f5/dotaservice/lua/bot_generic.lua#L12

@Nostrademous
Copy link
Collaborator

I have a question, after we fill the protobuf message of skills/leveling/buy items, it also need to hard code the corresponding Lua execution code, is that right?

Yes, per my above message. Also, I swear, I think for "atomic" action you can just execute them one after the other in the same frame and the will all get done.

@Nostrademous
Copy link
Collaborator

@TimZaman do you mind if we mod the "lua" code to use the old command processor I wrote to work with the file throughput method?

https://github.com/pydota2/pydota2_archive/blob/master/pydota2/bot_code/bots/actions/cmd_processor.lua

We could then easily add all the previous functions I implemented (with some minor tweaks for debug print)
https://github.com/pydota2/pydota2_archive/tree/master/pydota2/bot_code/bots/actions

@TimZaman
Copy link
Owner

TimZaman commented Jan 16, 2019 via email

@Nostrademous
Copy link
Collaborator

Everything should be conform protobuf: if its not in the proto, we can't do it WDYT?

I would like one exception to be made for a custom protobuf class called "CustomAction" or something. This is to enable people that are writing ML-agents using DotaService to have the flexibility of implementing their own "non-primitive" actions.

What I mean is this:
Currently we are supporting actions like DOTA_UNIT_ORDER_MOVE_TO_POSITION and DOTA_UNIT_ORDER_ATTACK_TARGET but what if someone wanted to "script" a whole mode like "lane_farming" which they hard-coded scripted in lua as a function that does appropriate movements, attacks, ability usage, etc. where the ML-agent only controls switching between "modes" rather than making each and every individual primitive action.

@TimZaman
Copy link
Owner

TimZaman commented Jan 16, 2019 via email

@Nostrademous
Copy link
Collaborator

Nostrademous commented Jan 16, 2019

Haven't given it too much deep thought. On the surface probably simply:

		message CustomAction {
                        repeated int32 units = 1;
			required string action_name = 2;
		}

Then in the action processor the person could add a stub for "elseif action == 'DOTA_UNIT_ORDER_CUSTOM'" and map the action_name to the predefined lua behavior for supplied units.

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

3 participants