Unity-Technologies / obstacle-tower-env

Obstacle Tower Environment
Apache License 2.0
540 stars 124 forks source link

Build not showing agent #129

Open NicolasKuske opened 3 months ago

NicolasKuske commented 3 months ago

Dear all,

when I run your obsta.exe build (windows), I can play the game and see everything. However, when the build window opens after I instantiated it in a UnityEnvironment it remains blank for all times except for the one frame when I do an img.show call. Is that normal and is there any way to see the agent in real time doing its thing?

Best wishes

Nicolas

MarcoMeter commented 3 months ago

Hi @NicolasKuske

can you share the code that you use to reproduce this issue?

NicolasKuske commented 3 months ago

Hi Marco,

the code is the very beginning from the basic_usage notebook you provide.

from obstacle_tower_env import ObstacleTowerEnv
%matplotlib inline
from matplotlib import pyplot as plt

env = ObstacleTowerEnv(retro=False, realtime_mode=True)

Outputs: INFO:mlagents_envs.environment:Connected to Unity environment with package version 1.2.0-preview and communication version 1.0.0 INFO:mlagents_envs.environment:Connected new brain: ObstacleTowerAgent-v4.1?team=0 INFO:gym_unity:1 agents within environment.

And opens the pop up window.

The conda environment dependencies are:

NicolasKuske commented 3 months ago

Also env.observation_space independent of retro=False or retro=True always returns Tuple(Box(0.0, 1.0, (84, 84, 3), float32), Discrete(5), Box(0.0, 3.4028235e+38, (1,), float32), Discrete(9999))

Furthermore the cloned repository is only 2.5 MB size. It seems as if the call

env = ObstacleTowerEnv(retro=False, realtime_mode=True)

never initializes the download of the tower.exe build.

I downloaded the file manually and it is still in my downloads folder. My guess is that the cloned repository and the downloaded build never interact...

MarcoMeter commented 3 months ago

The best way to init the environment is to specify the file path:

env = ObstacleTowerEnv(environment_filename="path to ...")

I wouldn't rely on the automatic download as you might need to change permission on the executable on Linux systems.

As long as the returned visual observations of the reset and step functions are correct, then there is nothing to worry about. Don't care about the actual window, which is opened by the Unity build itself.

If the instance of the build and python don't connect, you should receive a timeout on the python side.

NicolasKuske commented 3 months ago

thank you, although I believe in general it should be possible to have the window display what the agent is currently seeing and doing. I mean that seems to be the reason for the realtime_mode option.