Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Learning-Environment-Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ If you would like to contribute environments, please see our
* -0.0025 for every step.
* +1.0 if the block touches the goal.
* Brains: One brain with the following observation/action space.
* Vector Observation space: (Continuous) 15 variables corresponding to position and velocities of agent, block, and goal.
* Vector Observation space: (Continuous) 70 variables corresponding to 14 ray-casts each detecting one of three possible objects (wall, goal, or block).
* Vector Action space: (Continuous) Size of 2, corresponding to movement in X and Z directions.
* Visual Observations (Optional): One first-person camera. Use `VisualPushBlock` scene.
* Reset Parameters: None.
Expand Down
3 changes: 2 additions & 1 deletion python/unityagents/rpc_communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@


class UnityToExternalServicerImplementation(UnityToExternalServicer):
parent_conn, child_conn = Pipe()
def __init__(self):
self.parent_conn, self.child_conn = Pipe()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the fix for the bug preventing using environments with python multi-processing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. In the old code they were global variables, which prevented multiple instances of them from being created correctly.


def Initialize(self, request, context):
self.child_conn.send(request)
Expand Down
5 changes: 2 additions & 3 deletions unity-environment/Assets/ML-Agents/Scripts/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,9 @@ public abstract class Agent : MonoBehaviour
void OnEnable()
{
textureArray = new Texture2D[agentParameters.agentCameras.Count];
for (int i = 0; i < brain.brainParameters.cameraResolutions.Length; i++)
for (int i = 0; i < agentParameters.agentCameras.Count; i++)
{
textureArray[i] = new Texture2D(brain.brainParameters.cameraResolutions[i].width,
brain.brainParameters.cameraResolutions[i].height, TextureFormat.RGB24, false);
textureArray[i] = new Texture2D(1, 1, TextureFormat.RGB24, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The agent can be initialized without a brain attached, in which case the old code would throw an error. In the new code we use the agent's camera list to initialize the texture2d array. But, since we don't know how big the textures should be, we initialize them to 1x1 to start with.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want to allow the agent be initialized without a brain attached?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to programmatically attach brains during runtime, as is the case with WallJump.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see.

}
id = gameObject.GetInstanceID();
Academy academy = Object.FindObjectOfType<Academy>() as Academy;
Expand Down