Games-and-Simulations / sc-docker

Multi-platform Version of StarCraft: Brood War in a Docker Container, ready to use for bot play simulations.
MIT License
231 stars 40 forks source link

Games run very slow on Mac in 0.2b3 #29

Closed MicroDK closed 6 years ago

MicroDK commented 6 years ago

expected behaviour

Running headful in the new version 0.2b3 on Mac, the game runs very slow. CherryPi shows about 15 fps with --game_speed 10. Even with --game_speed 0 it runs at about 15 fps.

actual behaviour

In version 0.2b2 the game ran at about 48 fps with --game_speed 10.

steps to reproduce

output of command scbw.play --bots "Marian Devecka" "CherryPi" --show_all --game_speed 10 --log_level=DEBUG

DEBUG checking bot in /Users/micky/.scbw/bots/Marian Devecka DEBUG found bot in /Users/micky/.scbw/bots/Marian Devecka DEBUG checking bot in /Users/micky/.scbw/bots/CherryPi DEBUG found bot in /Users/micky/.scbw/bots/CherryPi DEBUG ['docker', 'run', '-d', '--privileged', '--name', 'GAME_602E0337_0_Marian_Devecka', '--volume', '/Users/micky/.scbw/logs:/app/logs:rw', '--volume', '/Users/micky/.scbw/bots:/app/bots:ro', '--volume', '/Users/micky/.scbw/maps:/app/sc/maps:rw', '--volume', '/Users/micky/.scbw/bwapi-data/BWTA:/app/sc/bwapi-data/BWTA:rw', '--volume', '/Users/micky/.scbw/bwapi-data/BWTA2:/app/sc/bwapi-data/BWTA2:rw', '--net', 'sc_net', '-p', '5900:5900', '--volume', '/Users/micky/.scbw/bots/Marian Devecka/write/GAME_602E0337_0:/app/sc/bwapi-data/write:rw', '-e', 'PLAYER_NAME=Marian Devecka', '-e', 'PLAYER_RACE=Z', '-e', 'NTH_PLAYER=0', '-e', 'NUM_PLAYERS=2', '-e', 'GAME_NAME=GAME_602E0337', '-e', 'MAP_NAME=/app/sc/maps/sscai/(2)Benzene.scx', '-e', 'GAME_TYPE=FREE_FOR_ALL', '-e', 'SPEED_OVERRIDE=10', '-e', 'BOT_NAME=Marian Devecka', '-e', 'BOT_FILE=KillerBot.dll', '-e', 'BOT_BWAPI=4.1.2', '-e', 'TM_LOG_RESULTS=../logs/GAME_602E0337_0_results.json', '-e', 'TM_LOG_FRAMETIMES=../logs/GAME_602E0337_0_frames.csv', 'starcraft:game', '/app/play_bot.sh', '--headful'] INFO launched BotPlayer:Marian Devecka:Z in container GAME_602E0337_0_Marian Devecka DEBUG ['docker', 'run', '-d', '--privileged', '--name', 'GAME_602E0337_1_CherryPi', '--volume', '/Users/micky/.scbw/logs:/app/logs:rw', '--volume', '/Users/micky/.scbw/bots:/app/bots:ro', '--volume', '/Users/micky/.scbw/maps:/app/sc/maps:rw', '--volume', '/Users/micky/.scbw/bwapi-data/BWTA:/app/sc/bwapi-data/BWTA:rw', '--volume', '/Users/micky/.scbw/bwapi-data/BWTA2:/app/sc/bwapi-data/BWTA2:rw', '--net', 'sc_net', '-p', '5901:5900', '--volume', '/Users/micky/.scbw/bots/CherryPi/write/GAME_602E0337_1:/app/sc/bwapi-data/write:rw', '-e', 'PLAYER_NAME=CherryPi', '-e', 'PLAYER_RACE=Z', '-e', 'NTH_PLAYER=1', '-e', 'NUM_PLAYERS=2', '-e', 'GAME_NAME=GAME_602E0337', '-e', 'MAP_NAME=/app/sc/maps/sscai/(2)Benzene.scx', '-e', 'GAME_TYPE=FREE_FOR_ALL', '-e', 'SPEED_OVERRIDE=10', '-e', 'BOT_NAME=CherryPi', '-e', 'BOT_FILE=BWEnv.dll', '-e', 'BOT_BWAPI=4.2.0', '-e', 'TM_LOG_RESULTS=../logs/GAME_602E0337_1_results.json', '-e', 'TM_LOG_FRAMETIMES=../logs/GAME_602E0337_1_frames.csv', 'starcraft:game', '/app/play_bot.sh', '--headful'] INFO launched BotPlayer:CherryPi:Z in container GAME_602E0337_1_CherryPi INFO Checking if game has launched properly... DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] INFO Launching vnc viewer for BotPlayer:Marian Devecka:Z on port 5900 INFO Launching vnc viewer for BotPlayer:CherryPi:Z on port 5901 INFO In headful mode, you must specify and start the game manually. Select the map, wait for bots to join the game and then start the game. INFO Waiting until game is finished... DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] ^CWARNING Caught interrupt, shutting down containers WARNING This can take a moment, please wait. DEBUG running containers: ['a0d99f178f6f', '05ff60c78cce'] a0d99f178f6f 05ff60c78cce INFO Game cancelled.

GAME_6B910888_1_CherryPi_game.log:

2018-02-14T08:35:52 Starting game /app/sc /app fixme:winediag:start_process Wine Staging 2.20 is a testing version containing experimental patches. fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org. fixme:ntdll:EtwEventRegister ({5eec90ab-c022-44b2-a5dd-fd716a222a15}, 0x301123, 0x328020, 0x328038) stub. fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 0x325e00, 43) stub fixme:ntdll:EtwEventRegister ({5eec90ab-c022-44b2-a5dd-fd716a222a15}, 0x6f1123, 0x718020, 0x718038) stub. fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 0x715e00, 43) stub fixme:console:AttachConsole stub ffffffff attached loading /app/sc/bwapi-data/BWAPI.dll...fixme:ntdll:EtwEventRegister ({5eec90ab-c022-44b2-a5dd-fd716a222a15}, 0x12d27f0, 0x12e0030, 0x12e0048) stub. fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 0x12d2560, 43) stub success fixme:d3d:wined3d_dxtn_init Wine cannot find the txc_dxtn library, DXTn software support unavailable. err:wgl:init_opengl Failed to load libGL: libGL.so.1: cannot open shared object file: No such file or directory err:wgl:init_opengl OpenGL support is disabled. fixme:x11drv:X11DRV_desktop_SetCurrentMode Cannot change screen BPP from 32 to 8 ALSA lib confmisc.c:768:(parse_card) cannot find card '0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default ALSA lib confmisc.c:768:(parse_card) cannot find card '0' ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default fixme:d3d:wined3d_get_adapter_raster_status wined3d 0x34b9e68, adapter_idx 0, raster_status 0x33f984 semi-stub! fixme:ddraw:ddraw7_WaitForVerticalBlank iface 0x34b64f8, flags 0x1, event (nil) stub! 2018-02-14T08:36:02 Checking game status ... 2018-02-14T08:36:05 Checking game status ... fixme:winsock:WSAIoctl WS_SIO_UDP_CONNRESET stub fixme:winsock:WSAIoctl WS_SIO_UDP_CONNRESET stub 2018-02-14T08:36:08 Checking game status ... 2018-02-14T08:36:11 Checking game status ... 2018-02-14T08:36:14 Checking game status ... 2018-02-14T08:36:17 Checking game status ... 2018-02-14T08:36:20 Checking game status ... 2018-02-14T08:36:23 Checking game status ... 2018-02-14T08:36:26 Checking game status ... 2018-02-14T08:36:29 Checking game status ... 2018-02-14T08:36:32 Checking game status ...

operating system

macOS 10.12.6

docker version

output of command docker version

Client: Version: 17.12.0-ce API version: 1.35 Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:03:51 2017 OS/Arch: darwin/amd64

Server: Engine: Version: 17.12.0-ce API version: 1.35 (minimum version 1.12) Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:12:29 2017 OS/Arch: linux/amd64 Experimental: true

scbw version

output of command scbw.play -v

 0.2b3
michalsustr commented 6 years ago

Interesting, do you have SSD disk?

michalsustr commented 6 years ago

I'm able to reproduce the issue as well, I'll look into it.

MicroDK commented 6 years ago

Yes, I am using SSD storage.

michalsustr commented 6 years ago

Just to confirm, when you write /speed 0 into chat it speeds up right?

MicroDK commented 6 years ago

No it does not... :(

michalsustr commented 6 years ago

Try with the new version 0.2b4 :)

MicroDK commented 6 years ago

Two odules are not installed when installing the scbw pacakge: pip3.6 install scbw==0.2b4

ModuleNotFoundError: No module named 'matplotlib' ModuleNotFoundError: No module named 'pandas'

Seems they are not set as required dependencies but I installed them manually.

When I install scbw I get the "COPY failed: no source files were specified":

scbw.play --install --log_level=DEBUG --log_verbose /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/plot.py:3: UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time.

The backend was originally set to 'MacOSX' by the following code: File "/Library/Frameworks/Python.framework/Versions/3.6/bin/scbw.play", line 7, in from scbw.cli import main File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/init.py", line 2, in from .game import run_game, GameResult, GameArgs File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/game.py", line 13, in from .plot import RealtimeFramePlotter File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/plot.py", line 2, in import matplotlib.pyplot as plt File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py", line 72, in from matplotlib.backends import pylab_setup File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/init.py", line 14, in line for line in traceback.format_stack()

matplotlib.use('QT4Agg') 2018-02-16 21:34:25 WARNING scbw.install[7125] Path /Users/micky/.scbw found, re-installing scbw package. 2018-02-16 21:34:25 INFO scbw.install[7125] This will re-create the base game image, continue? [Y/n] Y 2018-02-16 21:34:29 INFO scbw.docker[7125] checking docker version 2018-02-16 21:34:29 DEBUG scbw.docker[7125] Using docker API version b"'1.35'\n" 2018-02-16 21:34:29 INFO scbw.docker[7125] checking docker can run 2018-02-16 21:34:30 INFO scbw.docker[7125] checking docker has network sc_net 2018-02-16 21:34:30 DEBUG scbw.docker[7125] docker network id: b'da59e568cc95\n' 2018-02-16 21:34:30 INFO scbw.docker[7125] creating docker local image 2018-02-16 21:34:30 INFO scbw.docker[7125] copying files from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/local_docker to /Users/micky/.scbw/docker 2018-02-16 21:34:30 INFO scbw.docker[7125] pulling image ggaic/starcraft:java-0.2b4, this may take a while... java-0.2b4: Pulling from ggaic/starcraft Digest: sha256:08a3bb82258706838f40f749af7b2142bc52f924549d4fed28f446e607d6fc43 Status: Image is up to date for ggaic/starcraft:java-0.2b4 2018-02-16 21:34:31 INFO scbw.docker[7125] building local image starcraft:game, this may take a while... Sending build context to Docker daemon 105.7MB Step 1/16 : FROM starcraft:java ---> 542c9025bd74 Step 2/16 : MAINTAINER Michal Sustr michal.sustr@aic.fel.cvut.cz ---> Using cache ---> 9b9d451dca5f Step 3/16 : USER starcraft ---> Using cache ---> 771e74e52d50 Step 4/16 : WORKDIR $SC_DIR ---> Using cache ---> 8de32aaac9cb Step 5/16 : COPY starcraft.zip /tmp/starcraft.zip ---> Using cache ---> da0e61351d4e Step 6/16 : COPY player* /tmp/ COPY failed: no source files were specified 2018-02-16 21:34:32 ERROR scbw.cli[7125] An error occurred while trying to build local image Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/docker.py", line 147, in create_local_image raise DockerException() scbw.error.DockerException

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/cli.py", line 184, in main install() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/install.py", line 26, in install create_local_image(SC_IMAGE) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/docker.py", line 151, in create_local_image ('An error occurred while trying to build local image' % ())) scbw.error.DockerException: An error occurred while trying to build local image

michalsustr commented 6 years ago

Hmm I was too hasty when leaving office... try 0.2b5 sorry for the forgotten deps :) I need to setup build server with some tests, the whole package starts to become complex.

MicroDK commented 6 years ago

Build server might be a good idea. :) I still get this error in step 6/16: COPY failed: no source files were specified

scbw.play --install --log_level=DEBUG --log_verbose

2018-02-16 21:59:13 WARNING scbw.install[7282] Path /Users/micky/.scbw found, re-installing scbw package. 2018-02-16 21:59:13 INFO scbw.install[7282] This will re-create the base game image, continue? [Y/n] Y 2018-02-16 21:59:16 INFO scbw.docker[7282] checking docker version 2018-02-16 21:59:17 DEBUG scbw.docker[7282] Using docker API version b"'1.35'\n" 2018-02-16 21:59:17 INFO scbw.docker[7282] checking docker can run 2018-02-16 21:59:17 INFO scbw.docker[7282] checking docker has network sc_net 2018-02-16 21:59:17 DEBUG scbw.docker[7282] docker network id: b'da59e568cc95\n' 2018-02-16 21:59:18 INFO scbw.docker[7282] creating docker local image 2018-02-16 21:59:18 INFO scbw.docker[7282] copying files from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/local_docker to /Users/micky/.scbw/docker 2018-02-16 21:59:18 INFO scbw.docker[7282] pulling image ggaic/starcraft:java-0.2b5, this may take a while... java-0.2b5: Pulling from ggaic/starcraft Digest: sha256:08a3bb82258706838f40f749af7b2142bc52f924549d4fed28f446e607d6fc43 Status: Image is up to date for ggaic/starcraft:java-0.2b5 2018-02-16 21:59:19 INFO scbw.docker[7282] building local image starcraft:game, this may take a while... Sending build context to Docker daemon 105.7MB Step 1/16 : FROM starcraft:java ---> 542c9025bd74 Step 2/16 : MAINTAINER Michal Sustr michal.sustr@aic.fel.cvut.cz ---> Using cache ---> 9b9d451dca5f Step 3/16 : USER starcraft ---> Using cache ---> 771e74e52d50 Step 4/16 : WORKDIR $SC_DIR ---> Using cache ---> 8de32aaac9cb Step 5/16 : COPY starcraft.zip /tmp/starcraft.zip ---> Using cache ---> da0e61351d4e Step 6/16 : COPY player* /tmp/ COPY failed: no source files were specified 2018-02-16 21:59:20 ERROR scbw.cli[7282] An error occurred while trying to build local image Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/docker.py", line 147, in create_local_image raise DockerException() scbw.error.DockerException

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/cli.py", line 184, in main install() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/install.py", line 26, in install create_local_image(SC_IMAGE) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/docker.py", line 151, in create_local_image ('An error occurred while trying to build local image' % ())) scbw.error.DockerException: An error occurred while trying to build local image

michalsustr commented 6 years ago

OMG yes sounds like a really good idea :) I forgot to update the manifest

MicroDK commented 6 years ago

0.2b6 installs fine! :D

But I get this error when starting a game: Error: No machine name(s) specified and no "default" machine exists

cbw.play --bots "CherryPi" "Marian Devecka" --show_all --read_overwrite --game_speed 10

Error: No machine name(s) specified and no "default" machine exists Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/bin/scbw.play", line 11, in sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/cli.py", line 198, in main game_result = run_game(args) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/game.py", line 62, in run_game args.vnc_host = (dockermachine_ip() or 'localhost') File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/docker.py", line 185, in dockermachine_ip out = subprocess.check_output(['docker-machine', 'ip']) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 336, in check_output **kwargs).stdout File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 418, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['docker-machine', 'ip']' returned non-zero exit status 1.

kant2002 commented 6 years ago

@MicroDK do you have docker-machine installed ?

MicroDK commented 6 years ago

What is docker-machine? I have Docker for Mac installed: Docker version 17.12.0-ce, build c97c6d6

docker-machine was not needed in all previous versions...

kant2002 commented 6 years ago

Could you run docker-machine ls in you terminal and paste output here? Looks like docker-machine installed together with Docker for Mac.

MicroDK commented 6 years ago

docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS

scbw installation doc does not mention docker-machine. As I understand, docker-machine is a legacy tool prior to Docker 1.12.

kant2002 commented 6 years ago

As a workaround you could run using following command

scbw.play --bots "CherryPi" "Marian Devecka" --show_all --read_overwrite --game_speed 10 --vnc_host localhost`

until PR #37 will land master

MicroDK commented 6 years ago

ok thanks! :D But now I get issue #36 ;)

michalsustr commented 6 years ago

Try 0.2b7

MicroDK commented 6 years ago

Everything works great now, fantastic work! :D