比较提交

...
此合并请求有变更与目标分支冲突。
/config/ppo/CrawlerDynamic.yaml
/config/ppo/GridWorld.yaml
/Project/Assets/ML-Agents/Examples/Crawler/Prefabs/CrawlerBase.prefab
/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs
/Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/Area.prefab
/Project/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
/Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs
/com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs
/com.unity.ml-agents/Runtime/Sensors/CameraSensorComponent.cs
/com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs
/ml-agents/mlagents/trainers/settings.py
/ml-agents/mlagents/trainers/torch/layers.py
/ml-agents/mlagents/trainers/torch/utils.py
/ml-agents/mlagents/trainers/torch/networks.py
/com.unity.ml-agents/Tests/Editor/Sensor/CameraSensorTest.cs
/com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs
/com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs
/com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs.meta
/com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs.meta
/com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs
/com.unity.ml-agents/Runtime/Sensors/ITypedSensor.cs
/Project/Assets/ML-Agents/Examples/Crawler/Scenes/CrawlerDynamicTarget.unity

1 次代码提交

作者 SHA1 备注 提交日期
Arthur Juliani 45aaaf83 Make Crawler head and movement direction different 4 年前
共有 113 个文件被更改,包括 16171 次插入180 次删除
  1. 2
      config/ppo/GridWorld.yaml
  2. 3
      config/ppo/CrawlerDynamic.yaml
  3. 2
      com.unity.ml-agents/Tests/Editor/Sensor/CameraSensorTest.cs
  4. 2
      com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs
  5. 12
      com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs
  6. 19
      com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs
  7. 15
      com.unity.ml-agents/Runtime/Sensors/CameraSensorComponent.cs
  8. 12
      com.unity.ml-agents/Runtime/Sensors/ITypedSensor.cs
  9. 8
      ml-agents/mlagents/trainers/settings.py
  10. 13
      ml-agents/mlagents/trainers/torch/utils.py
  11. 143
      ml-agents/mlagents/trainers/torch/layers.py
  12. 83
      ml-agents/mlagents/trainers/torch/networks.py
  13. 1
      Project/ProjectSettings/TagManager.asset
  14. 17
      Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/Area.prefab
  15. 167
      Project/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
  16. 36
      Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs
  17. 4
      Project/Assets/ML-Agents/Examples/Crawler/Scenes/CrawlerDynamicTarget.unity
  18. 18
      Project/Assets/ML-Agents/Examples/Crawler/Prefabs/CrawlerBase.prefab
  19. 5
      Project/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab
  20. 10
      Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs
  21. 2
      Project/Assets/ML-Agents/Examples/GoalNav/Scripts/PushBlockSettings.cs.meta
  22. 69
      config/ppo/WJPB.yaml
  23. 26
      config/ppo/PushJump.yaml
  24. 26
      config/ppo/GoalNav.yaml
  25. 42
      com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs
  26. 11
      com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs.meta
  27. 11
      com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs.meta
  28. 62
      com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs
  29. 9
      Project/Assets/ML-Agents/Examples/PushJump.meta
  30. 8
      Project/Assets/ML-Agents/Examples/GoalNav.meta
  31. 8
      Project/Assets/ML-Agents/Examples/GoalNav/Meshes.meta
  32. 1001
      Project/Assets/ML-Agents/Examples/GoalNav/Meshes/PushBlockCourt.fbx
  33. 126
      Project/Assets/ML-Agents/Examples/GoalNav/Meshes/PushBlockCourt.fbx.meta
  34. 8
      Project/Assets/ML-Agents/Examples/GoalNav/Prefabs.meta
  35. 8
      Project/Assets/ML-Agents/Examples/GoalNav/Scenes.meta
  36. 8
      Project/Assets/ML-Agents/Examples/GoalNav/Scripts.meta
  37. 8
      Project/Assets/ML-Agents/Examples/GoalNav/Materials.meta
  38. 33
      Project/Assets/ML-Agents/Examples/GoalNav/Materials/rainbow.mat
  39. 8
      Project/Assets/ML-Agents/Examples/GoalNav/Materials/rainbow.mat.meta
  40. 83
      Project/Assets/ML-Agents/Examples/GoalNav/RainbowFloor.mat
  41. 8
      Project/Assets/ML-Agents/Examples/GoalNav/RainbowFloor.mat.meta
  42. 7
      Project/Assets/ML-Agents/Examples/GoalNav/rainbow.png
  43. 88
      Project/Assets/ML-Agents/Examples/GoalNav/rainbow.png.meta
  44. 7
      Project/Assets/ML-Agents/Examples/GoalNav/Prefabs/Area.prefab.meta
  45. 1001
      Project/Assets/ML-Agents/Examples/GoalNav/Prefabs/VisualArea.prefab
  46. 7
      Project/Assets/ML-Agents/Examples/GoalNav/Prefabs/VisualArea.prefab.meta
  47. 1001
      Project/Assets/ML-Agents/Examples/GoalNav/Prefabs/Area.prefab
  48. 7
      Project/Assets/ML-Agents/Examples/GoalNav/Scenes/GoalNav.unity.meta
  49. 1001
      Project/Assets/ML-Agents/Examples/GoalNav/Scenes/VisualGoalNav.unity
  50. 7
      Project/Assets/ML-Agents/Examples/GoalNav/Scenes/VisualGoalNav.unity.meta
  51. 1001
      Project/Assets/ML-Agents/Examples/GoalNav/Scenes/GoalNav.unity
  52. 11
      Project/Assets/ML-Agents/Examples/GoalNav/Scripts/GoalDetect.cs.meta
  53. 11
      Project/Assets/ML-Agents/Examples/GoalNav/Scripts/GoalNavAgent.cs.meta
  54. 216
      Project/Assets/ML-Agents/Examples/GoalNav/Scripts/GoalNavAgent.cs
  55. 1001
      Project/Assets/ML-Agents/Examples/PushJump/Prefabs/PushJumpArea.prefab
  56. 9
      Project/Assets/ML-Agents/Examples/PushJump/Prefabs/PushJumpArea.prefab.meta
  57. 1001
      Project/Assets/ML-Agents/Examples/PushJump/Scenes/PushJump.unity
  58. 9
      Project/Assets/ML-Agents/Examples/PushJump/Scenes/PushJump.unity.meta
  59. 14
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/WJPB-32499994.onnx.meta
  60. 14
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/WJPB-4999918.onnx.meta
  61. 14
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/cloud.onnx.meta
  62. 1001
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/BigWallJump.nn
  63. 11
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/BigWallJump.nn.meta
  64. 1001
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/SmallWallJump.nn
  65. 11
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/SmallWallJump.nn.meta
  66. 1001
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/WJPB-32499994.onnx
  67. 1001
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/WJPB-4999918.onnx
  68. 1001
      Project/Assets/ML-Agents/Examples/PushJump/TFModels/cloud.onnx
  69. 78
      Project/Assets/ML-Agents/Examples/PushJump/Materials/TransparentWall.mat
  70. 10
      Project/Assets/ML-Agents/Examples/PushJump/Materials/TransparentWall.mat.meta
  71. 80
      Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourt.mat
  72. 8
      Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourt.mat.meta
  73. 80
      Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourtFail.mat
  74. 8
      Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourtFail.mat.meta
  75. 80
      Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourtSuccess.mat
  76. 8
      Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourtSuccess.mat.meta
  77. 83
      Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpSky.mat
  78. 8
      Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpSky.mat.meta
  79. 77
      Project/Assets/ML-Agents/Examples/PushJump/Materials/spawnVolumeMaterial.mat
  80. 10
      Project/Assets/ML-Agents/Examples/PushJump/Materials/spawnVolumeMaterial.mat.meta
  81. 1001
      Project/Assets/ML-Agents/Examples/PushJump/Meshes/GoalArea.fbx
  82. 96
      Project/Assets/ML-Agents/Examples/PushJump/Meshes/GoalArea.fbx.meta
  83. 1001
      Project/Assets/ML-Agents/Examples/PushJump/Meshes/ShortBlock.fbx
  84. 96
      Project/Assets/ML-Agents/Examples/PushJump/Meshes/ShortBlock.fbx.meta
  85. 8
      Project/Assets/ML-Agents/Examples/PushJump/Materials.meta
  86. 8
      Project/Assets/ML-Agents/Examples/PushJump/Meshes.meta
  87. 10
      Project/Assets/ML-Agents/Examples/PushJump/Prefabs.meta
  88. 10
      Project/Assets/ML-Agents/Examples/PushJump/Scenes.meta

2
config/ppo/GridWorld.yaml


learning_rate_schedule: linear
network_settings:
normalize: false
hidden_units: 256
hidden_units: 64
num_layers: 1
vis_encode_type: simple
reward_signals:

3
config/ppo/CrawlerDynamic.yaml


learning_rate_schedule: linear
network_settings:
normalize: true
hidden_units: 512
hidden_units: 256
num_layers: 3
vis_encode_type: simple
reward_signals:

time_horizon: 1000
summary_freq: 30000
threaded: true
checkpoint_interval: 1000000

2
com.unity.ml-agents/Tests/Editor/Sensor/CameraSensorTest.cs


var width = 24;
var height = 16;
var camera = Camera.main;
var sensor = new CameraSensor(camera, width, height, grayscale, "TestCameraSensor", compression);
var sensor = new CameraSensor(camera, width, height, grayscale, "TestCameraSensor", compression, ObservationType.Default);
var obsWriter = new ObservationWriter();
var obs = sensor.GetObservationProto(obsWriter);

2
com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs


{
// Test grayscale stacked mapping with CameraSensor
var cameraSensor = new CameraSensor(new Camera(), 64, 64,
true, "grayscaleCamera", SensorCompressionType.PNG);
true, "grayscaleCamera", SensorCompressionType.PNG, ObservationType.Default);
var stackedCameraSensor = new StackingSensor(cameraSensor, 2);
Assert.AreEqual(stackedCameraSensor.GetCompressedChannelMapping(), new[] { 0, 0, 0, 1, 1, 1 });

12
com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs


/// <summary>
/// A sensor implementation for vector observations.
/// </summary>
public class VectorSensor : ISensor, IBuiltInSensor
public class VectorSensor : ISensor, ITypedSensor, IBuiltInSensor
{
// TODO use float[] instead
// TODO allow setting float[]

ObservationType m_ObservationType;
/// <summary>
/// Initializes the sensor.

public VectorSensor(int observationSize, string name = null)
public VectorSensor(int observationSize, string name = null, ObservationType observationType = ObservationType.Default)
{
if (name == null)
{

m_Observations = new List<float>(observationSize);
m_Name = name;
m_Shape = new[] { observationSize };
m_ObservationType = observationType;
}
/// <inheritdoc/>

public int[] GetObservationShape()
{
return m_Shape;
}
/// <inheritdoc/>
public virtual ObservationType GetObservationType()
{
return m_ObservationType;
}
/// <inheritdoc/>

19
com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs


/// <summary>
/// A sensor that wraps a Camera object to generate visual observations for an agent.
/// </summary>
public class CameraSensor : ISensor, IBuiltInSensor, IDimensionPropertiesSensor
public class CameraSensor : ISensor, ITypedSensor, IBuiltInSensor, IDimensionPropertiesSensor
{
Camera m_Camera;
int m_Width;

int[] m_Shape;
SensorCompressionType m_CompressionType;
ObservationType m_ObservationType;
static DimensionProperty[] s_DimensionProperties = new DimensionProperty[] {
DimensionProperty.TranslationalEquivariance,
DimensionProperty.TranslationalEquivariance,

set { m_CompressionType = value; }
}
public ObservationType ObservationType
{
get { return m_ObservationType; }
set { m_ObservationType = value; }
}
/// <summary>
/// Creates and returns the camera sensor.

/// <param name="name">The name of the camera sensor.</param>
/// <param name="compression">The compression to apply to the generated image.</param>
public CameraSensor(
Camera camera, int width, int height, bool grayscale, string name, SensorCompressionType compression)
Camera camera, int width, int height, bool grayscale, string name, SensorCompressionType compression,
ObservationType observationType)
{
m_Camera = camera;
m_Width = width;

m_Shape = GenerateShape(width, height, grayscale);
m_CompressionType = compression;
m_ObservationType = observationType;
}
/// <summary>

public string GetName()
{
return m_Name;
}
/// <inheritdoc/>
public virtual ObservationType GetObservationType()
{
return m_ObservationType;
}
/// <summary>

15
com.unity.ml-agents/Runtime/Sensors/CameraSensorComponent.cs


set { m_SensorName = value; }
}
[HideInInspector, SerializeField, FormerlySerializedAs("observationType")]
ObservationType m_ObservationType = ObservationType.Goal;
[HideInInspector, SerializeField, FormerlySerializedAs("width")]
int m_Width = 84;

}
/// <summary>
/// The type of the observation.
/// </summary>
public ObservationType SensorObservationType
{
get { return m_ObservationType; }
set { m_ObservationType = value; UpdateSensor(); }
}
/// <summary>
m_Sensor = new CameraSensor(m_Camera, m_Width, m_Height, Grayscale, m_SensorName, m_Compression);
m_Sensor = new CameraSensor(m_Camera, m_Width, m_Height, Grayscale, m_SensorName, m_Compression, m_ObservationType);
if (ObservationStacks != 1)
{

{
m_Sensor.Camera = m_Camera;
m_Sensor.CompressionType = m_Compression;
m_Sensor.ObservationType = m_ObservationType;
}
}
}

12
com.unity.ml-agents/Runtime/Sensors/ITypedSensor.cs


/// <summary>
/// The ObservationType enum of the Sensor.
/// </summary>
internal enum ObservationType
public enum ObservationType
Default = 0,
Default,
Goal = 1,
Goal,
Reward = 2,
Reward,
Message = 3,
Message,
}

internal interface ITypedSensor
public interface ITypedSensor
{
/// <summary>
/// Returns the ObservationType enum corresponding to the type of the sensor.

8
ml-agents/mlagents/trainers/settings.py


LINEAR = "linear"
class ConditioningType(Enum):
DEFAULT = "default"
HYPER = "hyper"
SOFT_MUL = "soft_mul"
SOFT_SUM = "soft_sum"
@attr.s(auto_attribs=True)
class NetworkSettings:
@attr.s

num_layers: int = 2
vis_encode_type: EncoderType = EncoderType.SIMPLE
memory: Optional[MemorySettings] = None
conditioning_type: ConditioningType = ConditioningType.DEFAULT
@attr.s(auto_attribs=True)

13
ml-agents/mlagents/trainers/torch/utils.py


from mlagents.trainers.settings import EncoderType, ScheduleType
from mlagents.trainers.torch.attention import EntityEmbedding
from mlagents.trainers.exception import UnityTrainerException
from mlagents_envs.base_env import ObservationSpec, DimensionProperty
from mlagents_envs.base_env import ObservationSpec, ObservationType, DimensionProperty
class ModelUtils:

h_size: int,
vis_encode_type: EncoderType,
normalize: bool = False,
) -> Tuple[nn.ModuleList, List[int]]:
) -> Tuple[nn.ModuleList, List[int], List[ObservationType]]:
"""
Creates visual and vector encoders, along with their normalizers.
:param observation_specs: List of ObservationSpec that represent the observation dimensions.

"""
encoders: List[nn.Module] = []
embedding_sizes: List[int] = []
obs_types: List[ObservationType] = []
for obs_spec in observation_specs:
encoder, embedding_size = ModelUtils.get_encoder_for_obs(
obs_spec, normalize, h_size, vis_encode_type

obs_types.append(obs_spec.observation_type)
x_self_size = sum(embedding_sizes) # The size of the "self" embedding
if x_self_size > 0:
for enc in encoders:
if isinstance(enc, EntityEmbedding):
enc.add_self_embedding(h_size)
return (nn.ModuleList(encoders), embedding_sizes)
return (nn.ModuleList(encoders), embedding_sizes, obs_types)
@staticmethod
def list_to_tensor(

143
ml-agents/mlagents/trainers/torch/layers.py


from mlagents.torch_utils import torch
import abc
import math
from mlagents.trainers.settings import ConditioningType
class Swish(torch.nn.Module):

return (layer_activations - mean) / (torch.sqrt(var + 1e-5))
class ConditionalLayer(torch.nn.Module):
def __init__(
self,
input_size: int,
goal_size: int,
num_layers: int,
hidden_size: int,
condition_type: ConditioningType,
):
super().__init__()
self.condition_type = condition_type
if self.condition_type != ConditioningType.HYPER:
self.goal_encoder = LinearEncoder(
goal_size, num_layers, hidden_size, final_activation=True
)
self.input_encoder = linear_layer(input_size, hidden_size)
else:
self.input_encoder = HyperNetwork(
input_size, hidden_size, goal_size, num_layers, hidden_size
)
def forward(
self, input_tensor: torch.Tensor, goal_tensor: torch.Tensor
) -> torch.Tensor:
if self.condition_type == ConditioningType.SOFT_MUL:
return self.input_encoder(input_tensor) * self.goal_encoder(goal_tensor)
elif self.condition_type == ConditioningType.SOFT_SUM:
return self.input_encoder(input_tensor) + self.goal_encoder(goal_tensor)
else:
return self.input_encoder(input_tensor, goal_tensor)
class ConditionalEncoder(torch.nn.Module):
"""
Linear layers.
"""
def __init__(
self,
input_size: int,
goal_size: int,
num_layers: int,
hidden_size: int,
condition_type: ConditioningType,
conditional_layers: int,
kernel_init: Initialization = Initialization.KaimingHeNormal,
kernel_gain: float = 1.0,
):
super().__init__()
self.layers = []
prev_size = input_size + goal_size
for i in range(num_layers):
if num_layers - i <= conditional_layers:
self.layers.append(
ConditionalLayer(
prev_size, goal_size, 2, hidden_size, condition_type
)
)
else:
self.layers.append(
linear_layer(
prev_size,
hidden_size,
kernel_init=kernel_init,
kernel_gain=kernel_gain,
)
)
self.layers.append(Swish())
prev_size = hidden_size
self.layers = torch.nn.ModuleList(self.layers)
def forward(
self, input_tensor: torch.Tensor, goal_tensor: torch.Tensor
) -> torch.Tensor:
activation = torch.cat([input_tensor, goal_tensor], dim=-1)
for layer in self.layers:
if isinstance(layer, ConditionalLayer):
activation = layer(activation, goal_tensor)
else:
activation = layer(activation)
return activation
class LinearEncoder(torch.nn.Module):
"""
Linear layers.

hidden_size: int,
kernel_init: Initialization = Initialization.KaimingHeNormal,
kernel_gain: float = 1.0,
final_activation: bool = True,
):
super().__init__()
self.layers = [

)
]
self.layers.append(Swish())
for _ in range(num_layers - 1):
for i in range(num_layers - 1):
self.layers.append(
linear_layer(
hidden_size,

)
)
self.layers.append(Swish())
if i < num_layers - 2 or final_activation:
self.layers.append(Swish())
self.seq_layers = torch.nn.Sequential(*self.layers)
def forward(self, input_tensor: torch.Tensor) -> torch.Tensor:

lstm_out, hidden_out = self.lstm(input_tensor, hidden)
output_mem = torch.cat(hidden_out, dim=-1)
return lstm_out, output_mem
class HyperNetwork(torch.nn.Module):
def __init__(
self, input_size, output_size, hyper_input_size, num_layers, layer_size
):
super().__init__()
self.input_size = input_size
self.output_size = output_size
layer_in_size = hyper_input_size
layers = []
for _ in range(num_layers):
layers.append(
linear_layer(
layer_in_size,
layer_size,
kernel_init=Initialization.KaimingHeNormal,
kernel_gain=1.0,
bias_init=Initialization.Zero,
)
)
layers.append(Swish())
layer_in_size = layer_size
flat_output = linear_layer(
layer_size,
input_size * output_size,
kernel_init=Initialization.KaimingHeNormal,
kernel_gain=0.1,
bias_init=Initialization.Zero,
)
# Re-initializing the weights of the last layer of the hypernetwork
bound = math.sqrt(1 / (layer_size * self.input_size))
flat_output.weight.data.uniform_(-bound, bound)
self.hypernet = torch.nn.Sequential(*layers, LayerNorm(), flat_output)
# The hypernetwork will not generate the bias of the main network layer
self.bias = torch.nn.Parameter(torch.zeros(output_size))
def forward(self, input_activation, hyper_input):
output_weights = self.hypernet(hyper_input)
output_weights = output_weights.view(-1, self.input_size, self.output_size)
result = (
torch.bmm(input_activation.unsqueeze(1), output_weights).squeeze(1)
+ self.bias
)
return result

83
ml-agents/mlagents/trainers/torch/networks.py


from mlagents.torch_utils import torch, nn
from mlagents_envs.base_env import ActionSpec, ObservationSpec
from mlagents_envs.base_env import ActionSpec, ObservationSpec, ObservationType
from mlagents.trainers.settings import NetworkSettings
from mlagents.trainers.settings import NetworkSettings, ConditioningType
from mlagents.trainers.torch.layers import LSTM, LinearEncoder, Initialization
from mlagents.trainers.torch.layers import (
LSTM,
LinearEncoder,
ConditionalEncoder,
Initialization,
)
from mlagents.trainers.torch.encoders import VectorInput
from mlagents.trainers.buffer import AgentBuffer
from mlagents.trainers.trajectory import ObsUtil

get_zero_entities_mask,
)
ActivationFunction = Callable[[torch.Tensor], torch.Tensor]
EncoderFunction = Callable[
[torch.Tensor, int, ActivationFunction, int, str, bool], torch.Tensor

encoded_act_size: int = 0,
):
super().__init__()
self.conditioning_type = network_settings.conditioning_type
self.normalize = network_settings.normalize
self.use_lstm = network_settings.memory is not None
self.h_size = network_settings.hidden_units

else 0
)
self.processors, self.embedding_sizes = ModelUtils.create_input_processors(
self.processors, self.embedding_sizes, self.obs_types = ModelUtils.create_input_processors(
observation_specs,
self.h_size,
network_settings.vis_encode_type,

total_enc_size, total_goal_size = 0, 0
for idx, embedding_size in enumerate(self.embedding_sizes):
if (
self.obs_types[idx] == ObservationType.DEFAULT
or self.conditioning_type == ConditioningType.DEFAULT
):
total_enc_size += embedding_size
if (
self.obs_types[idx] == ObservationType.GOAL
and self.conditioning_type != ConditioningType.DEFAULT
):
total_goal_size += embedding_size
total_enc_size += encoded_act_size
entity_num_max: int = 0
var_processors = [p for p in self.processors if isinstance(p, EntityEmbedding)]
for processor in var_processors:

kernel_gain=(0.125 / self.h_size) ** 0.5,
)
self.rsa = ResidualSelfAttention(self.h_size, entity_num_max)
total_enc_size = sum(self.embedding_sizes) + self.h_size
total_enc_size += self.h_size
if (
ObservationType.GOAL in self.obs_types
and self.conditioning_type != ConditioningType.DEFAULT
):
self.linear_encoder = ConditionalEncoder(
total_enc_size,
total_goal_size,
network_settings.num_layers,
self.h_size,
condition_type=self.conditioning_type,
conditional_layers=1,
)
total_enc_size = sum(self.embedding_sizes)
total_enc_size += encoded_act_size
self.linear_encoder = LinearEncoder(
total_enc_size, network_settings.num_layers, self.h_size
)
self.linear_encoder = LinearEncoder(
total_enc_size, network_settings.num_layers, self.h_size
)
if self.use_lstm:
self.lstm = LSTM(self.h_size, self.m_size)

memories: Optional[torch.Tensor] = None,
sequence_length: int = 1,
) -> Tuple[torch.Tensor, torch.Tensor]:
encodes = []
obs_encodes, goal_encodes = [], []
var_len_processor_inputs: List[Tuple[nn.Module, torch.Tensor]] = []
for idx, processor in enumerate(self.processors):

processed_obs = processor(obs_input)
encodes.append(processed_obs)
if self.obs_types[idx] == ObservationType.DEFAULT:
obs_encodes.append(processed_obs)
elif self.obs_types[idx] == ObservationType.GOAL:
goal_encodes.append(processed_obs)
else:
raise Exception(
"TODO : Something other than a goal or observation was passed to the agent."
)
if len(encodes) != 0:
encoded_self = torch.cat(encodes, dim=1)
if len(obs_encodes) != 0:
encoded_self = torch.cat(obs_encodes, dim=1)
input_exist = True
else:
input_exist = False

if actions is not None:
encoded_self = torch.cat([encoded_self, actions], dim=1)
encoding = self.linear_encoder(encoded_self)
if self.conditioning_type == ConditioningType.DEFAULT:
encoded_self = torch.cat([encoded_self, torch.cat(goal_encodes, dim=-1)], dim=1)
goal_encodes = []
if len(obs_encodes) == 0:
raise Exception("No valid inputs to network.")
if len(goal_encodes) == 0:
encoding = self.linear_encoder(encoded_self)
else:
goal_inputs = torch.cat(goal_encodes, dim=-1)
encoding = self.linear_encoder(encoded_self, goal_inputs)
if self.use_lstm:
# Resize to (batch, sequence length, encoding size)

1
Project/ProjectSettings/TagManager.asset


- symbol_O_Goal
- purpleAgent
- purpleGoal
- landmark
- tile
layers:
- Default

17
Project/Assets/ML-Agents/Examples/GridWorld/Prefabs/Area.prefab


- component: {fileID: 114650561397225712}
- component: {fileID: 114889700908650620}
- component: {fileID: 7980686505185502968}
- component: {fileID: 8154757885281235403}
m_Layer: 8
m_Name: Agent
m_TagString: agent

VectorActionSpaceType: 0
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 11400000, guid: a812f1ce7763a4a0c912717f3594fe20, type: 3}
m_InferenceDevice: 2
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName: GridWorld
TeamId: 0

area: {fileID: 114704252266302846}
timeBetweenDecisionsAtInference: 0.15
renderCamera: {fileID: 0}
gridGoal: 0
maskActions: 1
--- !u!114 &114889700908650620
MonoBehaviour:

m_Name:
m_EditorClassIdentifier:
debugCommandLineOverride:
--- !u!114 &8154757885281235403
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1488387672112076}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fd48a95d788a348b0b7a8cefd39e7c27, type: 3}
m_Name:
m_EditorClassIdentifier:
observationSize: 2
--- !u!1 &1625008366184734
GameObject:
m_ObjectHideFlags: 0

167
Project/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity


m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.4497121, g: 0.49977785, b: 0.57563704, a: 1}
m_IndirectSpecularColor: {r: 0.44971168, g: 0.4997775, b: 0.57563686, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &99095112
GameObject:

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 45, y: 45, z: 0}
--- !u!1 &125487785
GameObject:

- component: {fileID: 125487790}
- component: {fileID: 125487787}
- component: {fileID: 125487791}
- component: {fileID: 125487792}
m_Layer: 8
m_Name: RenderTextureAgent
m_TagString: agent

area: {fileID: 1795599557}
timeBetweenDecisionsAtInference: 0.15
renderCamera: {fileID: 797520692}
gridGoal: 0
maskActions: 1
--- !u!65 &125487788
BoxCollider:

VectorActionSpaceType: 0
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 11400000, guid: a812f1ce7763a4a0c912717f3594fe20, type: 3}
m_InferenceDevice: 2
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName: GridWorld
TeamId: 0

m_Grayscale: 0
m_ObservationStacks: 1
m_Compression: 1
--- !u!114 &125487792
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 125487785}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fd48a95d788a348b0b7a8cefd39e7c27, type: 3}
m_Name:
m_EditorClassIdentifier:
observationSize: 2
--- !u!1 &260425459
GameObject:
m_ObjectHideFlags: 0

- {fileID: 918893359}
- {fileID: 1305247360}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}

propertyPath: m_Name
value: Area (6)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: -1

objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 13
value: 12
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1488387672112076, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_Name
value: FloatAgent
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: 0

objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 114650561397225712, guid: 5c2bd19e4bbda4991b74387ca5d28156,
type: 3}
propertyPath: m_UseHeuristic
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114889700908650620, guid: 5c2bd19e4bbda4991b74387ca5d28156,
type: 3}
propertyPath: compression
value: 0
value: 6
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5889392e3f05b448a8a06c5def6c2dec, type: 3}
--- !u!1 &742849316
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 742849319}
- component: {fileID: 742849318}
- component: {fileID: 742849317}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &742849317
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742849316}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &742849318
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742849316}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &742849319
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 742849316}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &790097508
PrefabInstance:
m_ObjectHideFlags: 0

- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_Name
value: Area (2)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x

objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 9
value: 8
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

propertyPath: m_Name
value: Area (5)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: 0

objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 12
value: 11
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

propertyPath: m_Name
value: Area (4)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: -1

objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 11
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

propertyPath: m_Name
value: Area (3)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: 1

objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 10
value: 9
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_Name
value: Area (1)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x

objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 8
value: 7
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

- {fileID: 125487786}
- {fileID: 797520693}
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1892751309
GameObject:

propertyPath: m_Name
value: Area (7)
objectReference: {fileID: 0}
- target: {fileID: 1625008366184734, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_LocalPosition.x
value: 1

objectReference: {fileID: 0}
- target: {fileID: 4124767863011510, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}
propertyPath: m_RootOrder
value: 14
value: 13
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5c2bd19e4bbda4991b74387ca5d28156, type: 3}

36
Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs


using UnityEngine;
using System.Linq;
using Unity.MLAgents;
using Unity.MLAgents.Sensors;
using Unity.MLAgents.Actuators;
using UnityEngine.Rendering;
using UnityEngine.Serialization;

"a camera to render before making a decision. Place the agentCam here if using " +
"RenderTexture as observations.")]
public Camera renderCamera;
VectorSensorComponent goalSensor;
public enum GridGoal
{
Plus,
Cross,
}
public GridGoal gridGoal;
[Tooltip("Selecting will turn on action masking. Note that a model trained with action " +
"masking turned on may not behave optimally when action masking is turned off.")]

public override void Initialize()
{
m_ResetParams = Academy.Instance.EnvironmentParameters;
}
public override void CollectObservations(VectorSensor sensor)
{
Array values = Enum.GetValues(typeof(GridGoal));
int goalNum = (int)gridGoal;
goalSensor = this.GetComponent<VectorSensorComponent>();
goalSensor.GetSensor().AddOneHotObservation(goalNum, values.Length);
}
public override void WriteDiscreteActionMask(IDiscreteActionMask actionMask)

if (hit.Where(col => col.gameObject.CompareTag("goal")).ToArray().Length == 1)
{
SetReward(1f);
ProvideReward(GridGoal.Plus);
SetReward(-1f);
ProvideReward(GridGoal.Cross);
}
}
private void ProvideReward(GridGoal hitObject)
{
if (gridGoal == hitObject)
{
SetReward(1f);
}
else
{
SetReward(-1f);
}
}

public override void OnEpisodeBegin()
{
area.AreaReset();
Array values = Enum.GetValues(typeof(GridGoal));
gridGoal = (GridGoal)values.GetValue(UnityEngine.Random.Range(0, values.Length));
}
public void FixedUpdate()

4
Project/Assets/ML-Agents/Examples/Crawler/Scenes/CrawlerDynamicTarget.unity


m_Name:
m_EditorClassIdentifier:
target: {fileID: 380947237}
smoothingTime: 0
--- !u!1001 &1481808307
PrefabInstance:
m_ObjectHideFlags: 0

type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 11400000, guid: 53b79c6f40aeb46e693e7c1822ff1047,
type: 3}
objectReference: {fileID: 0}
- target: {fileID: 6810587057221831324, guid: 0058b366f9d6d44a3ba35beb06b0174b,
type: 3}
propertyPath: m_LocalPosition.x

18
Project/Assets/ML-Agents/Examples/Crawler/Prefabs/CrawlerBase.prefab


- component: {fileID: 4845971001715176663}
- component: {fileID: 4845971001715176660}
- component: {fileID: 8968436865147081600}
- component: {fileID: 1768700195492406288}
m_Layer: 0
m_Name: CrawlerBase
m_TagString: Untagged

m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
VectorObservationSize: 32
VectorObservationSize: 29
NumStackedVectorObservations: 1
m_ActionSpec:
m_NumContinuousActions: 20

VectorActionSpaceType: 1
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 11400000, guid: c6509001ba679447fba27f894761c3ba, type: 3}
m_InferenceDevice: 2
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName:
TeamId: 0

UseJointPositionsAndAngles: 0
UseJointForces: 0
sensorName:
--- !u!114 &1768700195492406288
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4845971001715176661}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fd48a95d788a348b0b7a8cefd39e7c27, type: 3}
m_Name:
m_EditorClassIdentifier:
observationSize: 6
--- !u!1 &4845971001730692034
GameObject:
m_ObjectHideFlags: 0

5
Project/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab


m_Modification:
m_TransformParent: {fileID: 6810587057221831324}
m_Modifications:
- target: {fileID: 4845971001715176648, guid: 0456c89e8c9c243d595b039fe7aa0bf9,
type: 3}
propertyPath: m_BehaviorType
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4845971001715176651, guid: 0456c89e8c9c243d595b039fe7aa0bf9,
type: 3}
propertyPath: m_LocalPosition.x

10
Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs


"Static - The agent will run towards a static target. "
)]
public CrawlerAgentBehaviorType typeOfCrawler;
VectorSensorComponent goalSensor;
//Crawler Brains
//A different brain will be used depending on the CrawlerAgentBehaviorType selected

/// </summary>
public override void CollectObservations(VectorSensor sensor)
{
goalSensor = this.GetComponent<VectorSensorComponent>();
var cubeForward = m_OrientationCube.transform.forward;
//velocity we want to match

//avg body vel relative to cube
sensor.AddObservation(m_OrientationCube.transform.InverseTransformDirection(avgVel));
//vel goal relative to cube
sensor.AddObservation(m_OrientationCube.transform.InverseTransformDirection(velGoal));
goalSensor.GetSensor().AddObservation(cubeForward * TargetWalkingSpeed);
sensor.AddObservation(Quaternion.FromToRotation(body.forward, cubeForward));
sensor.AddObservation(Quaternion.FromToRotation(body.forward, Vector3.forward));
sensor.AddObservation(m_OrientationCube.transform.InverseTransformPoint(m_Target.transform.position));
goalSensor.GetSensor().AddObservation(Vector3.forward);
RaycastHit hit;
float maxRaycastDist = 10;

// b. Rotation alignment with target direction.
//This reward will approach 1 if it faces the target direction perfectly and approach zero as it deviates
var lookAtTargetReward = (Vector3.Dot(cubeForward, body.forward) + 1) * .5F;
var lookAtTargetReward = (Vector3.Dot(Vector3.forward, body.forward) + 1) * .5F;
AddReward(matchSpeedReward * lookAtTargetReward);
}

2
Project/Assets/ML-Agents/Examples/GoalNav/Scripts/PushBlockSettings.cs.meta


fileFormatVersion: 2
guid: e5ed63dbfa25542ecb8bc013adfba183
guid: 6582fc235f21046acba3381d9e57c348
MonoImporter:
externalObjects: {}
serializedVersion: 2

69
config/ppo/WJPB.yaml


behaviors:
WJPB:
trainer_type: ppo
hyperparameters:
batch_size: 128
buffer_size: 2048
learning_rate: 0.0003
beta: 0.005
epsilon: 0.2
lambd: 0.95
num_epoch: 3
learning_rate_schedule: linear
network_settings:
normalize: false
hidden_units: 512
num_layers: 2
vis_encode_type: simple
reward_signals:
extrinsic:
gamma: 0.99
strength: 1.0
keep_checkpoints: 5
max_steps: 50000000
time_horizon: 128
summary_freq: 20000
threaded: true
environment_parameters:
big_wall_height:
curriculum:
- name: Lesson0 # The '-' is important as this is a list
completion_criteria:
measure: progress
behavior: WJPB
signal_smoothing: true
min_lesson_length: 100
threshold: 0.05
value:
sampler_type: uniform
sampler_parameters:
min_value: 0.0
max_value: 4.0
- name: Lesson1 # This is the start of the second lesson
completion_criteria:
measure: progress
behavior: WJPB
signal_smoothing: true
min_lesson_length: 100
threshold: 0.1
value:
sampler_type: uniform
sampler_parameters:
min_value: 4.0
max_value: 7.0
- name: Lesson2
completion_criteria:
measure: progress
behavior: WJPB
signal_smoothing: true
min_lesson_length: 100
threshold: 0.5
value:
sampler_type: uniform
sampler_parameters:
min_value: 6.0
max_value: 8.0
- name: Lesson3
value: 8.0
env_settings:
num_envs: 4

26
config/ppo/PushJump.yaml


behaviors:
WJPB:
trainer_type: ppo
hyperparameters:
batch_size: 128
buffer_size: 5000
learning_rate: 0.0003
beta: 0.01
epsilon: 0.2
lambd: 0.95
num_epoch: 3
learning_rate_schedule: linear
network_settings:
normalize: false
hidden_units: 64
num_layers: 2
vis_encode_type: simple
reward_signals:
extrinsic:
gamma: 0.99
strength: 1.0
keep_checkpoints: 5
max_steps: 2000000
time_horizon: 64
summary_freq: 30000
threaded: true

26
config/ppo/GoalNav.yaml


behaviors:
GoalNav:
trainer_type: ppo
hyperparameters:
batch_size: 128
buffer_size: 2048
learning_rate: 0.0003
beta: 0.01
epsilon: 0.2
lambd: 0.95
num_epoch: 3
learning_rate_schedule: linear
network_settings:
normalize: false
hidden_units: 100
num_layers: 2
vis_encode_type: simple
reward_signals:
extrinsic:
gamma: 0.99
strength: 1.0
keep_checkpoints: 5
max_steps: 2000000
time_horizon: 64
summary_freq: 60000
threaded: true

42
com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs


using UnityEditor;
using Unity.MLAgents.Sensors;
namespace Unity.MLAgents.Editor
{
[CustomEditor(typeof(VectorSensorComponent))]
[CanEditMultipleObjects]
internal class VectorSensorComponentEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
var so = serializedObject;
so.Update();
// Drawing the VectorSensorComponent
EditorGUI.BeginChangeCheck();
EditorGUI.BeginDisabledGroup(!EditorUtilities.CanUpdateModelProperties());
{
// These fields affect the sensor order or observation size,
// So can't be changed at runtime.
EditorGUILayout.PropertyField(so.FindProperty("m_observationSize"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_ObservationType"), true);
}
EditorGUI.EndDisabledGroup();
var requireSensorUpdate = EditorGUI.EndChangeCheck();
so.ApplyModifiedProperties();
if (requireSensorUpdate)
{
UpdateSensor();
}
}
void UpdateSensor()
{
var sensorComponent = serializedObject.targetObject as VectorSensorComponent;
sensorComponent?.UpdateSensor();
}
}
}

11
com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs.meta


fileFormatVersion: 2
guid: 7353c768b27de4de18487d7a0e3516c5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs.meta


fileFormatVersion: 2
guid: cd4eb5a37d8bf4074bbbbb470263d151
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

62
com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs


using UnityEngine;
using UnityEngine.Serialization;
namespace Unity.MLAgents.Sensors
{
[AddComponentMenu("ML Agents/Vector Sensor", (int)MenuGroup.Sensors)]
public class VectorSensorComponent : SensorComponent
{
public int ObservationSize
{
get { return m_observationSize; }
set { m_observationSize = value; }
}
[HideInInspector, SerializeField]
int m_observationSize;
[HideInInspector, SerializeField]
ObservationType m_ObservationType;
VectorSensor m_sensor;
public ObservationType ObservationType
{
get { return m_ObservationType; }
set { m_ObservationType = value; }
}
/// <summary>
/// Creates a VectorSensor.
/// </summary>
/// <returns></returns>
public override ISensor CreateSensor()
{
m_sensor = new VectorSensor(m_observationSize, observationType: m_ObservationType);
return m_sensor;
}
/// <inheritdoc/>
public override int[] GetObservationShape()
{
return new[] { m_observationSize };
}
public VectorSensor GetSensor()
{
return m_sensor;
}
/// <summary>
/// Update fields that are safe to change on the Sensor at runtime.
/// </summary>
internal void UpdateSensor()
{
if (m_sensor != null)
{
}
}
}
}

9
Project/Assets/ML-Agents/Examples/PushJump.meta


fileFormatVersion: 2
guid: fb445c13fe9f243e1ab588fce6354929
folderAsset: yes
timeCreated: 1520964896
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/GoalNav.meta


fileFormatVersion: 2
guid: a210b813c05e344ffab6a3f77903d159
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/GoalNav/Meshes.meta


fileFormatVersion: 2
guid: b73520d910a3b4c009d8d11ddb375f57
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/GoalNav/Meshes/PushBlockCourt.fbx
文件差异内容过多而无法显示
查看文件

126
Project/Assets/ML-Agents/Examples/GoalNav/Meshes/PushBlockCourt.fbx.meta


fileFormatVersion: 2
guid: 8ea51e3c5ff764bcbbebef11c96e5de1
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: GoalArea
100002: Ground
100004: //RootNode
100006: WallsOuter
400000: GoalArea
400002: Ground
400004: //RootNode
400006: WallsOuter
2100000: rep_WhiteWalls
2100002: rep_Floor
2100004: rep_Checkers
2300000: GoalArea
2300002: Ground
2300004: WallsOuter
3300000: GoalArea
3300002: Ground
3300004: WallsOuter
4300000: WallsOuter
4300002: Ground
4300004: GoalArea
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: rep_Checkers
second: {fileID: 2100000, guid: 36c7baa347d68f347a9aa9698aa1bcdd, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: rep_Floor
second: {fileID: 2100000, guid: bc723809e6ff3174fad3e774cae1aed0, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: rep_WhiteWalls
second: {fileID: 2100000, guid: 6a39c0407dd85684384bf0277294e9b6, type: 2}
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 1
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 1
hasPreviousCalculatedGlobalScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 1
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/GoalNav/Prefabs.meta


fileFormatVersion: 2
guid: ba1e44c40fae5452dbd5fc91021b6c3e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/GoalNav/Scenes.meta


fileFormatVersion: 2
guid: 034c1bac9b9a249f6bc339d830ad0544
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/GoalNav/Scripts.meta


fileFormatVersion: 2
guid: 7a6ecbd64ff0c49959ecb732683c89d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/GoalNav/Materials.meta


fileFormatVersion: 2
guid: 21cd0cd17ab48441885e4ef86c073bfd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

33
Project/Assets/ML-Agents/Examples/GoalNav/Materials/rainbow.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: rainbow
m_Shader: {fileID: 4800000, guid: bbecf177c38d84ff08d7c683c116affd, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: d2d6b5af144604b0f8e88760ae2319b4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _DrawU: 1
- _DrawV: 1
- _GridSize: 10
- _LineSize: 0.15
m_Colors:
- _CellColor: {r: 0, g: 0, b: 0, a: 0}
- _LineColor: {r: 1, g: 1, b: 1, a: 1}

8
Project/Assets/ML-Agents/Examples/GoalNav/Materials/rainbow.mat.meta


fileFormatVersion: 2
guid: 8e6c6e2706b134878ae1d56bb435cb20
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

83
Project/Assets/ML-Agents/Examples/GoalNav/RainbowFloor.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: RainbowFloor
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _EMISSION _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 2800000, guid: d2d6b5af144604b0f8e88760ae2319b4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: d2d6b5af144604b0f8e88760ae2319b4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DrawU: 1
- _DrawV: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _GridSize: 6
- _LineSize: 0.009
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 1
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _CellColor: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0.2264151, g: 0.2264151, b: 0.2264151, a: 1}
- _LineColor: {r: 1, g: 1, b: 1, a: 1}

8
Project/Assets/ML-Agents/Examples/GoalNav/RainbowFloor.mat.meta


fileFormatVersion: 2
guid: 6c458fa586a0c425fa1a4f9bd3ad7f53
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/GoalNav/rainbow.png
文件差异内容过多而无法显示
查看文件

88
Project/Assets/ML-Agents/Examples/GoalNav/rainbow.png.meta


fileFormatVersion: 2
guid: d2d6b5af144604b0f8e88760ae2319b4
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

7
Project/Assets/ML-Agents/Examples/GoalNav/Prefabs/Area.prefab.meta


fileFormatVersion: 2
guid: 7e00e0f579d3d45af894c9b817bb585d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/GoalNav/Prefabs/VisualArea.prefab
文件差异内容过多而无法显示
查看文件

7
Project/Assets/ML-Agents/Examples/GoalNav/Prefabs/VisualArea.prefab.meta


fileFormatVersion: 2
guid: 5026853f7c20546528e81ea5a650b802
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/GoalNav/Prefabs/Area.prefab
文件差异内容过多而无法显示
查看文件

7
Project/Assets/ML-Agents/Examples/GoalNav/Scenes/GoalNav.unity.meta


fileFormatVersion: 2
guid: 0928e22e8f6ac4766afb9badb82246b3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/GoalNav/Scenes/VisualGoalNav.unity
文件差异内容过多而无法显示
查看文件

7
Project/Assets/ML-Agents/Examples/GoalNav/Scenes/VisualGoalNav.unity.meta


fileFormatVersion: 2
guid: a2d5173a85d7145f0a1d74be403bd08f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/GoalNav/Scenes/GoalNav.unity
文件差异内容过多而无法显示
查看文件

11
Project/Assets/ML-Agents/Examples/GoalNav/Scripts/GoalDetect.cs.meta


fileFormatVersion: 2
guid: db06de03634014d669f89681637d18d8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Project/Assets/ML-Agents/Examples/GoalNav/Scripts/GoalNavAgent.cs.meta


fileFormatVersion: 2
guid: 0ceffd7f848ac40ba84e863a63d95b2c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

216
Project/Assets/ML-Agents/Examples/GoalNav/Scripts/GoalNavAgent.cs


//Put this script on your blue cube.
using System.Collections;
using UnityEngine;
using Unity.MLAgents;
using Unity.MLAgents.Sensors;
using Unity.MLAgents.Actuators;
public class GoalNavAgent : Agent
{
/// <summary>
/// The ground. The bounds are used to spawn the elements.
/// </summary>
public GameObject ground;
public GameObject area;
/// <summary>
/// The area bounds.
/// </summary>
[HideInInspector]
public Bounds areaBounds;
PushBlockSettings m_PushBlockSettings;
VectorSensorComponent goalSensor;
public GameObject goalObject;
public GameObject obstacleObject;
Vector3 goalLoc;
Vector3 obstacleLoc;
public bool useVectorObs;
Rigidbody m_AgentRb; //cached on initialization
Material m_GroundMaterial; //cached on Awake()
/// <summary>
/// We will be changing the ground material based on success/failue
/// </summary>
Renderer m_GroundRenderer;
EnvironmentParameters m_ResetParams;
void Awake()
{
m_PushBlockSettings = FindObjectOfType<PushBlockSettings>();
}
public override void Initialize()
{
// Cache the agent rigidbody
m_AgentRb = GetComponent<Rigidbody>();
// Get the ground's bounds
areaBounds = ground.GetComponent<Collider>().bounds;
// Get the ground renderer so we can change the material when a goal is scored
m_GroundRenderer = ground.GetComponent<Renderer>();
// Starting material
m_GroundMaterial = m_GroundRenderer.material;
m_ResetParams = Academy.Instance.EnvironmentParameters;
SetResetParameters();
}
public override void CollectObservations(VectorSensor sensor)
{
goalSensor = this.GetComponent<VectorSensorComponent>();
if (useVectorObs)
{
goalSensor.GetSensor().AddObservation(goalLoc / 10f);
}
goalSensor.GetSensor().AddObservation(obstacleLoc / 10f);
}
/// <summary>
/// Use the ground's bounds to pick a random spawn position.
/// </summary>
public Vector3 GetRandomSpawnPos()
{
var foundNewSpawnLocation = false;
var randomSpawnPos = Vector3.zero;
while (foundNewSpawnLocation == false)
{
var randomPosX = Random.Range(-areaBounds.extents.x * m_PushBlockSettings.spawnAreaMarginMultiplier,
areaBounds.extents.x * m_PushBlockSettings.spawnAreaMarginMultiplier);
var randomPosZ = Random.Range(-areaBounds.extents.z * m_PushBlockSettings.spawnAreaMarginMultiplier,
areaBounds.extents.z * m_PushBlockSettings.spawnAreaMarginMultiplier);
randomSpawnPos = ground.transform.position + new Vector3(randomPosX, 1f, randomPosZ);
if (Physics.CheckBox(randomSpawnPos, new Vector3(2.5f, 0.01f, 2.5f)) == false)
{
foundNewSpawnLocation = true;
}
}
return randomSpawnPos;
}
/// <summary>
/// Moves the agent according to the selected action.
/// </summary>
public void MoveAgent(ActionSegment<int> act)
{
var dirToGo = Vector3.zero;
var rotateDir = Vector3.zero;
var action = act[0];
switch (action)
{
case 1:
dirToGo = transform.forward * 1f;
break;
case 2:
dirToGo = transform.forward * -1f;
break;
case 3:
dirToGo = transform.right * -0.75f;
break;
case 4:
dirToGo = transform.right * 0.75f;
break;
}
//transform.Rotate(rotateDir, Time.fixedDeltaTime * 200f);
m_AgentRb.AddForce(dirToGo * m_PushBlockSettings.agentRunSpeed,
ForceMode.VelocityChange);
}
/// <summary>
/// Called every step of the engine. Here the agent takes an action.
/// </summary>
public override void OnActionReceived(ActionBuffers actionBuffers)
{
// Move the agent using the action.
MoveAgent(actionBuffers.DiscreteActions);
// Penalty given each step to encourage agent to finish task quickly.
AddReward(-1f / MaxStep);
CheckGoal();
}
public void CheckGoal()
{
var distanceGoal = Vector3.Distance(transform.localPosition, goalLoc);
if (distanceGoal < 1.5f)
{
Debug.Log("Found goal");
SetReward(1f);
EndEpisode();
}
var distanceObstacle = Vector3.Distance(transform.localPosition, obstacleLoc);
if (distanceObstacle < 1.5f)
{
Debug.Log("Found obstacle");
SetReward(-1f);
EndEpisode();
}
}
public override void Heuristic(in ActionBuffers actionsOut)
{
var discreteActionsOut = actionsOut.DiscreteActions;
discreteActionsOut[0] = 0;
if (Input.GetKey(KeyCode.D))
{
discreteActionsOut[0] = 4;
}
else if (Input.GetKey(KeyCode.W))
{
discreteActionsOut[0] = 1;
}
else if (Input.GetKey(KeyCode.A))
{
discreteActionsOut[0] = 3;
}
else if (Input.GetKey(KeyCode.S))
{
discreteActionsOut[0] = 2;
}
}
/// <summary>
/// In the editor, if "Reset On Done" is checked then AgentReset() will be
/// called automatically anytime we mark done = true in an agent script.
/// </summary>
public override void OnEpisodeBegin()
{
//var rotation = Random.Range(0, 4);
//var rotationAngle = rotation * 90f;
//area.transform.Rotate(new Vector3(0f, rotationAngle, 0f));
transform.position = GetRandomSpawnPos();
m_AgentRb.velocity = Vector3.zero;
m_AgentRb.angularVelocity = Vector3.zero;
goalLoc = new Vector3(Random.Range(-10f, 10f), 1f, Random.Range(-10f, 10f));
goalObject.transform.localPosition = goalLoc;
obstacleLoc = new Vector3(Random.Range(-10f, 10f), 1f, Random.Range(-10f, 10f));
obstacleObject.transform.localPosition = obstacleLoc;
SetResetParameters();
}
void SetResetParameters()
{
}
}

1001
Project/Assets/ML-Agents/Examples/PushJump/Prefabs/PushJumpArea.prefab
文件差异内容过多而无法显示
查看文件

9
Project/Assets/ML-Agents/Examples/PushJump/Prefabs/PushJumpArea.prefab.meta


fileFormatVersion: 2
guid: c35df6d2c99224b0faeaaaff199cbd4e
timeCreated: 1520541093
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/PushJump/Scenes/PushJump.unity
文件差异内容过多而无法显示
查看文件

9
Project/Assets/ML-Agents/Examples/PushJump/Scenes/PushJump.unity.meta


fileFormatVersion: 2
guid: a67c8be1763a2414fa40cc64bc56036f
timeCreated: 1506808980
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

14
Project/Assets/ML-Agents/Examples/PushJump/TFModels/WJPB-32499994.onnx.meta


fileFormatVersion: 2
guid: 960b1933b6ec84fcb83c0c79668a4ee8
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3}
optimizeModel: 1
forceArbitraryBatchSize: 1
treatErrorsAsWarnings: 0

14
Project/Assets/ML-Agents/Examples/PushJump/TFModels/WJPB-4999918.onnx.meta


fileFormatVersion: 2
guid: 84bee0873d0be4a56b46a9884553728d
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3}
optimizeModel: 1
forceArbitraryBatchSize: 1
treatErrorsAsWarnings: 0

14
Project/Assets/ML-Agents/Examples/PushJump/TFModels/cloud.onnx.meta


fileFormatVersion: 2
guid: 15e1a204928a14cfa910f8c51edaf85f
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3}
optimizeModel: 1
forceArbitraryBatchSize: 1
treatErrorsAsWarnings: 0

1001
Project/Assets/ML-Agents/Examples/PushJump/TFModels/BigWallJump.nn
文件差异内容过多而无法显示
查看文件

11
Project/Assets/ML-Agents/Examples/PushJump/TFModels/BigWallJump.nn.meta


fileFormatVersion: 2
guid: 11fc5cb1f5b0f4ae39a36e2db65ca275
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 19ed1486aa27d4903b34839f37b8f69f, type: 3}

1001
Project/Assets/ML-Agents/Examples/PushJump/TFModels/SmallWallJump.nn
文件差异内容过多而无法显示
查看文件

11
Project/Assets/ML-Agents/Examples/PushJump/TFModels/SmallWallJump.nn.meta


fileFormatVersion: 2
guid: 7162ecb3cfbfc4b47b0278585fbaed90
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 19ed1486aa27d4903b34839f37b8f69f, type: 3}

1001
Project/Assets/ML-Agents/Examples/PushJump/TFModels/WJPB-32499994.onnx
文件差异内容过多而无法显示
查看文件

1001
Project/Assets/ML-Agents/Examples/PushJump/TFModels/WJPB-4999918.onnx
文件差异内容过多而无法显示
查看文件

1001
Project/Assets/ML-Agents/Examples/PushJump/TFModels/cloud.onnx
文件差异内容过多而无法显示
查看文件

78
Project/Assets/ML-Agents/Examples/PushJump/Materials/TransparentWall.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TransparentWall
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHABLEND_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 2
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 0.56228375, g: 0.76044035, b: 0.9558824, a: 0.603}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

10
Project/Assets/ML-Agents/Examples/PushJump/Materials/TransparentWall.mat.meta


fileFormatVersion: 2
guid: 3c02e1437a353423faeefff3afed88c3
timeCreated: 1506376733
licenseType: Pro
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

80
Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourt.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WallJumpCourt
m_Shader: {fileID: 47, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: df56124da2726af4d8dcb3bd5896d323, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.75
- _GlossyReflections: 1
- _Metallic: 0.2
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

8
Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourt.mat.meta


fileFormatVersion: 2
guid: 8eabd529a9b20480b95ed5371c96db8f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

80
Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourtFail.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WallJumpCourtFail
m_Shader: {fileID: 47, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: c862c84b87cc1314fac7392d5df40a0a, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.75
- _GlossyReflections: 1
- _Metallic: 0.2
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

8
Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourtFail.mat.meta


fileFormatVersion: 2
guid: a53fc6233e6a343189b057014f1a948c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

80
Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourtSuccess.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WallJumpCourtSuccess
m_Shader: {fileID: 47, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 6555bb88673eebc4a87d2111c3157de4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.75
- _GlossyReflections: 1
- _Metallic: 0.2
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

8
Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpCourtSuccess.mat.meta


fileFormatVersion: 2
guid: a5510de83e44f4596872fec8e7b34a12
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

83
Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpSky.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: WallJumpSky
m_Shader: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _SUNDISK_HIGH_QUALITY
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AtmosphereThickness: 1
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Exposure: 1.3
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SunDisk: 2
- _SunSize: 0.04
- _SunSizeConvergence: 5
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _GroundColor: {r: 0.369, g: 0.349, b: 0.341, a: 1}
- _SkyTint: {r: 0.5, g: 0.5, b: 0.5, a: 1}

8
Project/Assets/ML-Agents/Examples/PushJump/Materials/WallJumpSky.mat.meta


fileFormatVersion: 2
guid: a1d954e72bb784ca398bdfc716f6bb55
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

77
Project/Assets/ML-Agents/Examples/PushJump/Materials/spawnVolumeMaterial.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: spawnVolumeMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHABLEND_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 2
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 0, g: 0.83448315, b: 1, a: 0.303}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

10
Project/Assets/ML-Agents/Examples/PushJump/Materials/spawnVolumeMaterial.mat.meta


fileFormatVersion: 2
guid: 4051274fbcad74bc3be5e838c7476092
timeCreated: 1506376733
licenseType: Pro
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/PushJump/Meshes/GoalArea.fbx
文件差异内容过多而无法显示
查看文件

96
Project/Assets/ML-Agents/Examples/PushJump/Meshes/GoalArea.fbx.meta


fileFormatVersion: 2
guid: 690335095cd2c4560833e126d49130fe
ModelImporter:
serializedVersion: 22
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2100000: rep_Checkers
2300000: //RootNode
3300000: //RootNode
4300000: GoalArea
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: rep_Checkers
second: {fileID: 2100000, guid: 36c7baa347d68f347a9aa9698aa1bcdd, type: 2}
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 1
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/PushJump/Meshes/ShortBlock.fbx
文件差异内容过多而无法显示
查看文件

96
Project/Assets/ML-Agents/Examples/PushJump/Meshes/ShortBlock.fbx.meta


fileFormatVersion: 2
guid: 81640008a0d42439f881cd59c3145571
ModelImporter:
serializedVersion: 22
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2100000: rep_GraySG
2300000: //RootNode
3300000: //RootNode
4300000: ShortBlock
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: rep_GraySG
second: {fileID: 2100000, guid: 5eba48b0898adc441946e5c501f88fdd, type: 2}
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 1
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1}
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/PushJump/Materials.meta


fileFormatVersion: 2
guid: 84bf11f49563948329c8cbd9708fa71d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/PushJump/Meshes.meta


fileFormatVersion: 2
guid: 6a51b18ad7d024e19bc3d9e50b808855
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Project/Assets/ML-Agents/Examples/PushJump/Prefabs.meta


fileFormatVersion: 2
guid: 6b3d228f6035943038305ffb95ef9fb4
folderAsset: yes
timeCreated: 1517535133
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10
Project/Assets/ML-Agents/Examples/PushJump/Scenes.meta


fileFormatVersion: 2
guid: 98bc2664251504d59abfb38f03e52dfc
folderAsset: yes
timeCreated: 1517446674
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存