openai / neural-mmo

Code for the paper "Neural MMO: A Massively Multiagent Game Environment for Training and Evaluating Intelligent Agents"

Home Page:https://openai.com/blog/neural-mmo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

client only shows background (no map) when using Docker

paulhendricks opened this issue · comments

Hi all - great work on this package. I'm able to setup the environment perfectly on a local laptop - everything works! Also, love the flavor! RS was a lot of fun:

screen shot 2019-03-07 at 3 18 41 pm

I'm trying to set this up on a remote server using Docker and everything works until the Client Render. The "title screen" will pop up and upon clicking will show the green background - however the map won't render. I see the following image:

screen shot 2019-03-07 at 3 07 02 pm

Any thoughts? The below are steps for reproducing the work and setup.

Sample Dockerfile:

FROM nvcr.io/nvidia/pytorch:19.02-py3

RUN mkdir /workspace/explore-neural-mmo
ADD . /workspace/explore-neural-mmo

RUN git clone https://github.com/jsuarez5341/neural-mmo-client.git /workspace/explore-neural-mmo/neural-mmo-client  &&\
    cd /workspace/explore-neural-mmo/neural-mmo-client &&\
    bash setup.sh

RUN git clone https://github.com/openai/neural-mmo.git /workspace/explore-neural-mmo/neural-mmo &&\
    cd /workspace/explore-neural-mmo/neural-mmo &&\
    bash scripts/setup/setup.sh &&\
    python setup.py

RUN pip install jupyterlab pygame autobahn

WORKDIR /workspace/explore-neural-mmo

CMD ["bash"]

Build and run:

docker build -t neural_mmo:latest .
nvidia-docker run -it --rm \
	  -p 6006:6006 -p 8080:8080 -p 8888:8888 \
	  neural_mmo:latest

Run a simple environment:

python Forge.py --render

Easiest way to debug this sort of thing is to open up the web dev drop-down in your browser. If the error log there doesn't immediately solve your problem, please post it here.

Also nice stats haha! I've personally played more than a bit as a result of starting this project. Perhaps "for research purposes" is a bit strong, but it has been a constant source of ideas :)

need a docker version
really nice project👍

Hmmm. I've tried multiple servers and I get one of two errors:

TypeError: undefined has no properties client.js:116:7

    updatePacket http://10.31.229.101:8080/forge/embyr/client.js:116 update http://10.31.229.101:8080/forge/embyr/client.js:68 animate http://10.31.229.101:8080/forge/embyr/client.js:237 

The other error is a "WebSocket" not found error.

Using the below Dockerfile locally works so I can think we can rule out Docker. Maybe it has something to do with Docker port forwarding through VPN and ssh forwarding via head nodes...I'll keep exploring.

FROM python:3.7


RUN mkdir -p /workspace/explore-neural-mmo
ADD . /workspace/explore-neural-mmo

RUN git clone https://github.com/jsuarez5341/neural-mmo-client.git /workspace/explore-neural-mmo/neural-mmo-client  &&\
    cd /workspace/explore-neural-mmo/neural-mmo-client &&\
    bash setup.sh

RUN git clone https://github.com/openai/neural-mmo.git /workspace/explore-neural-mmo/neural-mmo &&\
    cd /workspace/explore-neural-mmo/neural-mmo &&\
    bash scripts/setup/setup.sh &&\
    python setup.py

RUN pip install jupyterlab pygame autobahn

WORKDIR /workspace/explore-neural-mmo

CMD ["bash"]

I have not personally tried it with Docker. There's a large meetup group in Chicago that apparently made a few changes and got it working. I believe @rockhowse was involved with this -- would appreciate it if you could submit a PR with the relevant changes.

The issue we had was similar to yours in that the hostname/port is hard coded to connect back to "localhost" and by default docker environments might not map "localhost" to the running docker-machine's IP (Docker Toolbox for instance allows you to connect to the docker container on IP 192.186.99.100)

We just did a quick vi hack in the running container to the following file to connect back to 192.168.99.100:8080 instead of localhost:8080

https://github.com/rockhowse/neural-mmo-client/blob/master/comms.js#L1

I will do some testing tonight and put up a PR to see if we can have it auto-determined from the host/window/url it was loaded from.

This thread is related:

#12 (comment)

I have been able to reproduce your issue using the dockerfile you provided. Here you can see the blank screen. I have also brought up the Google Chrome Developer Tools so you can see the error with the websocket connecting.

Screen Shot 2019-03-13 at 8 29 18 PM

I am working on testing a quick fix now and will PR after testing.

That's the one! I meant to post the picture of the error but got side tracked.

Within the comm.js file, I actually substituted the IP Address 127.0.0.1 with the node's IP Address but didn't see any success.

Yeah it might not work correctly depending on how it's configured, this SHOULD do the trick since it's uses the browser's own origin automagically.

Here's the PR if you want to check out the needed change:

NeuralMMO/client#3

Screen Shot 2019-03-13 at 8 52 16 PM

Just tried the new changes, can confirm it works - thanks!

Hi -- have not forgotten about this, just busy trying to graduate in a week :). I don't currently have time to make sure this doesn't break the vanilla build, but I'll get to it soon.

Yeah the new changes also work for me when I am trying to use a remote cluster (no Docker involved). Thanks @rockhowse!

@rockhowse thanks again for putting this together. Just confirms that nothing breaks. Hopefully this is the slowest I'll ever be on a merge. Should have some time to get some good patches out over the next couple days

Excellent! Thanks for testing it out @jsuarez5341, @paulhendricks and @jiamings. I have a major project at my day job that’s wrapping up shortly so I should have some time to start contributing more shortly.