Comments (19)
Yeah reset
is in the order of seconds. 50 seconds would be a lot. By 'pause' I am assuming you preload games, and no you cannot do that because only one host can run one dota game at a time. So you need to run in VM's which is exactly what dotaservice does: you put it in a docker container.
from dotaservice.
Yeah
reset
is in the order of seconds. 50 seconds would be a lot. By 'pause' I am assuming you preload games, and no you cannot do that because only one host can run one dota game at a time. So you need to run in VM's which is exactly what dotaservice does: you put it in a docker container.
of cause cache with dota2 in docker containers
from dotaservice.
dotaservice bonanza at my place, these are all containers running dota:
from dotaservice.
that is not exactly what i need.
when the container is created, dota2 is not started until we call reset().
once we call the reset() we have to consume the events asap otherwise the game goes to the end.
my scenario is that: i have N core on a host, and 1 container each core.
I want to prepare N inited dota game, so that i can start next batch in 1 sec.
from dotaservice.
OK! Yes that sounds like a fair optimisation. The only way to do that must be calling reset
into dota's stdin
(its console) and somehow restart the game with all the settings exactly. I think that's going to be tricky and error-prone, and will probably hard to get stable.
from dotaservice.
found dota_pause
for console cmd
] dota_pause CDOTAGamerules:Pause = true PlayerId=0 fUnpauseDelay=3.00 fPauseDelay=0.00 --- CSODOTALobby.game_state: DOTA_GAMERULES_STATE_PRE_GAME +++ CSODOTALobby.game_state: DOTA_GAMERULES_STATE_GAME_IN_PROGRESS ] dota_pause CDOTAGamerules:Pause = false PlayerId=0 fUnpauseDelay=0.00 fPauseDelay=3.00
from dotaservice.
dota_pause twice for unpause
from dotaservice.
@TimZaman I found that the increment of world_state.dota_time is constant.
If i reset the game and sleep for long time, it seems that the dota_time is unchanged, so the dota seems synchronize with dotaservice. if thats true, we dont need pause at all.
Is that ture? how dotaservice sync with dota game?
from dotaservice.
from dotaservice.
There is a lua function that gives pause.
DebugPause() <-- that's it. no need to use console to do it necessarily.
from dotaservice.
from dotaservice.
There exist a bunch of functions that are not mentioned in any API. DebugPause() was introduced early in API development by Chris C. per my request when there were ways to crash the game via bot commands and we needed better ways to debug the situation when invalid targets and dangling unit handles existed.
I believe it is the equivalent of pressing F9 in game.
from dotaservice.
from dotaservice.
No arguments.
It doesn't wait within lua. It does return. The protobufs continue to come every X frames and the main LUA thread that controls the bots keeps iterating every frame but never enters the individual bot's Think() function. The dotaTime and the gameTime stay the same, realTime continues to increment.
This is all based from my recollection of about 2 years ago, best to just test it.
from dotaservice.
Here is when it was added:
https://dev.dota2.com/showthread.php?t=277988&highlight=DebugPause
from dotaservice.
The increment isn't contant. See my notes in NOTES.md. Dotaserivce indeed syncs with the dota game of "pauses" if you want to call it that ('blocked' is the better term). See code.
…
On Sat, Dec 15, 2018 at 11:11 AM 李睿昕 @.***> wrote: @TimZaman https://github.com/TimZaman I found that the increment of world_state.dota_time is constant. If i reset the game and sleep for long time, it seems that the dota_time is unchanged, so the dota seems synchronize with dotaservice. if thats true, we dont need pause at all. Is that ture? how dotaservice sync with dota game? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#13 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AHXSRHvVO9Zb95abpL9aDDt3_lgtyjTgks5u5Ul4gaJpZM4ZUp1y .
but consider the following code , why the increment is constant 1/3 sec?
import asyncio
import time
from grpclib.client import Channel
from dotaservice.protos.DotaService_grpc import DotaServiceStub
from dotaservice.protos.dota_gcmessages_common_bot_script_pb2 import CMsgBotWorldState
from dotaservice.protos.DotaService_pb2 import Action
from dotaservice.protos.DotaService_pb2 import Empty
from dotaservice.protos.DotaService_pb2 import Config
from dotaservice.protos.DotaService_pb2 import HostMode
from dotaservice.protos.dota_gcmessages_common_bot_script_pb2 import CMsgBotWorldState
async def main():
remote_host = '127.0.0.1'
config = Config(
ticks_per_observation=10,
host_timescale=10,
host_mode=HostMode.Value('DEDICATED'),
)
loop = asyncio.get_event_loop()
channel = Channel(remote_host, 13337, loop=loop)
env = DotaServiceStub(channel)
state = await asyncio.wait_for(env.reset(config), timeout=60)
time.sleep(10)
action_pb = CMsgBotWorldState.Action()
action_pb.actionType = CMsgBotWorldState.Action.Type.Value(
'DOTA_UNIT_ORDER_NONE')
for i in range(5):
await asyncio.sleep(i)
state = await asyncio.wait_for(env.step(Action(action=action_pb)), timeout=60)
world_state = state.world_state
print(world_state.dota_time, world_state.game_time)
channel.close()
asyncio.run(main())
the output is
-89.5666732788086 31.5665283203125
-89.23334503173828 31.899856567382812
-88.90001678466797 32.233184814453125
-88.56668853759766 32.56651306152344
-88.23336029052734 32.89984130859375
from dotaservice.
from dotaservice.
Floating point math isnt constant so the reported game time isnt perfect.
…
On Sat, Dec 15, 2018, 21:40 李睿昕 @.*** wrote: The increment isn't contant. See my notes in NOTES.md. Dotaserivce indeed syncs with the dota game of "pauses" if you want to call it that ('blocked' is the better term). See code. … <#m_-8209969957807654932_> On Sat, Dec 15, 2018 at 11:11 AM 李睿昕 @.***> wrote: @TimZaman https://github.com/TimZaman https://github.com/TimZaman I found that the increment of world_state.dota_time is constant. If i reset the game and sleep for long time, it seems that the dota_time is unchanged, so the dota seems synchronize with dotaservice. if thats true, we dont need pause at all. Is that ture? how dotaservice sync with dota game? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#13 (comment) <#13 (comment)>>, or mute the thread https://github.com/notifications/unsubscribe-auth/AHXSRHvVO9Zb95abpL9aDDt3_lgtyjTgks5u5Ul4gaJpZM4ZUp1y . but consider the following code , why the increment is constant 1/3 sec?import asyncio import time from grpclib.client import Channel from dotaservice.protos.DotaService_grpc import DotaServiceStub from dotaservice.protos.dota_gcmessages_common_bot_script_pb2 import CMsgBotWorldState from dotaservice.protos.DotaService_pb2 import Action from dotaservice.protos.DotaService_pb2 import Empty from dotaservice.protos.DotaService_pb2 import Config from dotaservice.protos.DotaService_pb2 import HostMode from dotaservice.protos.dota_gcmessages_common_bot_script_pb2 import CMsgBotWorldState async def main(): remote_host = '127.0.0.1' config = Config( ticks_per_observation=10, host_timescale=10, host_mode=HostMode.Value('DEDICATED'), ) loop = asyncio.get_event_loop() channel = Channel(remote_host, 13337, loop=loop) env = DotaServiceStub(channel) state = await asyncio.wait_for(env.reset(config), timeout=60) time.sleep(10) action_pb = CMsgBotWorldState.Action() action_pb.actionType = CMsgBotWorldState.Action.Type.Value( 'DOTA_UNIT_ORDER_NONE') for i in range(5): await asyncio.sleep(i) state = await asyncio.wait_for(env.step(Action(action=action_pb)), timeout=60) world_state = state.world_state print(world_state.dota_time, world_state.game_time) channel.close() asyncio.run(main())
the output is -89.5666732788086 31.5665283203125 -89.23334503173828 31.899856567382812 -88.90001678466797 32.233184814453125 -88.56668853759766 32.56651306152344 -88.23336029052734 32.89984130859375 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#13 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AHXSRNTaYMfJ_9tMHujjXxqycieiax5Uks5u5dy8gaJpZM4ZUp1y .
I am not focus on if it is perfectly constant.
I found that no mater how much time i sleep before calling first step().
the dota time is always -89.5666732788086.
so i don't need a 'pause' at all?
from dotaservice.
it is hard to pause the game. but i think my problem solved. now the start time is about 9s.
i found that i must call DotaServiceStub.clear before reset.
from dotaservice.
Related Issues (20)
- Dotaservice deadlocks itself HOT 1
- Time sync of radiant/dire teams upon reset not stable. HOT 10
- botcpp_dire.so and stuck at the map loading screen HOT 7
- how to remove the fog of war? HOT 8
- lane creep not spawn HOT 7
- AI vs Human/Buildin-AI play mode
- how to cast skill? HOT 20
- can not get the enemy lane creep info in world state HOT 3
- DebugDrawLine doesn't draw the correct line HOT 3
- Capture end-of-game signal HOT 2
- what the usage of actionDelay? HOT 3
- the head length of world state message is not correct HOT 5
- Dota2 Docker Error HOT 2
- Add DotaService Proto for Hero Selection HOT 3
- dota2 docker running problem HOT 9
- Minimal Working Example of client.py HOT 18
- Render in Macbook pro HOT 6
- How can i know a unit is visible to a team? HOT 2
- Docker: pull access denied for dota HOT 1
- where does the proto files come from? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotaservice.