Giter Club home page Giter Club logo

Comments (7)

sijiaxu avatar sijiaxu commented on June 17, 2024

stuck at this problem for nearly a week....can anyone give me some help?
really thanks!
@TimZaman @Nostrademous

from dotaservice.

sijiaxu avatar sijiaxu commented on June 17, 2024

I comment out

if ((step - worldstate_step_offset) % config.ticks_per_observation) == 0 then
-- print('(lua) Expecting state @ step=', step, 'dota_time=', dota_time)
-- TODO(tzaman): read the action file here, and check that it contains an
-- action with the right timestep.
action = get_new_action(dota_time, GetBot():GetPlayerID())
-- print('(lua) received action =', dump(action))
debug_text = pprint.pformat(action)
act_at_step = step + action.actionDelay -- TODO(tzaman) does this still work if not defined?
end
if step == act_at_step then
act(action)
act_at_step = nil
action = nil
end

then problem fixed..I can receive world state normally. it seems has some time-consuming thing or deadlock in these code..

from dotaservice.

Nostrademous avatar Nostrademous commented on June 17, 2024

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

from dotaservice.

TimZaman avatar TimZaman commented on June 17, 2024

from dotaservice.

sijiaxu avatar sijiaxu commented on June 17, 2024

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())

from dotaservice.

TimZaman avatar TimZaman commented on June 17, 2024

from dotaservice.

sijiaxu avatar sijiaxu commented on June 17, 2024

ok, thanks

from dotaservice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.