Closed sijiaxu closed 5 years ago
stuck at this problem for nearly a week....can anyone give me some help? really thanks! @TimZaman @Nostrademous
I comment out https://github.com/TimZaman/dotaservice/blob/5a413e3ae2290e8aed65b56da9e1550949a78d59/dotaservice/lua/bot_generic.lua#L174-L190 then problem fixed..I can receive world state normally. it seems has some time-consuming thing or deadlock in these code..
Purely from memory - I would think ‘get_new_action’ is the issue as it expects a file to be written by the gRPC client that the bots read from the bots directory. Perhaps it doesn’t have a timeout. On phone so hard to check
I think you are using an old example, and the api changed meanwhile.
On Thu, Jan 10, 2019 at 4:30 AM Nostrademous notifications@github.com wrote:
Purely from memory - I would think ‘get_new_action’ is the issue as it expects a file to be written by the gRPC client that the bots read from the bots directory. Perhaps it doesn’t have a timeout. On phone so hard to check
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TimZaman/dotaservice/issues/35#issuecomment-453079716, or mute the thread https://github.com/notifications/unsubscribe-auth/AHXSRIyo8BFQAGsKhbVf0Kg4vkrBPXPzks5vBzJUgaJpZM4Z04jh .
Purely from memory - I would think ‘get_new_action’ is the issue as it expects a file to be written by the gRPC client that the bots read from the bots directory. Perhaps it doesn’t have a timeout. On phone so hard to check
yes, that may be a problem, my test client just use the observe rpc, so the lua is blocking at this function.
from grpclib.client import Channel
from dotaservice.protos.DotaService_grpc import DotaServiceStub
from dotaservice.protos.DotaService_pb2 import GameConfig
from dotaservice.protos.DotaService_pb2 import Actions
from dotaservice.protos.DotaService_pb2 import ObserveConfig, Status
from dotaservice.protos.DotaService_pb2 import TEAM_RADIANT, TEAM_DIRE
import asyncio
from dotaservice.protos.dota_gcmessages_common_bot_script_pb2 import CMsgBotWorldState
from dotaservice.protos.dota_shared_enums_pb2 import DOTA_GAMEMODE_1V1MID
import time
async def game_init():
await env.reset(GameConfig(ticks_per_observation=10, host_mode=1))#, game_mode=DOTA_GAMEMODE_1V1MID))
print("init finish")
for i in range(1000):
action_pb = CMsgBotWorldState.Action()
action_pb.actionType = CMsgBotWorldState.Action.Type.Value('DOTA_UNIT_ORDER_NONE')
actions_pb = CMsgBotWorldState.Actions(actions=[action_pb])
execute_action = Actions(actions=actions_pb, team_id=TEAM_RADIANT)
#await env.act(execute_action)
response = await env.observe(ObserveConfig(team_id=TEAM_RADIANT))
if response.status != Status.Value('OK'):
print("response status %s"%str(response.status))
obs = response.world_state
dota_time = obs.dota_time
print("cur time %s" %str(dota_time))
time.sleep(1)
print("finish")
return
# Connect to the DotaService.
cur_loop = asyncio.get_event_loop()
env = DotaServiceStub(Channel('127.0.0.1', 13337, loop=cur_loop))
# Get the initial observation.
cur_loop.run_until_complete(game_init())
Check out my other projecr called dotaclient btw
On Thu, Jan 10, 2019, 18:51 sijia xu <notifications@github.com wrote:
Purely from memory - I would think ‘get_new_action’ is the issue as it expects a file to be written by the gRPC client that the bots read from the bots directory. Perhaps it doesn’t have a timeout. On phone so hard to check
yes, that may be a problem, my test client just use the observe rpc, so the lua is blocking at this function.
from grpclib.client import Channel
from dotaservice.protos.DotaService_grpc import DotaServiceStub
from dotaservice.protos.DotaService_pb2 import GameConfig
from dotaservice.protos.DotaService_pb2 import Actions
from dotaservice.protos.DotaService_pb2 import ObserveConfig, Status
from dotaservice.protos.DotaService_pb2 import TEAM_RADIANT, TEAM_DIRE
import asyncio
from dotaservice.protos.dota_gcmessages_common_bot_script_pb2 import CMsgBotWorldState
from dotaservice.protos.dota_shared_enums_pb2 import DOTA_GAMEMODE_1V1MID
import time
async def game_init():
await env.reset(GameConfig(ticks_per_observation=10, host_mode=1))#, game_mode=DOTA_GAMEMODE_1V1MID)) print("init finish") for i in range(1000): action_pb = CMsgBotWorldState.Action() action_pb.actionType = CMsgBotWorldState.Action.Type.Value('DOTA_UNIT_ORDER_NONE') actions_pb = CMsgBotWorldState.Actions(actions=[action_pb]) execute_action = Actions(actions=actions_pb, team_id=TEAM_RADIANT) #await env.act(execute_action) response = await env.observe(ObserveConfig(team_id=TEAM_RADIANT)) if response.status != Status.Value('OK'): print("response status %s"%str(response.status)) obs = response.world_state dota_time = obs.dota_time print("cur time %s" %str(dota_time)) time.sleep(1) print("finish") return
Connect to the DotaService.
cur_loop = asyncio.get_event_loop()
env = DotaServiceStub(Channel('127.0.0.1', 13337, loop=cur_loop))
Get the initial observation.
cur_loop.run_until_complete(game_init())
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TimZaman/dotaservice/issues/35#issuecomment-453355616, or mute the thread https://github.com/notifications/unsubscribe-auth/AHXSRNUi_ZPY-XsA4_wwN3qvX6eHV4t8ks5vB_wmgaJpZM4Z04jh .
ok, thanks
I notice the error log after launching the game
it seems needs to compile both botcpp_radiant.so and botcpp_dire.so, I use the same command except the -o option parameter to compile both libraries.
g++ -shared -o botcpp_radiant.so -fPIC botcpp_radiant.cpp dota_gcmessages_common_bot_script.pb.cc -std=c++11 -lprotobuf
I also modified the code to copy .so to bots folder https://github.com/TimZaman/dotaservice/blob/172087f8ea38a7d650632702ea780523e4fd565d/dotaservice/dotaservice.py#L159-L160
but this throws many errors and terminate the game
I also test the dotaservice without copy libraries and only copy radiant libraries, although not come to above error, the game all stuck at the map loading screen(in gui mode) and my client can not receive any normal observation.
below is the dota console log save in bots folder
and I redirect dotaservice's log to local file, it looks like before enter the game the world state is received normally, but after enter the game it disappear and the observe function wait 10 seconds to raise a timeout error.
any suggestions?