google-deepmind / pysc2

StarCraft II Learning Environment
Apache License 2.0
8.03k stars 1.16k forks source link

replay_actions isn't generic and doesn't do what you'd expect #51

Open xuhuazhe opened 7 years ago

xuhuazhe commented 7 years ago

Hi, I used a Ubuntu16.06 and installed the game successfully. All the functions work well except for running python -m pysc2.bin.replay_actions --replays='/home/hxu/StarCraftII/Replays/Replays/f57ab36fd55aad2bf3b24645fe37c16824f4af1eb6a08654be43381a8ed2eef0.SC2Replay'. Here is what I've got. There are partial stats but not sequential events or state-action pairs.

Getting replay list: /home/hxu/StarCraftII/Replays/Replays/f57ab36fd55aad2bf3b24645fe37c16824f4af1eb6a08654be43381a8ed2eef0.SC2Repl ay 1 replays found.

[0] Starting up a new SC2 instance. Version: B55958 (SC2.3.16) Build: Jul 31 2017 13:19:41 Command Line: '"/home/hxu/StarCraftII/Versions/Base55958/SC2_x64" -listen 127.0.0.1 -port 21645 -dataDir /home/hxu/StarCraftII/ -te mpDir /tmp/sc-5QgJ1W/ -displayMode 0' Starting up... Startup Phase 1 complete Startup Phase 2 complete Creating stub renderer... Listening on: 127.0.0.1:21645 (21645) Startup Phase 3 complete. Ready for commands. [0] SC2 Started successfully. [0] Got replay: /home/hxu/StarCraftII/Replays/Replays/f57ab36fd55aad2bf3b24645fe37c16824f4af1eb6a08654be43381a8ed2eef0.SC2Replay [0] ------------------ Replay Info f57ab36fd5 ------------------ [0] map_name: "Catallena LE (Void)" [0] player_info { [0] player_info { [0] player_id: 1 [0] race_requested: Terran [0] race_actual: Terran [38/1813] [0] } [0] player_result { [0] player_id: 1 [0] result: Defeat [0] } [0] player_mmr: 3437 [0] player_apm: 83 [0] } [0] player_info { [0] player_info { [0] player_id: 2 [0] race_requested: Zerg [0] race_actual: Zerg [0] } [0] player_result { [0] player_id: 2 [0] result: Victory [0] } [0] player_mmr: 3381 [0] player_apm: 107 [0] } [0] game_duration_loops: 23529 [0] game_duration_seconds: 1050.47509766 [0] game_version: "3.16.1.55958" [0] data_build: 55958 [0] base_build: 55958 [0] data_version: "5BD7C31B44525DAB46E64C4602A81DC2" [0] ------------------------------------------------------------ [0] Starting f57ab36fd5 from player 1's perspective ============================================= Summary 10 secs ============================================= Replays: 0, Steps total: 0

Camera move: 0, Select pt: 0, Select rect: 0, Control group: 0

Maps: 1 {Catallena LE (Void): 1}

Races: 2 {Zerg: 1, Terran: 1}

Unit ids: 0 {}

Valid abilities: 0 {}

Made abilities: 0 {}

Valid actions: 0 {}

Made actions: 0 {} Races: 2 {Zerg: 1, Terran: 1}

Unit ids: 0 {}

Valid abilities: 0 {}

Made abilities: 0 {}

Valid actions: 0 {}

Made actions: 0 {}

Crashing replays: 0 []

Invalid replays: 0 [] ---------------------------------------------- Process stats ---------------------------------------------- [ 0] replay: f57ab36fd5, replays: 0, steps: 0, game loops: 0, last: start_replay, 0 s ago

tewalds commented 7 years ago

Hmm, I've mainly used replay_actions to look at stats over many replays. It's quite possible there's a bug in the termination condition for a single replay. It probably also doesn't do what you are expecting it to do. It just outputs which actions are popular. This was mainly useful for figuring out the action space, not for training agents. It should be a good example of how to parse through a large number of replays though. You can then do whatever you want with the observations.

tewalds commented 7 years ago

It'd be nice if replay_actions was split between the replay parser and the analysis so it could let you do more than collect stats about actions. It'd be good to have that as one option, but it would be nice for it to be easy to write your own that just took observations and could do whatever it wants with them, but without having to deal with starting up the game, doing the parallelism stuff, etc. This would be analogous to bin/agent.py which lets you pass in an agent of your own.

EveLIn3 commented 6 years ago

Hi tewalds, @tewalds I am having the same problem as xuhuazhe using replay_actions.py also the scrapper version from cole_maclean as well.

The replay info will show up, but not for the actions:

Getting replay list: D:\StarCraft II\Replays\gold1.SC2Replay 1 replays found.

[0] Starting up a new SC2 instance. [0] SC2 Started successfully. [0] Got replay: D:\StarCraft II\Replays\gold1.SC2Replay [0] --------------- Replay Info gold1.SC2Replay ---------------- [0] map_name: "\351\234\223\350\231\271\345\271\277\345\234\272 - \345\244\251\346\242\257\347\211\210" [0] player_info { [0] player_info { [0] player_id: 1 [0] race_requested: Terran [0] race_actual: Terran [0] } [0] player_result { [0] player_id: 1 [0] result: Victory [0] } [0] player_apm: 260 [0] } [0] player_info { [0] player_info { [0] player_id: 2 [0] race_requested: Protoss [0] race_actual: Protoss [0] } [0] player_result { [0] player_id: 2 [0] result: Defeat [0] } [0] player_mmr: 3103 [0] player_apm: 92 [0] } [0] game_duration_loops: 10538 [0] game_duration_seconds: 470.479248046875 [0] game_version: "4.1.3.61021" [0] data_build: 61021 [0] base_build: 60321 [0] data_version: "F486693E00B2CD305B39E0AB254623EB" [0] ------------------------------------------------------------ [0] Starting gold1.SC2Replay from player 1's perspective ============================================= Summary 100 secs ============================================ Replays: 0, Steps total: 0

Camera move: 0, Select pt: 0, Select rect: 0, Control group: 0

Maps: 1 {Neon - LDE: 1}

Races: 2 {Terran: 1, Protoss: 1}

Unit ids: 0 {}

Valid abilities: 0 {}

Made abilities: 0 {}

Valid actions: 0 {}

Made actions: 0 {}

Crashing replays: 0 []

Invalid replays: 0 [] ---------------------------------------------- Process stats ---------------------------------------------- [ 0] replay: gold1.SC2Replay, replays: 0, steps: 0, game loops: 0, last: start_replay, 9 s ago

I am using the newest SC2 version 4.1.3 with a replay produced in the same version.

You mentioned you are only using replay_actions.py to see statistics, If i understand it correctly, this script should allow us to see how many units one player have at a given time? can it?

Thank you for your help!