diff --git a/.gitattributes b/.gitattributes index 72c8d74c0626388bb3fe1c5c6c4b6a8ec4726554..797ed8d054ad208e90d147822427f1a6f0b2b8ad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -34,3 +34,17 @@ Project/Assets/ML-Agents/Examples/Pyramids/Meshes/SideWalls.fbx filter=lfs diff= Project/Assets/ML-Agents/Examples/Pyramids/Meshes/Switch.fbx filter=lfs diff=lfs merge=lfs -text Project/Assets/ML-Agents/Examples/Pyramids/Meshes/Walls.fbx filter=lfs diff=lfs merge=lfs -text Project/Assets/ML-Agents/Examples/Pyramids/TFModels/Pyramids.onnx filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/CheckersGray_BC.png filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_CO.tif filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_NO.png filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongNarrowPlatform.fbx filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongPlatform.fbx filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitchAL.png filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGray.png filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGreen.png filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Soccer/Meshes/Pitch.fbx filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures/SoccerBallNormalMap.png filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Soccer/TFModels/Goalie.onnx filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Soccer/TFModels/SoccerTwos.onnx filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Soccer/TFModels/Striker.onnx filter=lfs diff=lfs merge=lfs -text +Project/Assets/ML-Agents/Examples/Sorter/TFModels/Sorter.onnx filter=lfs diff=lfs merge=lfs -text diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets.meta b/Project/Assets/ML-Agents/Examples/SharedAssets.meta new file mode 100644 index 0000000000000000000000000000000000000000..7883bbb630a040f705e17096a6f0e494cba8a7b8 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials.meta new file mode 100644 index 0000000000000000000000000000000000000000..04998f19317b2a95e1e6d81b5fcba9e045177b64 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Eye.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Eye.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..9e5b564d11fda58f2699d9efa6df692b366fe303 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Eye.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GrayMiddle.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GrayMiddle.mat new file mode 100644 index 0000000000000000000000000000000000000000..1adb713177213a1159646b90aca6718b81bf1308 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GrayMiddle.mat @@ -0,0 +1,80 @@ +%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: GrayMiddle + m_Shader: {fileID: 47, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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} + - _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.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.39215687, g: 0.39215687, b: 0.39215687, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GrayMiddle.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GrayMiddle.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..e03ac173c7880e1002098a234e86bab8e98df36a Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GrayMiddle.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Green.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Green.mat new file mode 100644 index 0000000000000000000000000000000000000000..590df8d52d3b1f8b777c4eeb5d6bd4b4fd38f807 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Green.mat @@ -0,0 +1,76 @@ +%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: Green + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.40392157, g: 0.7372549, b: 0.41960785, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Green.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Green.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..c3e31582957281d65cf3245c2626ce70ca1500ab Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Green.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMat.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMat.mat new file mode 100644 index 0000000000000000000000000000000000000000..5ea90fe810159b093a45fddaf613554c5fd381b5 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMat.mat @@ -0,0 +1,90 @@ +%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: GridMat + 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: + - _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 + - _DrawU: 1 + - _DrawV: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 1 + - _GridSize: 3 + - _LineOffset: 0.5 + - _LineSize: 0.01 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Offset: 0 + - _Parallax: 0.02 + - _RepeatCount: 5 + - _SelectCell: 0 + - _SelectedCellX: 0 + - _SelectedCellY: 0 + - _SmoothnessTextureChannel: 0 + - _Spacing: 0.5 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _CellColor: {r: 0.23529412, g: 0.23529412, b: 0.23529412, a: 1} + - _Color: {r: 0.935151, g: 0.9705882, b: 0.3282872, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _LineColor: {r: 0.39215687, g: 0.39215687, b: 0.39215687, a: 1} + - _SelectedColor: {r: 0.1586206, g: 1, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMat.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMat.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..2f55eb51317b96740a0ff0fceef26af2276b45c2 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMat.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatBall.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatBall.mat new file mode 100644 index 0000000000000000000000000000000000000000..b44fc369cd871e8bde8f69d8edf0e7dced419405 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatBall.mat @@ -0,0 +1,90 @@ +%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: GridMatBall + 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: + - _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 + - _DrawU: 1 + - _DrawV: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 1 + - _GridSize: 4 + - _LineOffset: 0.5 + - _LineSize: 0.1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Offset: 0 + - _Parallax: 0.02 + - _RepeatCount: 5 + - _SelectCell: 0 + - _SelectedCellX: 0 + - _SelectedCellY: 0 + - _SmoothnessTextureChannel: 0 + - _Spacing: 0.5 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _CellColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + - _Color: {r: 0.935151, g: 0.9705882, b: 0.3282872, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _LineColor: {r: 0.47058824, g: 0.47058824, b: 0.47058824, a: 1} + - _SelectedColor: {r: 0.1586206, g: 1, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatBall.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatBall.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..ac711d624b4f59bf1bfdc630fcd2f77fe101a6cf Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatBall.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatFloor.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatFloor.mat new file mode 100644 index 0000000000000000000000000000000000000000..e26ffac9c680ebaf0d1138811244f76b6ee67725 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatFloor.mat @@ -0,0 +1,94 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: GridMatFloor + m_Shader: {fileID: 4800000, guid: bbecf177c38d84ff08d7c683c116affd, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + 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_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawU: 1 + - _DrawV: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 1 + - _GridSize: 35 + - _LineOffset: 0.5 + - _LineSize: 0.02 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Offset: 0 + - _Parallax: 0.02 + - _RepeatCount: 5 + - _SelectCell: 0 + - _SelectedCellX: 0 + - _SelectedCellY: 0 + - _SmoothnessTextureChannel: 0 + - _Spacing: 0.5 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _CellColor: {r: 0.116, g: 0.116, b: 0.116, a: 1} + - _Color: {r: 0.935151, g: 0.9705882, b: 0.3282872, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _LineColor: {r: 0.15686275, g: 0.15686275, b: 0.15686275, a: 1} + - _SelectedColor: {r: 0.1586206, g: 1, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatFloor.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatFloor.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..f92774ef5ac46960b4fe68ae0e4a3d3fdfce2e21 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatFloor.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatHallway.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatHallway.mat new file mode 100644 index 0000000000000000000000000000000000000000..eb37de823af2df7072aa9807fc1e7129eed99906 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatHallway.mat @@ -0,0 +1,90 @@ +%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: GridMatHallway + 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: + - _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 + - _DrawU: 1 + - _DrawV: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 1 + - _GridSize: 12 + - _LineOffset: 0.5 + - _LineSize: 0.02 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Offset: 0 + - _Parallax: 0.02 + - _RepeatCount: 5 + - _SelectCell: 0 + - _SelectedCellX: 0 + - _SelectedCellY: 0 + - _SmoothnessTextureChannel: 0 + - _Spacing: 0.5 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _CellColor: {r: 0.116, g: 0.116, b: 0.116, a: 1} + - _Color: {r: 0.935151, g: 0.9705882, b: 0.3282872, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _LineColor: {r: 0.15686275, g: 0.15686275, b: 0.15686275, a: 1} + - _SelectedColor: {r: 0.1586206, g: 1, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatHallway.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatHallway.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..c8534a9c2c49aad4279f9f28ebe6367b803630e6 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatHallway.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatMoveable.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatMoveable.mat new file mode 100644 index 0000000000000000000000000000000000000000..6848cdb2d4cdd75dee0085ca711279418e72c891 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatMoveable.mat @@ -0,0 +1,94 @@ +%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: GridMatMoveable + 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: + - _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 + - _DrawU: 1 + - _DrawV: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 1 + - _GridSize: 1 + - _LineOffset: 0.5 + - _LineSize: 0.08 + - _LineWidth: 0.1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Offset: 0 + - _Parallax: 0.02 + - _ParcelSize: 1 + - _RepeatCount: 5 + - _SelectCell: 0 + - _SelectedCellX: 0 + - _SelectedCellY: 0 + - _SmoothnessTextureChannel: 0 + - _Spacing: 0.5 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + - _transparency: 1 + m_Colors: + - _CellColor: {r: 0.9254902, g: 0.9372549, b: 0.9411765, a: 1} + - _Color: {r: 0.935151, g: 0.9705882, b: 0.3282872, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _LineColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} + - _MainColor: {r: 1, g: 1, b: 1, a: 1} + - _SelectedColor: {r: 0.1586206, g: 1, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatMoveable.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatMoveable.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..3653132039f136c97e30f95c2dd87ca3a5079ec5 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridMatMoveable.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridPatternShader.shader b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridPatternShader.shader new file mode 100644 index 0000000000000000000000000000000000000000..9979743aea1c7fad27c1370d0c2f044f489f45cf --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridPatternShader.shader @@ -0,0 +1,162 @@ +// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax. + +Shader "ML-Agents/GridPattern" { + Properties { + _LineColor ("Line Color", Color) = (1,1,1,1) + _CellColor ("Cell Color", Color) = (0,0,0,0) + // _SelectedColor ("Selected Color", Color) = (1,0,0,1) + [PerRendererData] _MainTex ("Albedo (RGB)", 2D) = "white" {} + [IntRange] _GridSize("Grid Size", Range(1,100)) = 10 + _LineSize("Line Size", Range(0,1)) = 0.15 + // [FloatRange] _LineOffset("Line Offset", Range(0,1)) = 0 + [IntRange] _DrawU("Draw U Toggle ( 0 = False , 1 = True )", Range(0,1)) = 1 + [IntRange] _DrawV("Draw V Toggle ( 0 = False , 1 = True )", Range(0,1)) = 1 + // [IntRange] _SelectCell("Select Cell Toggle ( 0 = False , 1 = True )", Range(0,1)) = 0.0 + // [IntRange] _SelectedCellX("Selected Cell X", Range(0,100)) = 0.0 + // [IntRange] _SelectedCellY("Selected Cell Y", Range(0,100)) = 0.0 + } + SubShader { + Tags { "Queue"="AlphaTest" "RenderType"="TransparentCutout" } + LOD 200 + + + CGPROGRAM + // Physically based Standard lighting model, and enable shadows on all light types + #pragma surface surf Standard fullforwardshadows + + // Use shader model 3.0 target, to get nicer looking lighting + #pragma target 3.0 + + sampler2D _MainTex; + + struct Input { + float2 uv_MainTex; + }; + + half _Glossiness = 0.0; + half _Metallic = 0.0; + float4 _LineColor; + float4 _CellColor; + // float4 _SelectedColor; + + float _GridSize; + // float _LineOffset; + float _LineSize; + + float _DrawU; + float _DrawV; + // float _SelectCell; + // float _SelectedCellX; + // float _SelectedCellY; + + // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader. + // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing. + // #pragma instancing_options assumeuniformscaling + UNITY_INSTANCING_BUFFER_START(Props) + // put more per-instance properties here + UNITY_INSTANCING_BUFFER_END(Props) + + void surf (Input IN, inout SurfaceOutputStandard o) { + // Albedo comes from a texture tinted by color + + float2 uv = IN.uv_MainTex; + + // _SelectedCellX = floor(_SelectedCellX); + // _SelectedCellY = floor(_SelectedCellY); + + fixed4 c = float4(0.0,0.0,0.0,0.0); + + float brightness = 1.0; + + float gsize = floor(_GridSize); + + + + gsize += _LineSize; + + float2 id; + + id.x = floor(uv.x/(1.0/gsize)); + // id.y = floor(uv.y/(1.0/gsize)); + id.y = floor(uv.y/(1.0/gsize)); + + float4 color = _CellColor; + brightness = _CellColor.w; + + // //This checks that the cell is currently selected if the Select Cell slider is set to 1 ( True ) + // if (round(_SelectCell) == 1.0 && id.x == _SelectedCellX && id.y == _SelectedCellY) + // { + // brightness = _SelectedColor.w; + // color = _SelectedColor; + // } + + // if (frac(uv.x*gsize) <= _LineSize || frac(uv.y*gsize) <= _LineSize) + // { + // brightness = _LineColor.w; + // color = _LineColor; + // } + if(round(_DrawU) == 1.0) + { + if (frac(uv.x*gsize) <= _LineSize) + { + // if (frac(uv.x*gsize) <= _LineSize) + // { + brightness = _LineColor.w; + color = _LineColor; + } + } + if(round(_DrawV) == 1.0) + { + if (frac(uv.y*gsize) <= _LineSize) + { + brightness = _LineColor.w; + color = _LineColor; + } + } + // // if (round(uv.x*gsize) == .8) + // // if (uv.x >= _LineOffset) + // if (uv.x >= .2 && uv.x <= .3) + // { + // brightness = _LineColor.w; + // color = _LineColor; + // // color = _CellColor; + // // brightness = _CellColor.w; + // } + + // if (frac(uv.x*gsize) <= _LineSize && frac(uv.y*gsize) <= _LineSize) + // { + // // brightness = _LineColor.w; + // // color = _LineColor; + // color = _CellColor; + // brightness = _CellColor.w; + // } + + + // if (frac(uv.x*gsize/_LineOffset) <= _LineSize) + // { + // brightness = _LineColor.w; + // color = _LineColor; + // } + // if (frac(uv.x*gsize/.5) <= _LineSize || fradc(uv.y*gsize) <= _LineSize) + // { + // brightness = _LineColor.w; + // color = _LineColor; + // } + + + //Clip transparent spots using alpha cutout + if (brightness == 0.0) { + clip(c.a - 1.0); + } + + + o.Albedo = float4( color.x*brightness,color.y*brightness,color.z*brightness,brightness); + // Metallic and smoothness come from slider variables + o.Metallic = 0.0; + o.Smoothness = 0.0; + o.Alpha = 0.0; + } + ENDCG + } + FallBack "Diffuse" +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridPatternShader.shader.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridPatternShader.shader.meta new file mode 100644 index 0000000000000000000000000000000000000000..d4263593563da525236ba007f3fae79e73feab04 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/GridPatternShader.shader.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Headband.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Headband.mat new file mode 100644 index 0000000000000000000000000000000000000000..13b5854401121e714a66c0cfcac42cd501591113 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Headband.mat @@ -0,0 +1,76 @@ +%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: Headband + m_Shader: {fileID: 46, 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: 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: 0 + - _GlossMapScale: 1 + - _Glossiness: 1 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.98039216, g: 0.6509804, b: 0.16078432, a: 1} + - _EmissionColor: {r: 0.98039216, g: 0.6509804, b: 0.16078432, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Headband.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Headband.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..2d90b1a9f6ff355a09150318a4195b9ff4a7c1b9 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Headband.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGreen.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGreen.mat new file mode 100644 index 0000000000000000000000000000000000000000..3dd657a61d28d621291cf790cd78177909181917 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGreen.mat @@ -0,0 +1,76 @@ +%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: LightGreen + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.5926951, g: 0.7372549, b: 0.5994979, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGreen.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGreen.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..ae89492b24c649e09937028db02551ee976fc1de Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGreen.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGrey.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGrey.mat new file mode 100644 index 0000000000000000000000000000000000000000..f27b491a8c7223b2156b4c9c4c2549d650587264 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGrey.mat @@ -0,0 +1,81 @@ +%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: LightGrey + m_Shader: {fileID: 47, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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} + - _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.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.6, g: 0.6, b: 0.6, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGrey.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGrey.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..313168784bfc04ad882173605944e43fcdfc8bc5 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightGrey.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightRed.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightRed.mat new file mode 100644 index 0000000000000000000000000000000000000000..b047938101d3ed066bcfb85dd82a11dfa617fe54 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightRed.mat @@ -0,0 +1,76 @@ +%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: LightRed + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.74509805, g: 0.48966902, b: 0.45290273, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightRed.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightRed.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..cf86f1d399ccda7eb747c3250c24e53b7cab0a3c Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LightRed.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LogoSymbol.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LogoSymbol.mat new file mode 100644 index 0000000000000000000000000000000000000000..b577c7d2e7f7fb16bed55e31c9f469115c57d907 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LogoSymbol.mat @@ -0,0 +1,77 @@ +%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: LogoSymbol + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA _ALPHATEST_ON _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2450 + stringTagMap: + RenderType: TransparentCutout + 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: be5d24d9d9e024be784fbcb911cb18e8, 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.714 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 1 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LogoSymbol.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LogoSymbol.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..51b1f5ed37813c38ceb5dc6d423e90ae144d54fc Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/LogoSymbol.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Net.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Net.mat new file mode 100644 index 0000000000000000000000000000000000000000..6375528858fd79bdc22d508abbff6a8451eb91e5 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Net.mat @@ -0,0 +1,77 @@ +%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: Net + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _ALPHATEST_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2450 + stringTagMap: + RenderType: TransparentCutout + 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: 47c07dd05d80a8d42b0329ff416b8455, 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 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 1 + - _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} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Net.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Net.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..b795cf26cac2dc87eaa1723903224e426caad16e Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Net.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Orange.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Orange.mat new file mode 100644 index 0000000000000000000000000000000000000000..d6865f08294ba15133d4ec2489a5dd0d6f4cee12 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Orange.mat @@ -0,0 +1,76 @@ +%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: Orange + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.98039216, g: 0.6509804, b: 0.16078432, a: 1} + - _EmissionColor: {r: 0.98039216, g: 0.6509804, b: 0.16078432, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Orange.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Orange.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..63d90aafd4602ff51c0db7a75f197f678182f206 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Orange.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Outline.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Outline.mat new file mode 100644 index 0000000000000000000000000000000000000000..d7df39c32981c6e1e50f8330ef6ff68b04f3f74b --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Outline.mat @@ -0,0 +1,82 @@ +%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: Outline + m_Shader: {fileID: 4800000, guid: 5dfe02aa25125453eaaaa295936dc8cd, type: 3} + 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: 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: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _OutlineVal: 0.08 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SpeedX: 0 + - _SpeedY: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + - _Zoom: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _OutlineCol: {r: 1, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Outline.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Outline.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..ebd91373e0e4b13a3a194c3175a63c6980902029 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Outline.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Purple.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Purple.mat new file mode 100644 index 0000000000000000000000000000000000000000..2cf609e1359b6736449da1640424d1a274ebbf3f --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Purple.mat @@ -0,0 +1,77 @@ +%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: Purple + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.875, g: 0.39112502, b: 0.86165184, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Purple.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Purple.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..c8eb5652f7019603868837dd1ac22ee0d314e3d0 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Purple.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Red.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Red.mat new file mode 100644 index 0000000000000000000000000000000000000000..8e744aa4d4ef5b5a05449136e5bc611b566cff11 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Red.mat @@ -0,0 +1,76 @@ +%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: Red + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.74509805, g: 0.22745098, b: 0.15294118, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Red.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Red.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..429c30fd299a8705329fc7e89dc61dc1ccace2c5 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Red.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderOutline.shader b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderOutline.shader new file mode 100644 index 0000000000000000000000000000000000000000..2daffef41ebda3f2026bfd4290b9f979002852f5 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderOutline.shader @@ -0,0 +1,88 @@ +// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' + +Shader "Custom/Outline and ScreenSpace texture" +{ + Properties + { + [Header(Outline)] + _OutlineVal ("Outline value", Range(0., 2.)) = 1. + _OutlineCol ("Outline color", color) = (1., 1., 1., 1.) + [Header(Texture)] + _MainTex ("Texture", 2D) = "white" {} + _Zoom ("Zoom", Range(0.5, 20)) = 1 + _SpeedX ("Speed along X", Range(-1, 1)) = 0 + _SpeedY ("Speed along Y", Range(-1, 1)) = 0 + } + SubShader + { + Tags { "Queue"="Geometry" "RenderType"="Opaque" } + + Pass + { + Cull Front + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + struct v2f { + float4 pos : SV_POSITION; + }; + + float _OutlineVal; + + v2f vert(appdata_base v) { + v2f o; + + // Convert vertex to clip space + o.pos = UnityObjectToClipPos(v.vertex); + + // Convert normal to view space (camera space) + float3 normal = mul((float3x3) UNITY_MATRIX_IT_MV, v.normal); + + // Compute normal value in clip space + normal.x *= UNITY_MATRIX_P[0][0]; + normal.y *= UNITY_MATRIX_P[1][1]; + + // Scale the model depending the previous computed normal and outline value + o.pos.xy += _OutlineVal * normal.xy; + return o; + } + + fixed4 _OutlineCol; + + fixed4 frag(v2f i) : SV_Target { + return _OutlineCol; + } + + ENDCG + } + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + + float4 vert(appdata_base v) : SV_POSITION + { + return UnityObjectToClipPos(v.vertex); + } + + sampler2D _MainTex; + float _Zoom; + float _SpeedX; + float _SpeedY; + + fixed4 frag(float4 i : VPOS) : SV_Target + { + // Screen space texture + return tex2D(_MainTex, ((i.xy / _ScreenParams.xy) + float2(_Time.y * _SpeedX, _Time.y * _SpeedY)) / _Zoom); + } + + ENDCG + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderOutline.shader.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderOutline.shader.meta new file mode 100644 index 0000000000000000000000000000000000000000..dcbd0f9d60e69f78dc910f43ca9a62765bda365e Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderOutline.shader.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderRadialGrid.shader b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderRadialGrid.shader new file mode 100644 index 0000000000000000000000000000000000000000..3de3352442ff603dfd07f638c5cb5c9258b49fff --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderRadialGrid.shader @@ -0,0 +1,88 @@ +Shader "Custom/WireFrame" { + Properties { + _LineColor ("LineColor", Color) = (1, 1, 1, 1) + _MainColor ("_MainColor", Color) = (1, 1, 1, 1) + _LineWidth ("Line width", Range(0, 1)) = 0.1 + _ParcelSize ("ParcelSize", Range(0, 100)) = 1 + } + SubShader { + Tags { "Queue"="Transparent" "RenderType"="Transparent" } + + CGPROGRAM + #pragma surface surf Lambert alpha + + sampler2D _MainTex; + float4 _LineColor; + float4 _MainColor; + fixed _LineWidth; + float _ParcelSize; + + struct Input { + float2 uv_MainTex; + float3 worldPos; + }; + + void surf (Input IN, inout SurfaceOutput o) { + half val1 = step(_LineWidth * 2, frac(IN.worldPos.x / _ParcelSize) + _LineWidth); + half val2 = step(_LineWidth * 2, frac(IN.worldPos.z / _ParcelSize) + _LineWidth); + fixed val = 1 - (val1 * val2); + o.Albedo = lerp(_MainColor, _LineColor, val); + o.Alpha = 1; + } + ENDCG + } + FallBack "Diffuse" +} + +// //Shader uses screen-space partial derivatives, works the best with terrain meshes. + +// Shader "Wireframe" +// { +// Properties +// { +// [Header(Settings)] [Toggle] _transparency ("Transparency", Float) = 1 +// } +// Subshader +// { +// Pass +// { +// Cull Off +// CGPROGRAM +// #pragma vertex vertex_shader +// #pragma fragment pixel_shader +// #pragma target 3.0 + +// struct structure +// { +// float4 gl_Position : SV_POSITION; +// float3 vertex : TEXCOORD0; +// }; + +// float _transparency; + +// structure vertex_shader (float4 vertex:POSITION) +// { +// structure vs; +// vs.gl_Position = UnityObjectToClipPos (vertex); +// vs.vertex = vertex; +// return vs; +// } + +// float4 pixel_shader (structure ps) : COLOR +// { +// float2 p = ps.vertex.xz; +// float2 g = abs(frac(p - 0.5) - 0.5) / fwidth(p); +// float s = min(g.x, g.y); +// float4 c = float4(s,s,s, 1.0); +// if (c.r<1.0) +// return 1.0-c; +// else +// { +// if (_transparency==1) discard; +// return 0; +// } +// } +// ENDCG +// } +// } +// } diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderRadialGrid.shader.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderRadialGrid.shader.meta new file mode 100644 index 0000000000000000000000000000000000000000..4c2cd2b597fa76bc575efe75fab563f735dfba13 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/ShaderRadialGrid.shader.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures.meta new file mode 100644 index 0000000000000000000000000000000000000000..88a23bc01c7abe16752703287bc2fd9679d45a2c Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/CheckersGray_BC.png b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/CheckersGray_BC.png new file mode 100644 index 0000000000000000000000000000000000000000..84f636ee8cc3650ab3130c167104fcb836c36f78 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/CheckersGray_BC.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6fdaee2c6026a38c2205e7ffb902ce25381e91934d82ac53a4c828114a08c59b +size 160263 diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/CheckersGray_BC.png.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/CheckersGray_BC.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..b5f603db9e690fd7d8b365cad7d07ba60636d206 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/CheckersGray_BC.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_CO.tif b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_CO.tif new file mode 100644 index 0000000000000000000000000000000000000000..85ffd2ec4ab94f87fad70f9aeccef7a3fa25328e --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_CO.tif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f387d82b72f8606a5512d83e145153347eabec680828388fa1f464ccad66b061 +size 2668851 diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_CO.tif.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_CO.tif.meta new file mode 100644 index 0000000000000000000000000000000000000000..be4eeb4ccfbb8bdabc1ec84c896c50e448ee9c29 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_CO.tif.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_NO.png b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_NO.png new file mode 100644 index 0000000000000000000000000000000000000000..2d462d273bc72face1ae8a83244bbca1bf21c75a --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_NO.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e130c2f93f52be7fff472254ab9a32fffb5023b0a312b9c5166082cf310c1848 +size 578072 diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_NO.png.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_NO.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..0c617a3ff7c702bbc1fcf6e626fe8abc99202478 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/Checkers_NO.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/LogoCube.png b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/LogoCube.png new file mode 100644 index 0000000000000000000000000000000000000000..a23ed303d1d0f96312cb97129f859190757a51e5 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/LogoCube.png differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/LogoCube.png.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/LogoCube.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..3ad0a748eaa6a8f64fe684e764414e4a795f1a65 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/LogoCube.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/NetAL.tif b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/NetAL.tif new file mode 100644 index 0000000000000000000000000000000000000000..8d4c1f7ffec352f3525c4bd0183445a14bce6901 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/NetAL.tif differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/NetAL.tif.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/NetAL.tif.meta new file mode 100644 index 0000000000000000000000000000000000000000..045e2683e7e9cc84fa232f5f0b96bf5493fb74db Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/NetAL.tif.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/U_Logo_White_RGB.png b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/U_Logo_White_RGB.png new file mode 100644 index 0000000000000000000000000000000000000000..385a5558fa869966830fab2a306d749d112d9c33 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/U_Logo_White_RGB.png differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/U_Logo_White_RGB.png.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/U_Logo_White_RGB.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..c339b6cd706d2ffcb913c03b6abbc69c470322ab Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/U_Logo_White_RGB.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/gridTexture.png b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/gridTexture.png new file mode 100644 index 0000000000000000000000000000000000000000..024c58fa4af7c1c5f46368734327811d56ba63a7 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/gridTexture.png differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/gridTexture.png.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/gridTexture.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..a0356d2e89485809f4f3a2b67bb0e428121f2296 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Textures/gridTexture.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/UIDefault.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/UIDefault.mat new file mode 100644 index 0000000000000000000000000000000000000000..0fe5ed45840c3d0611a8fd228a9c08611e448d2f --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/UIDefault.mat @@ -0,0 +1,84 @@ +%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: UIDefault + m_Shader: {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: ETC1_EXTERNAL_ALPHA + 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: + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _UseUIAlphaClip: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/UIDefault.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/UIDefault.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..7aae6070c101a22f28761b3531d0fcb27308190a Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/UIDefault.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/White.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/White.mat new file mode 100644 index 0000000000000000000000000000000000000000..d06d059e6ba514991640d7a4047982f032f4d604 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/White.mat @@ -0,0 +1,76 @@ +%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: White + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.9254902, g: 0.9372549, b: 0.9411765, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/White.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/White.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..a440f5fcf4c352b97161cdef69a9f6c2a849e09f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/White.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Yellow.mat b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Yellow.mat new file mode 100644 index 0000000000000000000000000000000000000000..2d5515371959f669cc0c30b986b3b9609fa75686 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Yellow.mat @@ -0,0 +1,76 @@ +%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: Yellow + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + 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: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 0.79607844, b: 0.15294118, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Yellow.mat.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Yellow.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..7a1d8e973e032b6f1412d226ffe8500a15ebf24f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Materials/Yellow.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes.meta new file mode 100644 index 0000000000000000000000000000000000000000..69d173bba9c86cd1945a95597452d1680641f1a1 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/AgentCube.fbx b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/AgentCube.fbx new file mode 100644 index 0000000000000000000000000000000000000000..2642fc91f6b3b1dfacd742d7b43df0f2d357f717 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/AgentCube.fbx differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/AgentCube.fbx.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/AgentCube.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..7685d0d0286341e17d02dcf5c2673d6a950c2c64 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/AgentCube.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongNarrowPlatform.fbx b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongNarrowPlatform.fbx new file mode 100644 index 0000000000000000000000000000000000000000..2484644851e441c87b290b4e497162b0e940430f --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongNarrowPlatform.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6080c93b90e0bc80563d039f16924fc0dccd1c5abc3eb4310b39936dfd1e4345 +size 122704 diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongNarrowPlatform.fbx.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongNarrowPlatform.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..6fa6b61127b34aa976745fbcd500e7264cf1072a Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongNarrowPlatform.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongPlatform.fbx b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongPlatform.fbx new file mode 100644 index 0000000000000000000000000000000000000000..b9d90c4e838aa1d8b0a34e89c64d1ab24bf878c0 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongPlatform.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b95c80bd4b708dd501c284a254f82a6aa5aee79cbc04b45491771ab78524b310 +size 117472 diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongPlatform.fbx.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongPlatform.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..ddd3a30676da7684e4fe90159c6e74c49e3a5a30 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/LongPlatform.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_circle.fbx b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_circle.fbx new file mode 100644 index 0000000000000000000000000000000000000000..50c814a77e50448bcda28e122f2bfe7b2429d0d6 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_circle.fbx differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_circle.fbx.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_circle.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..1c4a9995d44b21b246a27f6da5697b4c0c16df0c Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_circle.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_star.fbx b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_star.fbx new file mode 100644 index 0000000000000000000000000000000000000000..473aff1920213ae67496cbd79dfd69e7b6e43ed0 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_star.fbx differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_star.fbx.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_star.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..0e7e3c468091f96455bead25e108f8eab40a5245 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_star.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_tri.fbx b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_tri.fbx new file mode 100644 index 0000000000000000000000000000000000000000..36843ae7cb39fc04990d716422e430679116095b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_tri.fbx differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_tri.fbx.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_tri.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..731dafdc6550f967deaf1d83741f49202a4f22b3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_tri.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_x.fbx b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_x.fbx new file mode 100644 index 0000000000000000000000000000000000000000..9bb644e1beaf79c1ed2f05c76a8c5f635f9af3b3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_x.fbx differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_x.fbx.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_x.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..9338127395e010b19944f08c54f022129a8b26d0 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Meshes/symbol_x.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs.meta new file mode 100644 index 0000000000000000000000000000000000000000..413a49a058c4c8c1e1f6eac1d6b1a09a992e1e67 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Blue.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Blue.prefab new file mode 100644 index 0000000000000000000000000000000000000000..14cf112fe1dd1a9913060c52686773ac30531f3e Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Blue.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Blue.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Blue.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..9f8a90f997ebd1c8860c39f137363c45243a017d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Blue.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Purple.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Purple.prefab new file mode 100644 index 0000000000000000000000000000000000000000..b0f16acb2fc947d18f178dc44cd83ed27689dc43 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Purple.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Purple.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Purple.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..bd844b54a6a5d4d93bb173811e63bd1773c3f5ce Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeBeveled_Purple.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Blue.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Blue.prefab new file mode 100644 index 0000000000000000000000000000000000000000..f267305c4218a4cf5f723ff2b5f2907bc326bb21 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Blue.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Blue.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Blue.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..40da7452b67fc8bf837ef8238d74fa0c020957dd Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Blue.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Purple.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Purple.prefab new file mode 100644 index 0000000000000000000000000000000000000000..702c4d105aea08835a445aac0859762b567cb82d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Purple.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Purple.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Purple.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..48255a9187b9773b3f9c08207ebcbdea73e8942d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCubeWithCamera_Purple.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Blue.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Blue.prefab new file mode 100644 index 0000000000000000000000000000000000000000..6316e3063685edf5fc0a900ccc308de0ba8df1e2 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Blue.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Blue.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Blue.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..a0106fc9241c7f557658e52715676bd12449a0ae Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Blue.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Purple.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Purple.prefab new file mode 100644 index 0000000000000000000000000000000000000000..9f3a977d895ab67cc91b6a7b75837222921fe484 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Purple.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Purple.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Purple.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..ab30641bc58735a0abd07686abf6e2b56c59ee47 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/AgentCube_Purple.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Canvas_Watermark.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Canvas_Watermark.prefab new file mode 100644 index 0000000000000000000000000000000000000000..078274d921ad2f73b63417a271c607fbc2ba1488 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Canvas_Watermark.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Canvas_Watermark.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Canvas_Watermark.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..22504d9589b651b4817f46eda25c26214c989c05 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Canvas_Watermark.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DirectionIndicator.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DirectionIndicator.prefab new file mode 100644 index 0000000000000000000000000000000000000000..d3f976b1b908f021ab0012e3fafd159d5946297a Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DirectionIndicator.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DirectionIndicator.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DirectionIndicator.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..e9be066cbc3a73e153cc0dbf4aab50f13a472f69 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DirectionIndicator.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Directional_Light.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Directional_Light.prefab new file mode 100644 index 0000000000000000000000000000000000000000..f6cbffb608b6721af2416699ddb1162a7f3fb6fd Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Directional_Light.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Directional_Light.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Directional_Light.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..7e04d96f745ac3b565bfac3684ebeadceebbc970 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Directional_Light.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DynamicTargetPlatform.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DynamicTargetPlatform.prefab new file mode 100644 index 0000000000000000000000000000000000000000..0ab8eec1688f1bb94e0450f5574589bdfbf8c7ef Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DynamicTargetPlatform.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DynamicTargetPlatform.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DynamicTargetPlatform.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..f579fdddb8453f0d68b35d74f56abd955bcd55d0 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/DynamicTargetPlatform.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-BLACK.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-BLACK.prefab new file mode 100644 index 0000000000000000000000000000000000000000..01d7dfde6fa5bdd17c6f0cba2a0bea57040c9847 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-BLACK.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-BLACK.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-BLACK.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..19beb6fc316df17c048060520f60d021b897e4df Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-BLACK.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-GRAY.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-GRAY.prefab new file mode 100644 index 0000000000000000000000000000000000000000..7ed0074b4c16fb40b58ee58d335fca97a56f86d3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-GRAY.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-GRAY.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-GRAY.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..9b1f182ad0feca342324e746ee7a5a2d716a7891 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-GRAY.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-WHITE.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-WHITE.prefab new file mode 100644 index 0000000000000000000000000000000000000000..547c3d96d49ee93a246c15d272b6cb988f919368 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-WHITE.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-WHITE.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-WHITE.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..34881eb304c5fffa8f47d8cb8b4f5b3bf117d2f8 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Logo-PlaneMesh-WHITE.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/OrientationCube.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/OrientationCube.prefab new file mode 100644 index 0000000000000000000000000000000000000000..3fae12c028f72c963e5f5c28dde0ff136dd2d61e Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/OrientationCube.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/OrientationCube.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/OrientationCube.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..86e172fbca87a87d94d6da227dca1e6f0d2d813b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/OrientationCube.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/PlatformDynamicTarget.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/PlatformDynamicTarget.prefab new file mode 100644 index 0000000000000000000000000000000000000000..7d450d6885a6457a8a9f23d9832ba6bb4e3de5dc Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/PlatformDynamicTarget.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/PlatformDynamicTarget.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/PlatformDynamicTarget.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..e71b08a262cfc94341e911dc6acbebdd19a8e286 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/PlatformDynamicTarget.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms.meta new file mode 100644 index 0000000000000000000000000000000000000000..950e32cf2fdf3bd01df89ba74d302e64d4162071 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms/LongPlatform.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms/LongPlatform.prefab new file mode 100644 index 0000000000000000000000000000000000000000..5e6071ab9e6835f9e07a6e76e2b5649d59af683e Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms/LongPlatform.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms/LongPlatform.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms/LongPlatform.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..2e590f73bff485b7df99cb52d09d5e621075881e Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Platforms/LongPlatform.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_O.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_O.prefab new file mode 100644 index 0000000000000000000000000000000000000000..84c33c99f8abb85596e66bffaa4f01b80a33d50d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_O.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_O.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_O.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..9987a5e630dd36d3f84aef7e5ad978e160e0a2a9 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_O.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Star.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Star.prefab new file mode 100644 index 0000000000000000000000000000000000000000..60cd94be6e2f0d214adb4ced51c54ca9e80633a9 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Star.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Star.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Star.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..8539c0be31087685835c28783b10b38bdb9b7f46 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Star.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Triangle.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Triangle.prefab new file mode 100644 index 0000000000000000000000000000000000000000..16e38f8886fc31e3c819596bfce3699ce8aa4a2b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Triangle.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Triangle.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Triangle.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..55b361e67178570805929019f5c2b239458cde4d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_Triangle.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_X.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_X.prefab new file mode 100644 index 0000000000000000000000000000000000000000..82444502bd0d22cfc17ed49b9f00c7413f8fb038 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_X.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_X.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_X.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..517ff7d4e6b0fd942da495bd1682bd0de1fb8e64 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Symbol_X.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets.meta new file mode 100644 index 0000000000000000000000000000000000000000..bcc1ada4baff64449c94fae144f40ffa73e54a56 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/DynamicTarget.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/DynamicTarget.prefab new file mode 100644 index 0000000000000000000000000000000000000000..df9838fe43e87a757d8b516d087e65af70fa2b1d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/DynamicTarget.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/DynamicTarget.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/DynamicTarget.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..b6598013d3a4ae75c44e9f033a4bc097f3a1bea3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/DynamicTarget.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/StaticTarget.prefab b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/StaticTarget.prefab new file mode 100644 index 0000000000000000000000000000000000000000..b0bcb1e4642d60e4b0a3e4eaa7a85f743b6ce5f3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/StaticTarget.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/StaticTarget.prefab.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/StaticTarget.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..50c13fef2e7055977ba765076c823ae40a71a15d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Prefabs/Targets/StaticTarget.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts.meta new file mode 100644 index 0000000000000000000000000000000000000000..df15e99af99e3b3c10234f1e40f5f7f6c27b0043 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/AdjustTrainingTimescale.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/AdjustTrainingTimescale.cs new file mode 100644 index 0000000000000000000000000000000000000000..e111353c99d36a69fc90c1b6a1eb96a2ee8fd0c5 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/AdjustTrainingTimescale.cs @@ -0,0 +1,54 @@ +//This script lets you change time scale during training. It is not a required script for this demo to function + +using UnityEngine; + +namespace MLAgentsExamples +{ + public class AdjustTrainingTimescale : MonoBehaviour + { + // Update is called once per frame + void Update() + { + if (Input.GetKeyDown(KeyCode.Alpha1)) + { + Time.timeScale = 1f; + } + if (Input.GetKeyDown(KeyCode.Alpha2)) + { + Time.timeScale = 2f; + } + if (Input.GetKeyDown(KeyCode.Alpha3)) + { + Time.timeScale = 3f; + } + if (Input.GetKeyDown(KeyCode.Alpha4)) + { + Time.timeScale = 4f; + } + if (Input.GetKeyDown(KeyCode.Alpha5)) + { + Time.timeScale = 5f; + } + if (Input.GetKeyDown(KeyCode.Alpha6)) + { + Time.timeScale = 6f; + } + if (Input.GetKeyDown(KeyCode.Alpha7)) + { + Time.timeScale = 7f; + } + if (Input.GetKeyDown(KeyCode.Alpha8)) + { + Time.timeScale = 8f; + } + if (Input.GetKeyDown(KeyCode.Alpha9)) + { + Time.timeScale = 9f; + } + if (Input.GetKeyDown(KeyCode.Alpha0)) + { + Time.timeScale *= 2f; + } + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/AdjustTrainingTimescale.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/AdjustTrainingTimescale.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ed6469dcb4e3d432b5ee5b1fe869bb201db74c3f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/AdjustTrainingTimescale.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Area.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Area.cs new file mode 100644 index 0000000000000000000000000000000000000000..65bc08acdac9f67b05921a9718943913e168d324 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Area.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace Unity.MLAgentsExamples +{ + public class Area : MonoBehaviour + { + public virtual void ResetArea() + { + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Area.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Area.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..b08c7db438d23798bd8137cee8f352fe4fee9d92 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Area.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CameraFollow.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CameraFollow.cs new file mode 100644 index 0000000000000000000000000000000000000000..d387223c67801df97d2d96a19e13f71310117fa1 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CameraFollow.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace Unity.MLAgentsExamples +{ + public class CameraFollow : MonoBehaviour + { + [Tooltip("The target to follow")] public Transform target; + + [Tooltip("The time it takes to move to the new position")] + public float smoothingTime; //The time it takes to move to the new position + + private Vector3 m_Offset; + private Vector3 m_CamVelocity; //Camera's velocity (used by SmoothDamp) + + // Use this for initialization + void Start() + { + m_Offset = gameObject.transform.position - target.position; + } + + void FixedUpdate() + { + var newPosition = new Vector3(target.position.x + m_Offset.x, transform.position.y, + target.position.z + m_Offset.z); + + gameObject.transform.position = + Vector3.SmoothDamp(transform.position, newPosition, ref m_CamVelocity, smoothingTime, Mathf.Infinity, + Time.fixedDeltaTime); + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CameraFollow.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CameraFollow.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..cd6bf5139e4aaff290779f5da641a00d0759622f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CameraFollow.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CollisionCallbacks.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CollisionCallbacks.cs new file mode 100644 index 0000000000000000000000000000000000000000..c9a26bfc8cdcbf62f7ef80fa72fcda5da94b7fd9 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CollisionCallbacks.cs @@ -0,0 +1,141 @@ +using UnityEngine; +using UnityEngine.Events; + +namespace Unity.MLAgentsExamples +{ + /// + /// Utility class to allow target placement and collision detection with an agent + /// Add this script to the target you want the agent to touch. + /// Callbacks will be triggered any time the target is touched with a collider tagged as 'tagToDetect' + /// + public class CollisionCallbacks : MonoBehaviour + { + // [System.Serializable] public class BoolEvent : UnityEvent { } + // [SerializeField] BoolEvent boolEvent = new BoolEvent(); + // public void OnBoolEvent(bool value) + // { + // Debug.Log($"OnBoolEvent {value}"); + // } + + + [Header("Collider Tag To Detect")] + public string tagToDetect = "agent"; //collider tag to detect + + // [Header("Target Placement")] + // public float spawnRadius; //The radius in which a target can be randomly spawned. + // public bool respawnIfTouched; //Should the target respawn to a different position when touched + // + // [Header("Target Fell Protection")] + // public bool respawnIfFallsOffPlatform = true; //If the target falls off the platform, reset the position. + // public float fallDistance = 5; //distance below the starting height that will trigger a respawn + // + // + // private Vector3 m_startingPos; //the starting position of the target + // private Agent m_agentTouching; //the agent currently touching the target + + [System.Serializable] + // public class TriggerEvent : UnityEvent + public class TriggerEvent : UnityEvent + { + } + + [Header("Trigger Callbacks")] + public TriggerEvent onTriggerEnterEvent = new TriggerEvent(); + public TriggerEvent onTriggerStayEvent = new TriggerEvent(); + public TriggerEvent onTriggerExitEvent = new TriggerEvent(); + + [System.Serializable] + public class CollisionEvent : UnityEvent + { + } + + [Header("Collision Callbacks")] + public CollisionEvent onCollisionEnterEvent = new CollisionEvent(); + public CollisionEvent onCollisionStayEvent = new CollisionEvent(); + public CollisionEvent onCollisionExitEvent = new CollisionEvent(); + + // // Start is called before the first frame update + // void OnEnable() + // { + // m_startingPos = transform.position; + // if (respawnIfTouched) + // { + // MoveTargetToRandomPosition(); + // } + // } + + // void Update() + // { + // if (respawnIfFallsOffPlatform) + // { + // if (transform.position.y < m_startingPos.y - fallDistance) + // { + // Debug.Log($"{transform.name} Fell Off Platform"); + // MoveTargetToRandomPosition(); + // } + // } + // } + + // /// + // /// Moves target to a random position within specified radius. + // /// + // public void MoveTargetToRandomPosition() + // { + // var newTargetPos = m_startingPos + (Random.insideUnitSphere * spawnRadius); + // newTargetPos.y = m_startingPos.y; + // transform.position = newTargetPos; + // } + + private void OnCollisionEnter(Collision col) + { + if (col.transform.CompareTag(tagToDetect)) + { + onCollisionEnterEvent.Invoke(col, transform); + // if (respawnIfTouched) + // { + // MoveTargetToRandomPosition(); + // } + } + } + + private void OnCollisionStay(Collision col) + { + if (col.transform.CompareTag(tagToDetect)) + { + onCollisionStayEvent.Invoke(col, transform); + } + } + + private void OnCollisionExit(Collision col) + { + if (col.transform.CompareTag(tagToDetect)) + { + onCollisionExitEvent.Invoke(col, transform); + } + } + + private void OnTriggerEnter(Collider col) + { + if (col.CompareTag(tagToDetect)) + { + onTriggerEnterEvent.Invoke(col); + } + } + + private void OnTriggerStay(Collider col) + { + if (col.CompareTag(tagToDetect)) + { + onTriggerStayEvent.Invoke(col); + } + } + + private void OnTriggerExit(Collider col) + { + if (col.CompareTag(tagToDetect)) + { + onTriggerExitEvent.Invoke(col); + } + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CollisionCallbacks.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CollisionCallbacks.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..c9219d2c741ac9f0bd40c5afb8aece7e7e898eb4 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/CollisionCallbacks.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/DirectionIndicator.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/DirectionIndicator.cs new file mode 100644 index 0000000000000000000000000000000000000000..fe6a07f0c799b43108b4b84597cf0eb93b177ff1 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/DirectionIndicator.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +namespace Unity.MLAgentsExamples +{ + public class DirectionIndicator : MonoBehaviour + { + + public bool updatedByAgent; //should this be updated by the agent? If not, it will use local settings + public Transform transformToFollow; //ex: hips or body + public Transform targetToLookAt; //target in the scene the indicator will point to + public float heightOffset; + private float m_StartingYPos; + + void OnEnable() + { + m_StartingYPos = transform.position.y; + } + + void Update() + { + if (updatedByAgent) + return; + transform.position = new Vector3(transformToFollow.position.x, m_StartingYPos + heightOffset, + transformToFollow.position.z); + Vector3 walkDir = targetToLookAt.position - transform.position; + walkDir.y = 0; //flatten dir on the y + transform.rotation = Quaternion.LookRotation(walkDir); + } + + //Public method to allow an agent to directly update this component + public void MatchOrientation(Transform t) + { + transform.position = new Vector3(t.position.x, m_StartingYPos + heightOffset, t.position.z); + transform.rotation = t.rotation; + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/DirectionIndicator.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/DirectionIndicator.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..7d3b7674caacfc9187a87cc9be8cc755f00bba0d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/DirectionIndicator.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/FlyCamera.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/FlyCamera.cs new file mode 100644 index 0000000000000000000000000000000000000000..8fe3fd0cdd3a52c20e6438209f596248b064e2e5 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/FlyCamera.cs @@ -0,0 +1,116 @@ +using UnityEngine; + +namespace Unity.MLAgentsExamples +{ + public class FlyCamera : MonoBehaviour + { + /* + wasd : basic movement + shift : Makes camera accelerate + space : Moves camera on X and Z axis only. So camera doesn't gain any height*/ + + + public float mainSpeed = 100.0f; // regular speed + public float shiftAdd = 250.0f; // multiplied by how long shift is held. Basically running + public float maxShift = 1000.0f; // Maximum speed when holdin gshift + public float camSens = 0.25f; // How sensitive it with mouse + public bool rotateOnlyIfMousedown = true; + public bool movementStaysFlat = true; + + Vector3 + m_LastMouse = + new Vector3(255, 255, + 255); // kind of in the middle of the screen, rather than at the top (play) + + float m_TotalRun = 1.0f; + + void Awake() + { + Debug.Log("FlyCamera Awake() - RESETTING CAMERA POSITION"); // nop? + // nop: + // transform.position.Set(0,8,-32); + // transform.rotation.Set(15,0,0,1); + transform.position = new Vector3(0, 8, -32); + transform.rotation = Quaternion.Euler(25, 0, 0); + } + + void Update() + { + if (Input.GetMouseButtonDown(1)) + { + m_LastMouse = Input.mousePosition; // $CTK reset when we begin + } + + if (!rotateOnlyIfMousedown || + (rotateOnlyIfMousedown && Input.GetMouseButton(1))) + { + m_LastMouse = Input.mousePosition - m_LastMouse; + m_LastMouse = new Vector3(-m_LastMouse.y * camSens, m_LastMouse.x * camSens, 0); + m_LastMouse = new Vector3(transform.eulerAngles.x + m_LastMouse.x, + transform.eulerAngles.y + m_LastMouse.y, 0); + transform.eulerAngles = m_LastMouse; + m_LastMouse = Input.mousePosition; + // Mouse camera angle done. + } + + // Keyboard commands + var p = GetBaseInput(); + if (Input.GetKey(KeyCode.LeftShift)) + { + m_TotalRun += Time.deltaTime; + p = shiftAdd * m_TotalRun * p; + p.x = Mathf.Clamp(p.x, -maxShift, maxShift); + p.y = Mathf.Clamp(p.y, -maxShift, maxShift); + p.z = Mathf.Clamp(p.z, -maxShift, maxShift); + } + else + { + m_TotalRun = Mathf.Clamp(m_TotalRun * 0.5f, 1f, 1000f); + p = p * mainSpeed; + } + + p = p * Time.deltaTime; + var newPosition = transform.position; + if (Input.GetKey(KeyCode.Space) + || (movementStaysFlat && !(rotateOnlyIfMousedown && Input.GetMouseButton(1)))) + { + // If player wants to move on X and Z axis only + transform.Translate(p); + newPosition.x = transform.position.x; + newPosition.z = transform.position.z; + transform.position = newPosition; + } + else + { + transform.Translate(p); + } + } + + Vector3 GetBaseInput() + { + // returns the basic values, if it's 0 than it's not active. + var pVelocity = new Vector3(); + if (Input.GetKey(KeyCode.W)) + { + pVelocity += new Vector3(0, 0, 1); + } + + if (Input.GetKey(KeyCode.S)) + { + pVelocity += new Vector3(0, 0, -1); + } + + if (Input.GetKey(KeyCode.A)) + { + pVelocity += new Vector3(-1, 0, 0); + } + + if (Input.GetKey(KeyCode.D)) + { + pVelocity += new Vector3(1, 0, 0); + } + + return pVelocity; + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/FlyCamera.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/FlyCamera.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..31dd4804738369984615a2817da1c9060d8222be Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/FlyCamera.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/GroundContact.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/GroundContact.cs new file mode 100644 index 0000000000000000000000000000000000000000..785d3579814f70c1866c403b375d56fbd74f56aa --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/GroundContact.cs @@ -0,0 +1,53 @@ +using UnityEngine; +using Unity.MLAgents; + +namespace Unity.MLAgentsExamples +{ + /// + /// This class contains logic for locomotion agents with joints which might make contact with the ground. + /// By attaching this as a component to those joints, their contact with the ground can be used as either + /// an observation for that agent, and/or a means of punishing the agent for making undesirable contact. + /// + [DisallowMultipleComponent] + public class GroundContact : MonoBehaviour + { + [HideInInspector] public Agent agent; + + [Header("Ground Check")] public bool agentDoneOnGroundContact; // Whether to reset agent on ground contact. + public bool penalizeGroundContact; // Whether to penalize on contact. + public float groundContactPenalty; // Penalty amount (ex: -1). + public bool touchingGround; + const string k_Ground = "ground"; // Tag of ground object. + + /// + /// Check for collision with ground, and optionally penalize agent. + /// + void OnCollisionEnter(Collision col) + { + if (col.transform.CompareTag(k_Ground)) + { + touchingGround = true; + if (penalizeGroundContact) + { + agent.SetReward(groundContactPenalty); + } + + if (agentDoneOnGroundContact) + { + agent.EndEpisode(); + } + } + } + + /// + /// Check for end of ground collision and reset flag appropriately. + /// + void OnCollisionExit(Collision other) + { + if (other.transform.CompareTag(k_Ground)) + { + touchingGround = false; + } + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/GroundContact.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/GroundContact.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d0857933f277ead547fdf382b938b899b06cf15d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/GroundContact.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs new file mode 100644 index 0000000000000000000000000000000000000000..feebeb04e04fc6b4617f81f433d72986502b0028 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs @@ -0,0 +1,189 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Serialization; +using Unity.MLAgents; + +namespace Unity.MLAgentsExamples +{ + /// + /// Used to store relevant information for acting and learning for each body part in agent. + /// + [System.Serializable] + public class BodyPart + { + [Header("Body Part Info")][Space(10)] public ConfigurableJoint joint; + public Rigidbody rb; + [HideInInspector] public Vector3 startingPos; + [HideInInspector] public Quaternion startingRot; + + [Header("Ground & Target Contact")] + [Space(10)] + public GroundContact groundContact; + + public TargetContact targetContact; + + [FormerlySerializedAs("thisJDController")] + [HideInInspector] public JointDriveController thisJdController; + + [Header("Current Joint Settings")] + [Space(10)] + public Vector3 currentEularJointRotation; + + [HideInInspector] public float currentStrength; + public float currentXNormalizedRot; + public float currentYNormalizedRot; + public float currentZNormalizedRot; + + [Header("Other Debug Info")] + [Space(10)] + public Vector3 currentJointForce; + + public float currentJointForceSqrMag; + public Vector3 currentJointTorque; + public float currentJointTorqueSqrMag; + public AnimationCurve jointForceCurve = new AnimationCurve(); + public AnimationCurve jointTorqueCurve = new AnimationCurve(); + + /// + /// Reset body part to initial configuration. + /// + public void Reset(BodyPart bp) + { + bp.rb.transform.position = bp.startingPos; + bp.rb.transform.rotation = bp.startingRot; + bp.rb.linearVelocity = Vector3.zero; + bp.rb.angularVelocity = Vector3.zero; + if (bp.groundContact) + { + bp.groundContact.touchingGround = false; + } + + if (bp.targetContact) + { + bp.targetContact.touchingTarget = false; + } + } + + /// + /// Apply torque according to defined goal `x, y, z` angle and force `strength`. + /// + public void SetJointTargetRotation(float x, float y, float z) + { + x = (x + 1f) * 0.5f; + y = (y + 1f) * 0.5f; + z = (z + 1f) * 0.5f; + + var xRot = Mathf.Lerp(joint.lowAngularXLimit.limit, joint.highAngularXLimit.limit, x); + var yRot = Mathf.Lerp(-joint.angularYLimit.limit, joint.angularYLimit.limit, y); + var zRot = Mathf.Lerp(-joint.angularZLimit.limit, joint.angularZLimit.limit, z); + + currentXNormalizedRot = + Mathf.InverseLerp(joint.lowAngularXLimit.limit, joint.highAngularXLimit.limit, xRot); + currentYNormalizedRot = Mathf.InverseLerp(-joint.angularYLimit.limit, joint.angularYLimit.limit, yRot); + currentZNormalizedRot = Mathf.InverseLerp(-joint.angularZLimit.limit, joint.angularZLimit.limit, zRot); + + joint.targetRotation = Quaternion.Euler(xRot, yRot, zRot); + currentEularJointRotation = new Vector3(xRot, yRot, zRot); + } + + public void SetJointStrength(float strength) + { + var rawVal = (strength + 1f) * 0.5f * thisJdController.maxJointForceLimit; + var jd = new JointDrive + { + positionSpring = thisJdController.maxJointSpring, + positionDamper = thisJdController.jointDampen, + maximumForce = rawVal + }; + joint.slerpDrive = jd; + currentStrength = jd.maximumForce; + } + } + + public class JointDriveController : MonoBehaviour + { + [Header("Joint Drive Settings")] + [Space(10)] + public float maxJointSpring; + + public float jointDampen; + public float maxJointForceLimit; + + [System.NonSerialized] + [HideInInspector] public Dictionary bodyPartsDict = new Dictionary(); + + [HideInInspector] public List bodyPartsList = new List(); + const float k_MaxAngularVelocity = 50.0f; + + /// + /// Create BodyPart object and add it to dictionary. + /// + public void SetupBodyPart(Transform t) + { + var bp = new BodyPart + { + rb = t.GetComponent(), + joint = t.GetComponent(), + startingPos = t.position, + startingRot = t.rotation + }; + bp.rb.maxAngularVelocity = k_MaxAngularVelocity; + + // Add & setup the ground contact script + bp.groundContact = t.GetComponent(); + if (!bp.groundContact) + { + bp.groundContact = t.gameObject.AddComponent(); + bp.groundContact.agent = gameObject.GetComponent(); + } + else + { + bp.groundContact.agent = gameObject.GetComponent(); + } + + if (bp.joint) + { + var jd = new JointDrive + { + positionSpring = maxJointSpring, + positionDamper = jointDampen, + maximumForce = maxJointForceLimit + }; + bp.joint.slerpDrive = jd; + } + + bp.thisJdController = this; + bodyPartsDict.Add(t, bp); + bodyPartsList.Add(bp); + } + + public void GetCurrentJointForces() + { + foreach (var bodyPart in bodyPartsDict.Values) + { + if (bodyPart.joint) + { + bodyPart.currentJointForce = bodyPart.joint.currentForce; + bodyPart.currentJointForceSqrMag = bodyPart.joint.currentForce.magnitude; + bodyPart.currentJointTorque = bodyPart.joint.currentTorque; + bodyPart.currentJointTorqueSqrMag = bodyPart.joint.currentTorque.magnitude; + if (Application.isEditor) + { + if (bodyPart.jointForceCurve.length > 1000) + { + bodyPart.jointForceCurve = new AnimationCurve(); + } + + if (bodyPart.jointTorqueCurve.length > 1000) + { + bodyPart.jointTorqueCurve = new AnimationCurve(); + } + + bodyPart.jointForceCurve.AddKey(Time.time, bodyPart.currentJointForceSqrMag); + bodyPart.jointTorqueCurve.AddKey(Time.time, bodyPart.currentJointTorqueSqrMag); + } + } + } + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..03c214aea118d6cbd72b40d0693fefab5d6ca22b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/JointDriveController.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelCarousel.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelCarousel.cs new file mode 100644 index 0000000000000000000000000000000000000000..e1694558831e02ce4ef15d901a4187d3f0c5cc16 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelCarousel.cs @@ -0,0 +1,203 @@ +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using TMPro; +using Unity.InferenceEngine; +using Unity.MLAgents; +using Unity.MLAgents.Policies; +using UnityEditor; +#if UNITY_EDITOR +using UnityEditor.Recorder; +#endif +using UnityEngine; + +/** + * Usage Notes: + * + * Add onnx models to the list and they will be played sequentially. + * Create a recorder and a video of the sequence will be captured automatically if "Auto Record" is selected. + * Recording only works in the Editor (not in standalone build) + * Create a TextMeshPro Text GameObject and attach it to have the number of training steps of the current model shown. + * To manually control transition between models choose a very large time, or "Pause" the system, + * then use "Force Next" to advance. + * "Reset" will start the sequence from the beginning again, use "Start" to proceed after resetting. + * "Time Scale Override" can be set, "Seconds Between Switches" will decrease proportionally if you increase this + * (i.e it represents simulated seconds between switches, not real time) + */ + + +public class ModelCarousel : MonoBehaviour +{ + public bool m_Start = true; + public bool m_Reset = false; + public bool m_Pause = true; + public bool m_ForceNext = false; + public bool m_Loop = false; + public bool m_AutoRecord = true; + public bool m_ResetAgentOnModelChange = false; + public int m_SecondsBetweenSwitches = 10; + public float m_TimeScaleOverride = 0.0f; + public List m_Models = new List(); + public bool m_ShowStepNumber = true; + public int m_StepNumberRounding = 10000; + + private int m_StepsSinceLastSwitch = 0; + private int m_CurrentModelIndex = 0; + private int m_CurrentlySetModelIndex = -1; + + private ModelAsset m_OriginalModel = null; + + private int k_FixedUpdatePerSecond; + + // The attached Agent + Agent m_Agent; + + public TextMeshProUGUI textMeshComponent; + +#if UNITY_EDITOR + private RecorderWindow GetRecorderWindow() + { + return (RecorderWindow)EditorWindow.GetWindow(typeof(RecorderWindow)); + } +#endif + + private void Reset() + { + m_Reset = false; + m_StepsSinceLastSwitch = 0; + m_CurrentModelIndex = 0; + m_Agent.SetModel(m_OriginalModel.name, m_OriginalModel); + textMeshComponent?.SetText("Ready to Start"); + } + + private void OnEnable() + { + m_Agent = GetComponent(); + m_OriginalModel = m_Agent.GetComponent().Model; + + Reset(); + + k_FixedUpdatePerSecond = (int)(1.0f / Time.fixedDeltaTime); + + if (m_TimeScaleOverride > 0.0f) + { + Time.timeScale = m_TimeScaleOverride; + } + } + + void StartRecording() + { +#if UNITY_EDITOR + if (!m_AutoRecord) + return; + + Debug.Log("Starting Recording"); + RecorderWindow recorderWindow = GetRecorderWindow(); + if (!recorderWindow.IsRecording()) + recorderWindow.StartRecording(); +#endif + } + + void StopRecording() + { +#if UNITY_EDITOR + if (!m_AutoRecord) + return; + + Debug.Log("Stopping Recording"); + RecorderWindow recorderWindow = GetRecorderWindow(); + if (recorderWindow.IsRecording()) + recorderWindow.StopRecording(); +#endif + } + + void UpdateStepNumberText() + { + if (!m_ShowStepNumber) + return; + + var result = Regex.Match(m_Models[m_CurrentModelIndex].name, @".*-(\d+)$"); + + string newText = ""; + if (result.Success && result.Groups.Count > 0) + { + var steps = Int32.Parse(result.Groups[1].Captures[0].Value); + + int round = m_StepNumberRounding; + steps += round / 2; + steps /= round; + steps *= round; + + newText = $"After {steps:n0} steps"; + } + + textMeshComponent?.SetText(newText); + } + + void SetModel() + { + if (m_CurrentModelIndex < 0 || m_CurrentModelIndex >= m_Models.Count) + return; + + m_Agent.SetModel(m_Models[m_CurrentModelIndex].name, m_Models[m_CurrentModelIndex]); + m_CurrentlySetModelIndex = m_CurrentModelIndex; + + UpdateStepNumberText(); + + if (m_ResetAgentOnModelChange) + m_Agent.EndEpisode(); + } + + void FixedUpdate() + { + if (m_Start) + { + m_Start = false; + m_Pause = false; + StartRecording(); + } + + if (m_Reset) + { + StopRecording(); + Reset(); + m_Pause = true; + m_Start = false; + } + + if (m_Pause && !m_ForceNext) + return; + + if (m_CurrentlySetModelIndex != m_CurrentModelIndex) + { + SetModel(); + } + + m_StepsSinceLastSwitch++; + + if (m_StepsSinceLastSwitch >= m_SecondsBetweenSwitches * k_FixedUpdatePerSecond || m_ForceNext) + { + m_ForceNext = false; + m_StepsSinceLastSwitch = 0; + m_CurrentModelIndex++; + + if (m_CurrentModelIndex == m_Models.Count) + { + if (m_Loop) + { + m_CurrentModelIndex = 0; + } + else + { + Application.Quit(0); +#if UNITY_EDITOR + EditorApplication.isPlaying = false; +#endif + return; + } + } + + SetModel(); + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelCarousel.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelCarousel.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..affb030bc91dfa120d895c34838a1c1dc52c6e74 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelCarousel.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs new file mode 100644 index 0000000000000000000000000000000000000000..e6e4fb4caf120d9f9dc7d9a3a28f656ed9923bd2 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs @@ -0,0 +1,425 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Unity.InferenceEngine; +using System.IO; +using Unity.MLAgents; +using Unity.MLAgents.Policies; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace Unity.MLAgentsExamples +{ + /// + /// Utility class to allow the ModelAsset file for an agent to be overriden during inference. + /// This is used internally to validate the file after training is done. + /// The behavior name to override and file path are specified on the commandline, e.g. + /// player.exe --mlagents-override-model-directory /path/to/models + /// + /// Additionally, a number of episodes to run can be specified; after this, the application will quit. + /// Note this will only work with example scenes that have 1:1 Agent:Behaviors. More complicated scenes like WallJump + /// probably won't override correctly. + /// + public class ModelOverrider : MonoBehaviour + { + HashSet k_SupportedExtensions = new HashSet { "nn", "onnx" }; + const string k_CommandLineModelOverrideDirectoryFlag = "--mlagents-override-model-directory"; + const string k_CommandLineModelOverrideExtensionFlag = "--mlagents-override-model-extension"; + const string k_CommandLineQuitAfterEpisodesFlag = "--mlagents-quit-after-episodes"; + const string k_CommandLineQuitAfterSeconds = "--mlagents-quit-after-seconds"; + const string k_CommandLineQuitOnLoadFailure = "--mlagents-quit-on-load-failure"; + + // The attached Agent + Agent m_Agent; + + // Whether or not the commandline args have already been processed. + // Used to make sure that HasOverrides doesn't spam the logs if it's called multiple times. + private bool m_HaveProcessedCommandLine; + + string m_BehaviorNameOverrideDirectory; + + private string m_OriginalBehaviorName; + + private List m_OverrideExtensions = new List(); + + // Cached loaded ModelAssets, with the behavior name as the key. + Dictionary m_CachedModels = new Dictionary(); + + // Max episodes to run. Only used if > 0 + // Will default to 1 if override models are specified, otherwise 0. + int m_MaxEpisodes; + + // Deadline - exit if the time exceeds this + DateTime m_Deadline = DateTime.MaxValue; + + int m_NumSteps; + int m_PreviousNumSteps; + int m_PreviousAgentCompletedEpisodes; + + bool m_QuitOnLoadFailure; + [Tooltip("Debug values to be used in place of the command line for overriding models.")] + public string debugCommandLineOverride; + + // Static values to keep track of completed episodes and steps across resets + // These are updated in OnDisable. + static int s_PreviousAgentCompletedEpisodes; + static int s_PreviousNumSteps; + + int TotalCompletedEpisodes + { + get { return m_PreviousAgentCompletedEpisodes + (m_Agent == null ? 0 : m_Agent.CompletedEpisodes); } + } + + int TotalNumSteps + { + get { return m_PreviousNumSteps + m_NumSteps; } + } + + public bool HasOverrides + { + get + { + GetAssetPathFromCommandLine(); + return !string.IsNullOrEmpty(m_BehaviorNameOverrideDirectory); + } + } + + /// + /// The original behavior name of the agent. The actual behavior name will change when it is overridden. + /// + public string OriginalBehaviorName + { + get + { + if (string.IsNullOrEmpty(m_OriginalBehaviorName)) + { + var bp = m_Agent.GetComponent(); + m_OriginalBehaviorName = bp.BehaviorName; + } + + return m_OriginalBehaviorName; + } + } + + public static string GetOverrideBehaviorName(string originalBehaviorName) + { + return $"Override_{originalBehaviorName}"; + } + + /// + /// Get the asset path to use from the commandline arguments. + /// Can be called multiple times - if m_HaveProcessedCommandLine is set, will have no effect. + /// + void GetAssetPathFromCommandLine() + { + if (m_HaveProcessedCommandLine) + { + return; + } + + var maxEpisodes = 0; + var timeoutSeconds = 0; + + string[] commandLineArgsOverride = null; + if (!string.IsNullOrEmpty(debugCommandLineOverride) && Application.isEditor) + { + commandLineArgsOverride = debugCommandLineOverride.Split(' '); + } + + var args = commandLineArgsOverride ?? Environment.GetCommandLineArgs(); + for (var i = 0; i < args.Length; i++) + { + if (args[i] == k_CommandLineModelOverrideDirectoryFlag && i < args.Length - 1) + { + m_BehaviorNameOverrideDirectory = args[i + 1].Trim(); + } + else if (args[i] == k_CommandLineModelOverrideExtensionFlag && i < args.Length - 1) + { + var overrideExtension = args[i + 1].Trim().ToLower(); + var isKnownExtension = k_SupportedExtensions.Contains(overrideExtension); + if (!isKnownExtension) + { + Debug.LogError($"loading unsupported format: {overrideExtension}"); + Application.Quit(1); +#if UNITY_EDITOR + EditorApplication.isPlaying = false; +#endif + } + + m_OverrideExtensions.Add(overrideExtension); + } + else if (args[i] == k_CommandLineQuitAfterEpisodesFlag && i < args.Length - 1) + { + Int32.TryParse(args[i + 1], out maxEpisodes); + } + else if (args[i] == k_CommandLineQuitAfterSeconds && i < args.Length - 1) + { + Int32.TryParse(args[i + 1], out timeoutSeconds); + } + else if (args[i] == k_CommandLineQuitOnLoadFailure) + { + m_QuitOnLoadFailure = true; + } + } + + if (!string.IsNullOrEmpty(m_BehaviorNameOverrideDirectory)) + { + // If overriding models, set maxEpisodes to 1 or the command line value + m_MaxEpisodes = maxEpisodes > 0 ? maxEpisodes : 1; + Debug.Log($"setting m_MaxEpisodes to {maxEpisodes}"); + } + + if (timeoutSeconds > 0) + { + m_Deadline = DateTime.Now + TimeSpan.FromSeconds(timeoutSeconds); + Debug.Log($"setting deadline to {timeoutSeconds} from now."); + } + + m_HaveProcessedCommandLine = true; + } + + void OnEnable() + { + // Start with these initialized to previous values in the case where we're resetting scenes. + m_PreviousNumSteps = s_PreviousNumSteps; + m_PreviousAgentCompletedEpisodes = s_PreviousAgentCompletedEpisodes; + + m_Agent = GetComponent(); + + GetAssetPathFromCommandLine(); + if (HasOverrides) + { + OverrideModel(); + } + } + + void OnDisable() + { + // Update the static episode and step counts. + // For a single agent in the scene, this will be a straightforward increment. + // If there are multiple agents, we'll increment the count by the Agent that completed the most episodes. + s_PreviousAgentCompletedEpisodes = Mathf.Max(s_PreviousAgentCompletedEpisodes, TotalCompletedEpisodes); + s_PreviousNumSteps = Mathf.Max(s_PreviousNumSteps, TotalNumSteps); + } + + void FixedUpdate() + { + if (m_MaxEpisodes > 0) + { + // For Agents without maxSteps, exit as soon as we've hit the target number of episodes. + // For Agents that specify MaxStep, also make sure we've gone at least that many steps. + // Since we exit as soon as *any* Agent hits its target, the maxSteps condition keeps us running + // a bit longer in case there's an early failure. + if (TotalCompletedEpisodes >= m_MaxEpisodes && TotalNumSteps > m_MaxEpisodes * m_Agent.MaxStep) + { + Debug.Log($"ModelOverride reached {TotalCompletedEpisodes} episodes and {TotalNumSteps} steps. Exiting."); + Application.Quit(0); +#if UNITY_EDITOR + EditorApplication.isPlaying = false; +#endif + } + else if (DateTime.Now >= m_Deadline) + { + Debug.Log( + $"Deadline exceeded. " + + $"{TotalCompletedEpisodes}/{m_MaxEpisodes} episodes and " + + $"{TotalNumSteps}/{m_MaxEpisodes * m_Agent.MaxStep} steps completed. Exiting."); + Application.Quit(0); +#if UNITY_EDITOR + EditorApplication.isPlaying = false; +#endif + } + } + + m_NumSteps++; + } + + public ModelAsset GetModelForBehaviorName(string behaviorName) + { + if (m_CachedModels.ContainsKey(behaviorName)) + { + return m_CachedModels[behaviorName]; + } + + if (string.IsNullOrEmpty(m_BehaviorNameOverrideDirectory)) + { + Debug.Log($"No override directory set."); + return null; + } + + // Try the override extensions in order. If they weren't set, try .nn first, then .onnx. + var overrideExtensions = (m_OverrideExtensions.Count > 0) + ? m_OverrideExtensions.ToArray() + : new[] { "nn", "onnx" }; + + byte[] rawModel = null; + bool isOnnx = false; + string assetName = null; + foreach (var overrideExtension in overrideExtensions) + { + var assetPath = Path.Combine(m_BehaviorNameOverrideDirectory, $"{behaviorName}.{overrideExtension}"); + try + { + rawModel = File.ReadAllBytes(assetPath); + isOnnx = overrideExtension.Equals("onnx"); + assetName = "Override - " + Path.GetFileName(assetPath); + break; + } + catch (IOException) + { + // Do nothing - try the next extension, or we'll exit if nothing loaded. + } + } + + if (rawModel == null) + { + Debug.Log($"Couldn't load model file(s) for {behaviorName} in {m_BehaviorNameOverrideDirectory} (full path: {Path.GetFullPath(m_BehaviorNameOverrideDirectory)}"); + + // Cache the null so we don't repeatedly try to load a missing file + m_CachedModels[behaviorName] = null; + return null; + } + + // TODO enable this when we have a decision on supporting loading/converting an ONNX model directly into a ModelAsset + // ModelAsset asset; + // if (isOnnx) + // { + // var modelName = Path.Combine(m_BehaviorNameOverrideDirectory, $"{behaviorName}.onnx"); + // asset = LoadOnnxModel(modelName); + // } + // else + // { + // asset = LoadSentisModel(rawModel); + // } + // var asset = isOnnx ? LoadOnnxModel(rawModel) : LoadSentisModel(rawModel); + var asset = LoadSentisModel(rawModel); + asset.name = assetName; + m_CachedModels[behaviorName] = asset; + return asset; + } + + ModelAsset LoadSentisModel(byte[] rawModel) + { + var asset = ScriptableObject.CreateInstance(); + // asset.modelAssetData = ScriptableObject.CreateInstance(); + // asset.modelAssetData.value = rawModel; + return asset; + } + + // TODO enable this when we have a decision on supporting loading/converting an ONNX model directly into a ModelAsset + // ModelAsset LoadOnnxModel(string modelName) + // { + // Debug.Log($"Loading model for override: {modelName}"); + // var converter = new ONNXModelConverter(true); + // var directoryName = Path.GetDirectoryName(modelName); + // var model = converter.Convert(modelName, directoryName); + // var asset = ScriptableObject.CreateInstance(); + // var assetData = ScriptableObject.CreateInstance(); + // var descStream = new MemoryStream(); + // ModelWriter.SaveModelDesc(descStream, model); + // assetData.value = descStream.ToArray(); + // assetData.name = "Data"; + // assetData.hideFlags = HideFlags.HideInHierarchy; + // descStream.Close(); + // descStream.Dispose(); + // asset.modelAssetData = assetData; + // var weightStreams = new List(); + // ModelWriter.SaveModelWeights(weightStreams, model); + // + // asset.modelWeightsChunks = new ModelAssetWeightsData[weightStreams.Count]; + // for (int i = 0; i < weightStreams.Count; i++) + // { + // var stream = weightStreams[i]; + // asset.modelWeightsChunks[i] = ScriptableObject.CreateInstance(); + // asset.modelWeightsChunks[i].value = stream.ToArray(); + // asset.modelWeightsChunks[i].name = "Data"; + // asset.modelWeightsChunks[i].hideFlags = HideFlags.HideInHierarchy; + // stream.Close(); + // stream.Dispose(); + // } + // + // return asset; + // } + + // TODO this should probably be deprecated since Sentis does not support direct conversion from byte arrays + // ModelAsset LoadOnnxModel(byte[] rawModel) + // { + // var converter = new ONNXModelConverter(true); + // var onnxModel = converter.Convert(rawModel); + // + // ModelAssetData assetData = ScriptableObject.CreateInstance(); + // using (var memoryStream = new MemoryStream()) + // using (var writer = new BinaryWriter(memoryStream)) + // { + // ModelWriter.Save(writer, onnxModel); + // assetData.value = memoryStream.ToArray(); + // } + // assetData.name = "Data"; + // assetData.hideFlags = HideFlags.HideInHierarchy; + // + // var asset = ScriptableObject.CreateInstance(); + // asset.modelAssetData = assetData; + // return asset; + // } + + /// + /// Load the ModelAsset file from the specified path, and give it to the attached agent. + /// + void OverrideModel() + { + bool overrideOk = false; + string overrideError = null; + + m_Agent.LazyInitialize(); + + ModelAsset ModelAsset = null; + try + { + ModelAsset = GetModelForBehaviorName(OriginalBehaviorName); + } + catch (Exception e) + { + overrideError = $"Exception calling GetModelForBehaviorName: {e}"; + } + + if (ModelAsset == null) + { + if (string.IsNullOrEmpty(overrideError)) + { + overrideError = + $"Didn't find a model for behaviorName {OriginalBehaviorName}. Make " + + "sure the behaviorName is set correctly in the commandline " + + "and that the model file exists"; + } + } + else + { + var modelName = ModelAsset != null ? ModelAsset.name : ""; + Debug.Log($"Overriding behavior {OriginalBehaviorName} for agent with model {modelName}"); + try + { + m_Agent.SetModel(GetOverrideBehaviorName(OriginalBehaviorName), ModelAsset); + overrideOk = true; + } + catch (Exception e) + { + overrideError = $"Exception calling Agent.SetModel: {e}"; + } + } + + if (!overrideOk && m_QuitOnLoadFailure) + { + if (!string.IsNullOrEmpty(overrideError)) + { + Debug.LogWarning(overrideError); + } + + Application.Quit(1); +#if UNITY_EDITOR + EditorApplication.isPlaying = false; +#endif + } + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..91271a061762de327d609ee486f8f1e114d2c218 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs new file mode 100644 index 0000000000000000000000000000000000000000..73e7c34d23bf2046da654205ffd3f20a79c152cf --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs @@ -0,0 +1,563 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Unity.MLAgents +{ + /// + /// Monitor is used to display information about the Agent within the Unity + /// scene. Use the log function to add information to your monitor. + /// + public class Monitor : MonoBehaviour + { + /// + /// The type of monitor the information must be displayed in. + /// corresponds to a single rectangle whose width is given + /// by a float between -1 and 1. (green is positive, red is negative) + /// + /// corresponds to n vertical sliders. + /// is a text field. + /// is a rectangle of fixed length to represent the proportions + /// of a list of floats. + /// + public enum DisplayType + { + Independent, + Proportion + } + + /// + /// Represents how high above the target the monitors will be. + /// + public static float verticalOffset = 3f; + + static bool s_IsInstantiated; + static GameObject s_Canvas; + static Dictionary> s_DisplayTransformValues; + + /// + /// Camera used to calculate GUI screen position relative to the target + /// transform. + /// + static Dictionary s_TransformCamera; + + static Color[] s_BarColors; + + struct DisplayValue + { + public float time; + public string stringValue; + public float floatValue; + public float[] floatArrayValues; + + public enum ValueType + { + Float, + FloatarrayIndependent, + FloatarrayProportion, + String + } + + public ValueType valueType; + } + + static GUIStyle s_KeyStyle; + static GUIStyle s_ValueStyle; + static GUIStyle s_GreenStyle; + static GUIStyle s_RedStyle; + static GUIStyle[] s_ColorStyle; + static bool s_Initialized; + + /// + /// Use the Monitor.Log static function to attach information to a transform. + /// + /// The log. + /// The name of the information you wish to Log. + /// The string value you want to display. + /// The transform you want to attach the information to. + /// + /// Camera used to calculate GUI position relative to + /// the target. If null, `Camera.main` will be used. + public static void Log( + string key, + string value, + Transform target = null, + Camera camera = null) + { + if (!s_IsInstantiated) + { + InstantiateCanvas(); + s_IsInstantiated = true; + } + if (s_Canvas == null) + { + return; + } + + if (target == null) + { + target = s_Canvas.transform; + } + + s_TransformCamera[target] = camera; + + if (!s_DisplayTransformValues.Keys.Contains(target)) + { + s_DisplayTransformValues[target] = + new Dictionary(); + } + + var displayValues = + s_DisplayTransformValues[target]; + + if (value == null) + { + RemoveValue(target, key); + return; + } + + if (!displayValues.ContainsKey(key)) + { + var dv = new DisplayValue(); + dv.time = Time.timeSinceLevelLoad; + dv.stringValue = value; + dv.valueType = DisplayValue.ValueType.String; + displayValues[key] = dv; + while (displayValues.Count > 20) + { + var max = ( + displayValues + .Aggregate((l, r) => l.Value.time < r.Value.time ? l : r) + .Key + ); + RemoveValue(target, max); + } + } + else + { + var dv = displayValues[key]; + dv.stringValue = value; + dv.valueType = DisplayValue.ValueType.String; + displayValues[key] = dv; + } + } + + /// + /// Use the Monitor.Log static function to attach information to a transform. + /// + /// The log. + /// The name of the information you wish to Log. + /// The float value you want to display. + /// The transform you want to attach the information to. + /// + /// Camera used to calculate GUI position relative to + /// the target. If null, `Camera.main` will be used. + public static void Log( + string key, + float value, + Transform target = null, + Camera camera = null) + { + if (!s_IsInstantiated) + { + InstantiateCanvas(); + s_IsInstantiated = true; + } + + if (target == null) + { + target = s_Canvas.transform; + } + + s_TransformCamera[target] = camera; + + if (!s_DisplayTransformValues.Keys.Contains(target)) + { + s_DisplayTransformValues[target] = new Dictionary(); + } + + var displayValues = s_DisplayTransformValues[target]; + + if (!displayValues.ContainsKey(key)) + { + var dv = new DisplayValue(); + dv.time = Time.timeSinceLevelLoad; + dv.floatValue = value; + dv.valueType = DisplayValue.ValueType.Float; + displayValues[key] = dv; + while (displayValues.Count > 20) + { + var max = ( + displayValues.Aggregate((l, r) => l.Value.time < r.Value.time ? l : r).Key); + RemoveValue(target, max); + } + } + else + { + var dv = displayValues[key]; + dv.floatValue = value; + dv.valueType = DisplayValue.ValueType.Float; + displayValues[key] = dv; + } + } + + /// + /// Use the Monitor.Log static function to attach information to a transform. + /// + /// The log. + /// The name of the information you wish to Log. + /// The array of float you want to display. + /// The type of display. + /// The transform you want to attach the information to. + /// + /// Camera used to calculate GUI position relative to + /// the target. If null, `Camera.main` will be used. + public static void Log( + string key, + float[] value, + Transform target = null, + DisplayType displayType = DisplayType.Independent, + Camera camera = null + ) + { + if (!s_IsInstantiated) + { + InstantiateCanvas(); + s_IsInstantiated = true; + } + + if (target == null) + { + target = s_Canvas.transform; + } + + s_TransformCamera[target] = camera; + + if (!s_DisplayTransformValues.Keys.Contains(target)) + { + s_DisplayTransformValues[target] = new Dictionary(); + } + + var displayValues = s_DisplayTransformValues[target]; + + if (!displayValues.ContainsKey(key)) + { + var dv = new DisplayValue(); + dv.time = Time.timeSinceLevelLoad; + dv.floatArrayValues = value; + if (displayType == DisplayType.Independent) + { + dv.valueType = DisplayValue.ValueType.FloatarrayIndependent; + } + else + { + dv.valueType = DisplayValue.ValueType.FloatarrayProportion; + } + + displayValues[key] = dv; + while (displayValues.Count > 20) + { + var max = ( + displayValues.Aggregate((l, r) => l.Value.time < r.Value.time ? l : r).Key); + RemoveValue(target, max); + } + } + else + { + var dv = displayValues[key]; + dv.floatArrayValues = value; + if (displayType == DisplayType.Independent) + { + dv.valueType = DisplayValue.ValueType.FloatarrayIndependent; + } + else + { + dv.valueType = DisplayValue.ValueType.FloatarrayProportion; + } + + displayValues[key] = dv; + } + } + + /// + /// Remove a value from a monitor. + /// + /// + /// The transform to which the information is attached. + /// + /// The key of the information you want to remove. + public static void RemoveValue(Transform target, string key) + { + if (target == null) + { + target = s_Canvas.transform; + } + + if (s_DisplayTransformValues.Keys.Contains(target)) + { + if (s_DisplayTransformValues[target].ContainsKey(key)) + { + s_DisplayTransformValues[target].Remove(key); + if (s_DisplayTransformValues[target].Keys.Count == 0) + { + s_DisplayTransformValues.Remove(target); + } + } + } + } + + /// + /// Remove all information from a monitor. + /// + /// + /// The transform to which the information is attached. + /// + public static void RemoveAllValues(Transform target) + { + if (target == null) + { + target = s_Canvas.transform; + } + + if (s_DisplayTransformValues.Keys.Contains(target)) + { + s_DisplayTransformValues.Remove(target); + } + } + + /// + /// Use SetActive to enable or disable the Monitor via script + /// + /// Value to set the Monitor's status to. + public static void SetActive(bool active) + { + if (!s_IsInstantiated) + { + InstantiateCanvas(); + s_IsInstantiated = true; + } + + if (s_Canvas != null) + { + s_Canvas.SetActive(active); + } + } + + /// Initializes the canvas. + static void InstantiateCanvas() + { + s_Canvas = GameObject.Find("AgentMonitorCanvas"); + if (s_Canvas == null) + { + s_Canvas = new GameObject(); + s_Canvas.name = "AgentMonitorCanvas"; + s_Canvas.AddComponent(); + } + + s_DisplayTransformValues = new Dictionary>(); + + s_TransformCamera = new Dictionary(); + } + + void OnGUI() + { + if (!s_Initialized) + { + Initialize(); + s_Initialized = true; + } + + var toIterate = s_DisplayTransformValues.Keys.ToList(); + foreach (var target in toIterate) + { + if (target == null) + { + s_DisplayTransformValues.Remove(target); + continue; + } + + // get camera + var cam = s_TransformCamera[target]; + if (cam == null) + { + cam = Camera.main; + } + + var widthScaler = (Screen.width / 1000f); + var keyPixelWidth = 100 * widthScaler; + var keyPixelHeight = 20 * widthScaler; + var paddingWidth = 10 * widthScaler; + + var scale = 1f; + var origin = new Vector3( + Screen.width / 2.0f - keyPixelWidth, Screen.height); + if (!(target == s_Canvas.transform)) + { + var camTransform = cam.transform; + var position = target.position; + var cam2Obj = position - camTransform.position; + scale = Mathf.Min( + 1, + 20f / (Vector3.Dot(cam2Obj, camTransform.forward))); + var worldPosition = cam.WorldToScreenPoint( + position + new Vector3(0, verticalOffset, 0)); + origin = new Vector3( + worldPosition.x - keyPixelWidth * scale, Screen.height - worldPosition.y); + } + + keyPixelWidth *= scale; + keyPixelHeight *= scale; + paddingWidth *= scale; + s_KeyStyle.fontSize = (int)(keyPixelHeight * 0.8f); + if (s_KeyStyle.fontSize < 2) + { + continue; + } + + + var displayValues = s_DisplayTransformValues[target]; + + var index = 0; + var orderedKeys = displayValues.Keys.OrderBy(x => -displayValues[x].time); + foreach (var key in orderedKeys) + { + s_KeyStyle.alignment = TextAnchor.MiddleRight; + GUI.Label( + new Rect( + origin.x, origin.y - (index + 1) * keyPixelHeight, + keyPixelWidth, keyPixelHeight), + key, + s_KeyStyle); + float[] vals; + GUIStyle s; + switch (displayValues[key].valueType) + { + case DisplayValue.ValueType.String: + s_ValueStyle.alignment = TextAnchor.MiddleLeft; + GUI.Label( + new Rect( + origin.x + paddingWidth + keyPixelWidth, + origin.y - (index + 1) * keyPixelHeight, + keyPixelWidth, keyPixelHeight), + displayValues[key].stringValue, + s_ValueStyle); + break; + case DisplayValue.ValueType.Float: + var sliderValue = displayValues[key].floatValue; + sliderValue = Mathf.Min(1f, sliderValue); + s = s_GreenStyle; + if (sliderValue < 0) + { + sliderValue = Mathf.Min(1f, -sliderValue); + s = s_RedStyle; + } + + GUI.Box( + new Rect( + origin.x + paddingWidth + keyPixelWidth, + origin.y - (index + 0.9f) * keyPixelHeight, + keyPixelWidth * sliderValue, keyPixelHeight * 0.8f), + GUIContent.none, + s); + break; + + case DisplayValue.ValueType.FloatarrayIndependent: + const float histWidth = 0.15f; + vals = displayValues[key].floatArrayValues; + for (var i = 0; i < vals.Length; i++) + { + var value = Mathf.Min(vals[i], 1); + s = s_GreenStyle; + if (value < 0) + { + value = Mathf.Min(1f, -value); + s = s_RedStyle; + } + + GUI.Box( + new Rect( + origin.x + paddingWidth + keyPixelWidth + + (keyPixelWidth * histWidth + paddingWidth / 2) * i, + origin.y - (index + 0.1f) * keyPixelHeight, + keyPixelWidth * histWidth, -keyPixelHeight * value), + GUIContent.none, + s); + } + + break; + + case DisplayValue.ValueType.FloatarrayProportion: + var valsSum = 0f; + var valsCum = 0f; + vals = displayValues[key].floatArrayValues; + foreach (var f in vals) + { + valsSum += Mathf.Max(f, 0); + } + + if (valsSum < float.Epsilon) + { + Debug.LogError( + $"The Monitor value for key {key} " + + "must be a list or array of " + + "positive values and cannot " + + "be empty."); + } + else + { + for (var i = 0; i < vals.Length; i++) + { + var value = Mathf.Max(vals[i], 0) / valsSum; + GUI.Box( + new Rect( + origin.x + paddingWidth + + keyPixelWidth + keyPixelWidth * valsCum, + origin.y - (index + 0.9f) * keyPixelHeight, + keyPixelWidth * value, keyPixelHeight * 0.8f), + GUIContent.none, + s_ColorStyle[i % s_ColorStyle.Length]); + valsCum += value; + } + } + + break; + } + + index++; + } + } + } + + /// Helper method used to initialize the GUI. Called once. + void Initialize() + { + s_KeyStyle = GUI.skin.label; + s_ValueStyle = GUI.skin.label; + s_ValueStyle.clipping = TextClipping.Overflow; + s_ValueStyle.wordWrap = false; + s_BarColors = new[] + { + Color.magenta, + Color.blue, + Color.cyan, + Color.green, + Color.yellow, + Color.red + }; + s_ColorStyle = new GUIStyle[s_BarColors.Length]; + for (var i = 0; i < s_BarColors.Length; i++) + { + var texture = new Texture2D(1, 1, TextureFormat.ARGB32, false); + texture.SetPixel(0, 0, s_BarColors[i]); + texture.Apply(); + var staticRectStyle = new GUIStyle(); + staticRectStyle.normal.background = texture; + s_ColorStyle[i] = staticRectStyle; + } + + s_GreenStyle = s_ColorStyle[3]; + s_RedStyle = s_ColorStyle[5]; + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e10bd36d988600b2f33bcdf164e1d448a75f1fca Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/Monitor.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/OrientationCubeController.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/OrientationCubeController.cs new file mode 100644 index 0000000000000000000000000000000000000000..b257b3021590d05c2cd9200e9a93f6b67b5a7462 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/OrientationCubeController.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace Unity.MLAgentsExamples +{ + /// + /// Utility class to allow a stable observation platform. + /// + public class OrientationCubeController : MonoBehaviour + { + //Update position and Rotation + public void UpdateOrientation(Transform rootBP, Transform target) + { + var dirVector = target.position - transform.position; + dirVector.y = 0; //flatten dir on the y. this will only work on level, uneven surfaces + var lookRot = + dirVector == Vector3.zero + ? Quaternion.identity + : Quaternion.LookRotation(dirVector); //get our look rot to the target + + //UPDATE ORIENTATION CUBE POS & ROT + transform.SetPositionAndRotation(rootBP.position, lookRot); + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/OrientationCubeController.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/OrientationCubeController.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9fb2a07facb9b4241deba897f178cf6ce4422532 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/OrientationCubeController.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ProjectSettingsOverrides.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ProjectSettingsOverrides.cs new file mode 100644 index 0000000000000000000000000000000000000000..9b77251e6500d831728ae8a52ad3664927bd6844 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ProjectSettingsOverrides.cs @@ -0,0 +1,69 @@ +using UnityEngine; +using Unity.MLAgents; + +namespace Unity.MLAgentsExamples +{ + /// + /// A helper class for the ML-Agents example scenes to override various + /// global settings, and restore them afterwards. + /// This can modify some Physics and time-stepping properties, so you + /// shouldn't copy it into your project unless you know what you're doing. + /// + public class ProjectSettingsOverrides : MonoBehaviour + { + // Original values + Vector3 m_OriginalGravity; + float m_OriginalFixedDeltaTime; + float m_OriginalMaximumDeltaTime; + int m_OriginalSolverIterations; + int m_OriginalSolverVelocityIterations; + bool m_OriginalReuseCollisionCallbacks; + + [Tooltip("Increase or decrease the scene gravity. Use ~3x to make things less floaty")] + public float gravityMultiplier = 1.0f; + + [Header("Advanced physics settings")] + [Tooltip("The interval in seconds at which physics and other fixed frame rate updates (like MonoBehaviour's FixedUpdate) are performed.")] + public float fixedDeltaTime = .02f; + [Tooltip("The maximum time a frame can take. Physics and other fixed frame rate updates (like MonoBehaviour's FixedUpdate) will be performed only for this duration of time per frame.")] + public float maximumDeltaTime = 1.0f / 3.0f; + [Tooltip("Determines how accurately Rigidbody joints and collision contacts are resolved. (default 6). Must be positive.")] + public int solverIterations = 6; + [Tooltip("Affects how accurately the Rigidbody joints and collision contacts are resolved. (default 1). Must be positive.")] + public int solverVelocityIterations = 1; + [Tooltip("Determines whether the garbage collector should reuse only a single instance of a Collision type for all collision callbacks. Reduces Garbage.")] + public bool reuseCollisionCallbacks = true; + + public void Awake() + { + // Save the original values + m_OriginalGravity = Physics.gravity; + m_OriginalFixedDeltaTime = Time.fixedDeltaTime; + m_OriginalMaximumDeltaTime = Time.maximumDeltaTime; + m_OriginalSolverIterations = Physics.defaultSolverIterations; + m_OriginalSolverVelocityIterations = Physics.defaultSolverVelocityIterations; + m_OriginalReuseCollisionCallbacks = Physics.reuseCollisionCallbacks; + + // Override + Physics.gravity *= gravityMultiplier; + Time.fixedDeltaTime = fixedDeltaTime; + Time.maximumDeltaTime = maximumDeltaTime; + Physics.defaultSolverIterations = solverIterations; + Physics.defaultSolverVelocityIterations = solverVelocityIterations; + Physics.reuseCollisionCallbacks = reuseCollisionCallbacks; + + // Make sure the Academy singleton is initialized first, since it will create the SideChannels. + Academy.Instance.EnvironmentParameters.RegisterCallback("gravity", f => { Physics.gravity = new Vector3(0, -f, 0); }); + } + + public void OnDestroy() + { + Physics.gravity = m_OriginalGravity; + Time.fixedDeltaTime = m_OriginalFixedDeltaTime; + Time.maximumDeltaTime = m_OriginalMaximumDeltaTime; + Physics.defaultSolverIterations = m_OriginalSolverIterations; + Physics.defaultSolverVelocityIterations = m_OriginalSolverVelocityIterations; + Physics.reuseCollisionCallbacks = m_OriginalReuseCollisionCallbacks; + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ProjectSettingsOverrides.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ProjectSettingsOverrides.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9dbadc5b82f09ea3b77643e265d4b13a77acd3f1 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ProjectSettingsOverrides.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/SensorBase.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/SensorBase.cs new file mode 100644 index 0000000000000000000000000000000000000000..31bc7c8556328408cd9b48f6a963fc7c93d21f84 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/SensorBase.cs @@ -0,0 +1,59 @@ +using Unity.MLAgents.Sensors; + +namespace Unity.MLAgentsExamples +{ + /// + /// A simple sensor that provides a number default implementations. + /// + public abstract class SensorBase : ISensor + { + /// + /// Write the observations to the output buffer. This size of the buffer will be product + /// of the Shape array values returned by . + /// + /// + public abstract void WriteObservation(float[] output); + + /// + public abstract ObservationSpec GetObservationSpec(); + + /// + public abstract string GetName(); + + /// + /// Default implementation of Write interface. This creates a temporary array, + /// calls WriteObservation, and then writes the results to the ObservationWriter. + /// + /// + /// The number of elements written. + public virtual int Write(ObservationWriter writer) + { + // TODO reuse buffer for similar agents + var numFloats = this.ObservationSize(); + float[] buffer = new float[numFloats]; + WriteObservation(buffer); + + writer.AddList(buffer); + + return numFloats; + } + + /// + public void Update() { } + + /// + public void Reset() { } + + /// + public virtual byte[] GetCompressedObservation() + { + return null; + } + + /// + public virtual CompressionSpec GetCompressionSpec() + { + return CompressionSpec.Default(); + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/SensorBase.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/SensorBase.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..af6783dbf6e1a490f85b2e40ebeed9e412dc4847 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/SensorBase.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetContact.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetContact.cs new file mode 100644 index 0000000000000000000000000000000000000000..fa4580f40bb56031b0ec3c9281482e1f81f41487 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetContact.cs @@ -0,0 +1,38 @@ +using UnityEngine; + +namespace Unity.MLAgentsExamples +{ + /// + /// This class contains logic for locomotion agents with joints which might make contact with a target. + /// By attaching this as a component to those joints, their contact with the ground can be used as + /// an observation for that agent. + /// + [DisallowMultipleComponent] + public class TargetContact : MonoBehaviour + { + [Header("Detect Targets")] public bool touchingTarget; + const string k_Target = "target"; // Tag on target object. + + /// + /// Check for collision with a target. + /// + void OnCollisionEnter(Collision col) + { + if (col.transform.CompareTag(k_Target)) + { + touchingTarget = true; + } + } + + /// + /// Check for end of ground collision and reset flag appropriately. + /// + void OnCollisionExit(Collision other) + { + if (other.transform.CompareTag(k_Target)) + { + touchingTarget = false; + } + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetContact.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetContact.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..02b1fe71b177324145a64f5ae33f6a5f65de6c3b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetContact.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetController.cs b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetController.cs new file mode 100644 index 0000000000000000000000000000000000000000..e2b2c627788e94092f20c1463ad27f22695b59da --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetController.cs @@ -0,0 +1,133 @@ +using UnityEngine; +using Random = UnityEngine.Random; +using Unity.MLAgents; +using UnityEngine.Events; + +namespace Unity.MLAgentsExamples +{ + /// + /// Utility class to allow target placement and collision detection with an agent + /// Add this script to the target you want the agent to touch. + /// Callbacks will be triggered any time the target is touched with a collider tagged as 'tagToDetect' + /// + public class TargetController : MonoBehaviour + { + + [Header("Collider Tag To Detect")] + public string tagToDetect = "agent"; //collider tag to detect + + [Header("Target Placement")] + public float spawnRadius; //The radius in which a target can be randomly spawned. + public bool respawnIfTouched; //Should the target respawn to a different position when touched + + [Header("Target Fell Protection")] + public bool respawnIfFallsOffPlatform = true; //If the target falls off the platform, reset the position. + public float fallDistance = 5; //distance below the starting height that will trigger a respawn + + private Vector3 m_startingPos; //the starting position of the target + + [System.Serializable] + public class TriggerEvent : UnityEvent + { + } + + [Header("Trigger Callbacks")] + public TriggerEvent onTriggerEnterEvent = new TriggerEvent(); + public TriggerEvent onTriggerStayEvent = new TriggerEvent(); + public TriggerEvent onTriggerExitEvent = new TriggerEvent(); + + [System.Serializable] + public class CollisionEvent : UnityEvent + { + } + + [Header("Collision Callbacks")] + public CollisionEvent onCollisionEnterEvent = new CollisionEvent(); + public CollisionEvent onCollisionStayEvent = new CollisionEvent(); + public CollisionEvent onCollisionExitEvent = new CollisionEvent(); + + // Start is called before the first frame update + void OnEnable() + { + m_startingPos = transform.position; + if (respawnIfTouched) + { + MoveTargetToRandomPosition(); + } + } + + void Update() + { + if (respawnIfFallsOffPlatform) + { + if (transform.position.y < m_startingPos.y - fallDistance) + { + Debug.Log($"{transform.name} Fell Off Platform"); + MoveTargetToRandomPosition(); + } + } + } + + /// + /// Moves target to a random position within specified radius. + /// + public void MoveTargetToRandomPosition() + { + var newTargetPos = m_startingPos + (Random.insideUnitSphere * spawnRadius); + newTargetPos.y = m_startingPos.y; + transform.position = newTargetPos; + } + + private void OnCollisionEnter(Collision col) + { + if (col.transform.CompareTag(tagToDetect)) + { + onCollisionEnterEvent.Invoke(col); + if (respawnIfTouched) + { + MoveTargetToRandomPosition(); + } + } + } + + private void OnCollisionStay(Collision col) + { + if (col.transform.CompareTag(tagToDetect)) + { + onCollisionStayEvent.Invoke(col); + } + } + + private void OnCollisionExit(Collision col) + { + if (col.transform.CompareTag(tagToDetect)) + { + onCollisionExitEvent.Invoke(col); + } + } + + private void OnTriggerEnter(Collider col) + { + if (col.CompareTag(tagToDetect)) + { + onTriggerEnterEvent.Invoke(col); + } + } + + private void OnTriggerStay(Collider col) + { + if (col.CompareTag(tagToDetect)) + { + onTriggerStayEvent.Invoke(col); + } + } + + private void OnTriggerExit(Collider col) + { + if (col.CompareTag(tagToDetect)) + { + onTriggerExitEvent.Invoke(col); + } + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetController.cs.meta b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetController.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..439d4c10ea09f2711db1ac8bb23fcde7ac1f8050 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/TargetController.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer.meta b/Project/Assets/ML-Agents/Examples/Soccer.meta new file mode 100644 index 0000000000000000000000000000000000000000..999b71c8c6441861716b03f12ffa97db6b4abc1c Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials.meta new file mode 100644 index 0000000000000000000000000000000000000000..e5a0668ae9c87292e9928f09ad54a8f9cd2e1a50 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/ClearPlastic.mat b/Project/Assets/ML-Agents/Examples/Soccer/Materials/ClearPlastic.mat new file mode 100644 index 0000000000000000000000000000000000000000..fd0c7f8506ecaafe137c93d768d91211549c0379 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/ClearPlastic.mat @@ -0,0 +1,82 @@ +%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: ClearPlastic + m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _ALPHAPREMULTIPLY_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} + - _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: 10 + - _GlossMapScale: 1 + - _Glossiness: 0.492 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 3 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 0 + m_Colors: + - _Color: {r: 0.17194101, g: 0.40551123, b: 0.847, a: 0.039215688} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.103, g: 0.103, b: 0.103, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/ClearPlastic.mat.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/ClearPlastic.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..97f99965d23df9199dd63e005d7a2555f37f872f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/ClearPlastic.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials.meta new file mode 100644 index 0000000000000000000000000000000000000000..1f347ca125299bc50afdb21cd23e90b79ff16d12 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/Bouncy.physicMaterial b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/Bouncy.physicMaterial new file mode 100644 index 0000000000000000000000000000000000000000..9138d2e6ce3daf095ee8d17cb03ddd839e2d56b9 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/Bouncy.physicMaterial @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!134 &13400000 +PhysicMaterial: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Bouncy + dynamicFriction: 0.6 + staticFriction: 0.6 + bounciness: 0.8 + frictionCombine: 0 + bounceCombine: 3 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/Bouncy.physicMaterial.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/Bouncy.physicMaterial.meta new file mode 100644 index 0000000000000000000000000000000000000000..098262071242e8c02cb8cb7785c97c9fcd7d5548 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/Bouncy.physicMaterial.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/NoFriction.physicMaterial b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/NoFriction.physicMaterial new file mode 100644 index 0000000000000000000000000000000000000000..9ead4b369cb6e64dcd180dad294688a494d44acb --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/NoFriction.physicMaterial @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!134 &13400000 +PhysicMaterial: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: NoFriction + dynamicFriction: 0.6 + staticFriction: 0.6 + bounciness: 0.75 + frictionCombine: 0 + bounceCombine: 3 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/NoFriction.physicMaterial.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/NoFriction.physicMaterial.meta new file mode 100644 index 0000000000000000000000000000000000000000..b2bb9addc33014565a1764f532d6b50a7021b92b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/NoFriction.physicMaterial.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/reducedFriction.physicMaterial b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/reducedFriction.physicMaterial new file mode 100644 index 0000000000000000000000000000000000000000..79a615dcb1f3f79a177eb5444f7981bc2a50d2ae --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/reducedFriction.physicMaterial @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!134 &13400000 +PhysicMaterial: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: reducedFriction + dynamicFriction: 0.1 + staticFriction: 0.1 + bounciness: 0 + frictionCombine: 0 + bounceCombine: 3 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/reducedFriction.physicMaterial.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/reducedFriction.physicMaterial.meta new file mode 100644 index 0000000000000000000000000000000000000000..ab8d915a15bfe5612b94163d6f59768a3c222377 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/reducedFriction.physicMaterial.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/rollyCubeFriction.physicMaterial b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/rollyCubeFriction.physicMaterial new file mode 100644 index 0000000000000000000000000000000000000000..7a9d39edce80697cd3a38370428f056e05849e24 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/rollyCubeFriction.physicMaterial @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!134 &13400000 +PhysicMaterial: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: rollyCubeFriction + dynamicFriction: 1 + staticFriction: 1 + bounciness: 0 + frictionCombine: 3 + bounceCombine: 3 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/rollyCubeFriction.physicMaterial.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/rollyCubeFriction.physicMaterial.meta new file mode 100644 index 0000000000000000000000000000000000000000..dcc13750e5a0561c6507443067442389a782dad4 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/rollyCubeFriction.physicMaterial.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/zeroFriction.physicMaterial b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/zeroFriction.physicMaterial new file mode 100644 index 0000000000000000000000000000000000000000..d10e78c724ce35bad16dc0448adbafd831ef48b8 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/zeroFriction.physicMaterial @@ -0,0 +1,13 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!134 &13400000 +PhysicMaterial: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: zeroFriction + dynamicFriction: 0 + staticFriction: 0 + bounciness: 0 + frictionCombine: 0 + bounceCombine: 3 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/zeroFriction.physicMaterial.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/zeroFriction.physicMaterial.meta new file mode 100644 index 0000000000000000000000000000000000000000..126e2caf5d1ca6cd385703eda9e49d1a1c3e02a5 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Physic_Materials/zeroFriction.physicMaterial.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerBall.mat b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerBall.mat new file mode 100644 index 0000000000000000000000000000000000000000..8e14237644c524bfca5ab1c851a51ca797474c8d --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerBall.mat @@ -0,0 +1,76 @@ +%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: SoccerBall + m_Shader: {fileID: 46, 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: ea01cf4a25b735d478f6ee1dd3cdbcf1, 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 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0.181 + - _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} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerBall.mat.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerBall.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..f76c15085cd9c2c5e12c231913efd63b74110cd8 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerBall.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitch.mat b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitch.mat new file mode 100644 index 0000000000000000000000000000000000000000..7e3d5e516dd7ecbde18d2a150f97ee904fe3d205 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitch.mat @@ -0,0 +1,76 @@ +%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: SoccerPitch + m_Shader: {fileID: 46, 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: 90184a84e40c343c2b851750c4d795f1, 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 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _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} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitch.mat.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitch.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..faf4d619bdf16bf93ea55fbd25bd6b2c5c3bac14 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitch.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitchAL.png b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitchAL.png new file mode 100644 index 0000000000000000000000000000000000000000..a62f5c3f2f4d6790844b9e4fce358ada8eef3077 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitchAL.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c883eccff9019f9bfd0b70fdaf4b1cfca67e33e8cbff9aad17260000b75e769a +size 129156 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitchAL.png.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitchAL.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..843fe047a40054b53b3061e94c565ed0fa2439ca Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerPitchAL.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerSky.mat b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerSky.mat new file mode 100644 index 0000000000000000000000000000000000000000..496cb100357379ea68cf59368a02d83e9d3eb604 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerSky.mat @@ -0,0 +1,83 @@ +%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: SoccerSky + 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} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerSky.mat.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerSky.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..cbd8e31ab0d700c1bcb1c7ab51324f1135f3eb82 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/SoccerSky.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures.meta new file mode 100644 index 0000000000000000000000000000000000000000..2533f26f32721806b6bddd92f63a18aa2937fddd Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/BallAL.tif b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/BallAL.tif new file mode 100644 index 0000000000000000000000000000000000000000..206a0f678f4f8ba2d31b8b195a89a3b4dc623a5f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/BallAL.tif differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/BallAL.tif.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/BallAL.tif.meta new file mode 100644 index 0000000000000000000000000000000000000000..a5a4c2448ce36b2c0f1a0f9efc73a1f5911d35b0 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/BallAL.tif.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGray.png b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGray.png new file mode 100644 index 0000000000000000000000000000000000000000..e262823d06a54a49216a711fb76294558776dc4e --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGray.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f73002b3f089b5e6a9f76360b2e9c60a9ad01754faf0a86e1b684566c88284f5 +size 120663 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGray.png.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGray.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..bde0fe577023da9b260813b1e8d4bb45e58e6ffe Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGray.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGreen.png b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGreen.png new file mode 100644 index 0000000000000000000000000000000000000000..39bbfd8d0169e8f262933493037c347f6a61a912 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGreen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:219a4063b52e06856eaca26b4856cf45065eae0d42d9add43e857293095bf75e +size 135901 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGreen.png.meta b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGreen.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..271cfa2c7310cc7e4039089779d23d0dd5454740 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Materials/Textures/SoccerPitchGreen.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Meshes.meta b/Project/Assets/ML-Agents/Examples/Soccer/Meshes.meta new file mode 100644 index 0000000000000000000000000000000000000000..ccb83b424be148550b32065f66f8d94e1fab6dd9 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Meshes.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Ball.fbx b/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Ball.fbx new file mode 100644 index 0000000000000000000000000000000000000000..11403f2894d59002a821ce0272d233cc175fc0a6 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Ball.fbx differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Ball.fbx.meta b/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Ball.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..40633fa81a717fb0e8a9fef048a108c0b5d84cb9 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Ball.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Pitch.fbx b/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Pitch.fbx new file mode 100644 index 0000000000000000000000000000000000000000..8d6f5651455ee1d04ce37d50681cfa77c1a5d943 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Pitch.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e263595ca87834b72488f040f013d582f93df707dbae593fa3175b0109ad36b +size 394048 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Pitch.fbx.meta b/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Pitch.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..cee08871d5d3a16797e6fd51eddbedb5173bba62 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Meshes/Pitch.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ef55820400027cd712b8a57b56e8baa79f724593 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall.meta new file mode 100644 index 0000000000000000000000000000000000000000..86347a5abb228e62cf134b96109ed23e328ad5d3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials.meta new file mode 100644 index 0000000000000000000000000000000000000000..ee8fe5a82f2791ddb1cec1f20293b78e1780091c Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/Black-Ball-Material.mat b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/Black-Ball-Material.mat new file mode 100644 index 0000000000000000000000000000000000000000..293e036eb44437c00a773f844c2dbfe309e1d9e7 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/Black-Ball-Material.mat @@ -0,0 +1,76 @@ +%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: Black-Ball-Material + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _NORMALMAP _SPECULARHIGHLIGHTS_OFF + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 2800000, guid: a0d8751da35d5344ea4738f6a8227a0d, type: 3} + 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: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/Black-Ball-Material.mat.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/Black-Ball-Material.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..b189eac6ff6a56087a6d4d55f5c7e199739b27cc Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/Black-Ball-Material.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/White-Ball-Material.mat b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/White-Ball-Material.mat new file mode 100644 index 0000000000000000000000000000000000000000..d8260313f874ac48c73f58628600eadaea1d0da9 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/White-Ball-Material.mat @@ -0,0 +1,76 @@ +%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: White-Ball-Material + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _NORMALMAP _SPECULARHIGHLIGHTS_OFF + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 2800000, guid: a0d8751da35d5344ea4738f6a8227a0d, type: 3} + 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: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _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} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/White-Ball-Material.mat.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/White-Ball-Material.mat.meta new file mode 100644 index 0000000000000000000000000000000000000000..bafc15f2a4eed90c767313b84c42c10044b6f9d4 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Materials/White-Ball-Material.mat.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes.meta new file mode 100644 index 0000000000000000000000000000000000000000..76e858e9e72047033eadc1cf881efacd8986db1b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes/SoccerBallMesh.fbx b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes/SoccerBallMesh.fbx new file mode 100644 index 0000000000000000000000000000000000000000..06cb090808c335a490018dce4320e41dd5f82d0d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes/SoccerBallMesh.fbx differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes/SoccerBallMesh.fbx.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes/SoccerBallMesh.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..3b51ce88c9732a3daa8d10330d61a00bad278f72 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Meshes/SoccerBallMesh.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs.meta new file mode 100644 index 0000000000000000000000000000000000000000..0b5852d6ed163b9dcb45763be7707a38eb19e6b5 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs/SoccerBall.prefab b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs/SoccerBall.prefab new file mode 100644 index 0000000000000000000000000000000000000000..c696e4169a0220a93d5f028b679ca653605319c3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs/SoccerBall.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs/SoccerBall.prefab.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs/SoccerBall.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..6992030b9ea91ce18448e6e0d69db5bca58d322f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Prefabs/SoccerBall.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures.meta new file mode 100644 index 0000000000000000000000000000000000000000..c4e5cfe141121c667a7455796eaa08cf740ea889 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures/SoccerBallNormalMap.png b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures/SoccerBallNormalMap.png new file mode 100644 index 0000000000000000000000000000000000000000..f9bee8535e965dedcdd7e4442d2a702742f4f74b --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures/SoccerBallNormalMap.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca236487594af91407e5bee38510cab7869ee7b394e59c05f5c915dc436673ff +size 532887 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures/SoccerBallNormalMap.png.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures/SoccerBallNormalMap.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..637cef6ba82b1c338fcbb273b3f13dcfbbfc936f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerBall/Textures/SoccerBallNormalMap.png.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab new file mode 100644 index 0000000000000000000000000000000000000000..aad5182d9c4fc673770058dc67cddde2a088991c Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..43a1f950775632e2be560c7f37ca5be234fbbbc3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/StrikersVsGoalieField.prefab b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/StrikersVsGoalieField.prefab new file mode 100644 index 0000000000000000000000000000000000000000..5c33815b038e09346415ccb2c1c6f1405b6f4519 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/StrikersVsGoalieField.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/StrikersVsGoalieField.prefab.meta b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/StrikersVsGoalieField.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..a0fa9ef262b93a8f95ef0a5220451a1d5610f427 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Prefabs/StrikersVsGoalieField.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scenes.meta b/Project/Assets/ML-Agents/Examples/Soccer/Scenes.meta new file mode 100644 index 0000000000000000000000000000000000000000..0ecc572085794f6e351ab9136b6f5b91a7ae1b2c Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scenes.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity b/Project/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity new file mode 100644 index 0000000000000000000000000000000000000000..c2ece4f395127673214715f8a115fdd722d016ab Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity.meta b/Project/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..02e34269d26a27cc71bc0a749dce16ef6dc0d7f2 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scenes/SoccerTwos.unity.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scenes/StrikersVsGoalie.unity b/Project/Assets/ML-Agents/Examples/Soccer/Scenes/StrikersVsGoalie.unity new file mode 100644 index 0000000000000000000000000000000000000000..82ca1e6b7afcc254f35854d15f6aeaee6a118cd6 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scenes/StrikersVsGoalie.unity differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scenes/StrikersVsGoalie.unity.meta b/Project/Assets/ML-Agents/Examples/Soccer/Scenes/StrikersVsGoalie.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..f725eb59d64e3f050ff78eed03e834f15bf2ab15 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scenes/StrikersVsGoalie.unity.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts.meta b/Project/Assets/ML-Agents/Examples/Soccer/Scripts.meta new file mode 100644 index 0000000000000000000000000000000000000000..b271204251877219858d7fd116c95d05baacfec3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scripts.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs new file mode 100644 index 0000000000000000000000000000000000000000..896f0be7c552a80d8864dac0b95e75245cfc3994 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs @@ -0,0 +1,217 @@ +using UnityEngine; +using Unity.MLAgents; +using Unity.MLAgents.Actuators; +using Unity.MLAgents.Policies; + +public enum Team +{ + Blue = 0, + Purple = 1 +} + +public class AgentSoccer : Agent +{ + // Note that that the detectable tags are different for the blue and purple teams. The order is + // * ball + // * own goal + // * opposing goal + // * wall + // * own teammate + // * opposing player + + public enum Position + { + Striker, + Goalie, + Generic + } + + [HideInInspector] + public Team team; + float m_KickPower; + // The coefficient for the reward for colliding with a ball. Set using curriculum. + float m_BallTouch; + public Position position; + + const float k_Power = 2000f; + float m_Existential; + float m_LateralSpeed; + float m_ForwardSpeed; + + + [HideInInspector] + public Rigidbody agentRb; + SoccerSettings m_SoccerSettings; + BehaviorParameters m_BehaviorParameters; + public Vector3 initialPos; + public float rotSign; + + EnvironmentParameters m_ResetParams; + + public override void Initialize() + { + SoccerEnvController envController = GetComponentInParent(); + if (envController != null) + { + m_Existential = 1f / envController.MaxEnvironmentSteps; + } + else + { + m_Existential = 1f / MaxStep; + } + + m_BehaviorParameters = gameObject.GetComponent(); + if (m_BehaviorParameters.TeamId == (int)Team.Blue) + { + team = Team.Blue; + initialPos = new Vector3(transform.position.x - 5f, .5f, transform.position.z); + rotSign = 1f; + } + else + { + team = Team.Purple; + initialPos = new Vector3(transform.position.x + 5f, .5f, transform.position.z); + rotSign = -1f; + } + if (position == Position.Goalie) + { + m_LateralSpeed = 1.0f; + m_ForwardSpeed = 1.0f; + } + else if (position == Position.Striker) + { + m_LateralSpeed = 0.3f; + m_ForwardSpeed = 1.3f; + } + else + { + m_LateralSpeed = 0.3f; + m_ForwardSpeed = 1.0f; + } + m_SoccerSettings = FindAnyObjectByType(); + agentRb = GetComponent(); + agentRb.maxAngularVelocity = 500; + + m_ResetParams = Academy.Instance.EnvironmentParameters; + } + + public void MoveAgent(ActionSegment act) + { + var dirToGo = Vector3.zero; + var rotateDir = Vector3.zero; + + m_KickPower = 0f; + + var forwardAxis = act[0]; + var rightAxis = act[1]; + var rotateAxis = act[2]; + + switch (forwardAxis) + { + case 1: + dirToGo = transform.forward * m_ForwardSpeed; + m_KickPower = 1f; + break; + case 2: + dirToGo = transform.forward * -m_ForwardSpeed; + break; + } + + switch (rightAxis) + { + case 1: + dirToGo = transform.right * m_LateralSpeed; + break; + case 2: + dirToGo = transform.right * -m_LateralSpeed; + break; + } + + switch (rotateAxis) + { + case 1: + rotateDir = transform.up * -1f; + break; + case 2: + rotateDir = transform.up * 1f; + break; + } + + transform.Rotate(rotateDir, Time.deltaTime * 100f); + agentRb.AddForce(dirToGo * m_SoccerSettings.agentRunSpeed, + ForceMode.VelocityChange); + } + + public override void OnActionReceived(ActionBuffers actionBuffers) + + { + + if (position == Position.Goalie) + { + // Existential bonus for Goalies. + AddReward(m_Existential); + } + else if (position == Position.Striker) + { + // Existential penalty for Strikers + AddReward(-m_Existential); + } + MoveAgent(actionBuffers.DiscreteActions); + } + + public override void Heuristic(in ActionBuffers actionsOut) + { + var discreteActionsOut = actionsOut.DiscreteActions; + //forward + if (Input.GetKey(KeyCode.W)) + { + discreteActionsOut[0] = 1; + } + if (Input.GetKey(KeyCode.S)) + { + discreteActionsOut[0] = 2; + } + //rotate + if (Input.GetKey(KeyCode.A)) + { + discreteActionsOut[2] = 1; + } + if (Input.GetKey(KeyCode.D)) + { + discreteActionsOut[2] = 2; + } + //right + if (Input.GetKey(KeyCode.E)) + { + discreteActionsOut[1] = 1; + } + if (Input.GetKey(KeyCode.Q)) + { + discreteActionsOut[1] = 2; + } + } + /// + /// Used to provide a "kick" to the ball. + /// + void OnCollisionEnter(Collision c) + { + var force = k_Power * m_KickPower; + if (position == Position.Goalie) + { + force = k_Power; + } + if (c.gameObject.CompareTag("ball")) + { + AddReward(.2f * m_BallTouch); + var dir = c.contacts[0].point - transform.position; + dir = dir.normalized; + c.gameObject.GetComponent().AddForce(dir * force); + } + } + + public override void OnEpisodeBegin() + { + m_BallTouch = m_ResetParams.GetWithDefault("ball_touch", 0); + } + +} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs.meta b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..d61849e8cf238c48fa682b0ba00f146fc4aaa418 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerBallController.cs b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerBallController.cs new file mode 100644 index 0000000000000000000000000000000000000000..a1847ba27f55291d29101c2dd3f8929d7e244c58 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerBallController.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +public class SoccerBallController : MonoBehaviour +{ + public GameObject area; + [HideInInspector] + public SoccerEnvController envController; + public string purpleGoalTag; //will be used to check if collided with purple goal + public string blueGoalTag; //will be used to check if collided with blue goal + + void Start() + { + envController = area.GetComponent(); + } + + void OnCollisionEnter(Collision col) + { + if (col.gameObject.CompareTag(purpleGoalTag)) //ball touched purple goal + { + envController.GoalTouched(Team.Blue); + } + if (col.gameObject.CompareTag(blueGoalTag)) //ball touched blue goal + { + envController.GoalTouched(Team.Purple); + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerBallController.cs.meta b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerBallController.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..69d56951f693b720ec2a539cf4512fb83db2601f Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerBallController.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerEnvController.cs b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerEnvController.cs new file mode 100644 index 0000000000000000000000000000000000000000..67334a828870e59d95dde0276165cf19b3d41be6 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerEnvController.cs @@ -0,0 +1,137 @@ +using System.Collections.Generic; +using Unity.MLAgents; +using UnityEngine; + +public class SoccerEnvController : MonoBehaviour +{ + [System.Serializable] + public class PlayerInfo + { + public AgentSoccer Agent; + [HideInInspector] + public Vector3 StartingPos; + [HideInInspector] + public Quaternion StartingRot; + [HideInInspector] + public Rigidbody Rb; + } + + + /// + /// Max Academy steps before this platform resets + /// + [Tooltip("Max Environment Steps")] public int MaxEnvironmentSteps = 25000; + + /// + /// The area bounds. + /// + + /// + /// We will be changing the ground material based on success/failue + /// + + public GameObject ball; + [HideInInspector] + public Rigidbody ballRb; + Vector3 m_BallStartingPos; + + //List of Agents On Platform + public List AgentsList = new List(); + + private SoccerSettings m_SoccerSettings; + + + private SimpleMultiAgentGroup m_BlueAgentGroup; + private SimpleMultiAgentGroup m_PurpleAgentGroup; + + private int m_ResetTimer; + + void Start() + { + + m_SoccerSettings = FindAnyObjectByType(); + // Initialize TeamManager + m_BlueAgentGroup = new SimpleMultiAgentGroup(); + m_PurpleAgentGroup = new SimpleMultiAgentGroup(); + ballRb = ball.GetComponent(); + m_BallStartingPos = new Vector3(ball.transform.position.x, ball.transform.position.y, ball.transform.position.z); + foreach (var item in AgentsList) + { + item.StartingPos = item.Agent.transform.position; + item.StartingRot = item.Agent.transform.rotation; + item.Rb = item.Agent.GetComponent(); + if (item.Agent.team == Team.Blue) + { + m_BlueAgentGroup.RegisterAgent(item.Agent); + } + else + { + m_PurpleAgentGroup.RegisterAgent(item.Agent); + } + } + ResetScene(); + } + + void FixedUpdate() + { + m_ResetTimer += 1; + if (m_ResetTimer >= MaxEnvironmentSteps && MaxEnvironmentSteps > 0) + { + m_BlueAgentGroup.GroupEpisodeInterrupted(); + m_PurpleAgentGroup.GroupEpisodeInterrupted(); + ResetScene(); + } + } + + + public void ResetBall() + { + var randomPosX = Random.Range(-2.5f, 2.5f); + var randomPosZ = Random.Range(-2.5f, 2.5f); + + ball.transform.position = m_BallStartingPos + new Vector3(randomPosX, 0f, randomPosZ); + ballRb.linearVelocity = Vector3.zero; + ballRb.angularVelocity = Vector3.zero; + + } + + public void GoalTouched(Team scoredTeam) + { + if (scoredTeam == Team.Blue) + { + m_BlueAgentGroup.AddGroupReward(1 - (float)m_ResetTimer / MaxEnvironmentSteps); + m_PurpleAgentGroup.AddGroupReward(-1); + } + else + { + m_PurpleAgentGroup.AddGroupReward(1 - (float)m_ResetTimer / MaxEnvironmentSteps); + m_BlueAgentGroup.AddGroupReward(-1); + } + m_PurpleAgentGroup.EndGroupEpisode(); + m_BlueAgentGroup.EndGroupEpisode(); + ResetScene(); + + } + + + public void ResetScene() + { + m_ResetTimer = 0; + + //Reset Agents + foreach (var item in AgentsList) + { + var randomPosX = Random.Range(-5f, 5f); + var newStartPos = item.Agent.initialPos + new Vector3(randomPosX, 0f, 0f); + var rot = item.Agent.rotSign * Random.Range(80.0f, 100.0f); + var newRot = Quaternion.Euler(0, rot, 0); + item.Agent.transform.SetPositionAndRotation(newStartPos, newRot); + + item.Rb.linearVelocity = Vector3.zero; + item.Rb.angularVelocity = Vector3.zero; + } + + //Reset Ball + ResetBall(); + } +} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerEnvController.cs.meta b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerEnvController.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4325c0405150eec55c4a95ca6e72e2a2550607b6 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerEnvController.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerSettings.cs b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerSettings.cs new file mode 100644 index 0000000000000000000000000000000000000000..ab4ee0358d6f88511c71d73d7ddff820917502d8 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerSettings.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +public class SoccerSettings : MonoBehaviour +{ + public Material purpleMaterial; + public Material blueMaterial; + public bool randomizePlayersTeamForTraining = true; + public float agentRunSpeed; +} diff --git a/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerSettings.cs.meta b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerSettings.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..dc7d75acc0900d587522514201f583c6921f258d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/Scripts/SoccerSettings.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/TFModels.meta b/Project/Assets/ML-Agents/Examples/Soccer/TFModels.meta new file mode 100644 index 0000000000000000000000000000000000000000..ba46200362df0d914d37b7d34d94f59bb084ef1b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/TFModels.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Goalie.onnx b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Goalie.onnx new file mode 100644 index 0000000000000000000000000000000000000000..3febec74d72c710e633dddc5ae977ed1ea8fe4eb --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Goalie.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8118d2f796112138e32ce54371be030b03bad0dab857ff320f7614ff54768a06 +size 2587893 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Goalie.onnx.meta b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Goalie.onnx.meta new file mode 100644 index 0000000000000000000000000000000000000000..03520c7f2d92608a21be0c5dbf4ad293f033f6af Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Goalie.onnx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/TFModels/SoccerTwos.onnx b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/SoccerTwos.onnx new file mode 100644 index 0000000000000000000000000000000000000000..6c259bf005e5e780068acd75423437848ac99050 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/SoccerTwos.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6615bec3a49dced78c46c67bc3ce09874780538b9f52ce6a73bd8bd069cd47a8 +size 1763443 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/TFModels/SoccerTwos.onnx.meta b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/SoccerTwos.onnx.meta new file mode 100644 index 0000000000000000000000000000000000000000..90f42cef0feb2d822bab5582e6b86e68a96f6e93 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/SoccerTwos.onnx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Striker.onnx b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Striker.onnx new file mode 100644 index 0000000000000000000000000000000000000000..8d3e43fdba9e3b388f811e1311ac3319bbc0ec14 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Striker.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1af60b5e477879b2117e8796e4faf854a3365b846c415408218aa70320e43186 +size 1678617 diff --git a/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Striker.onnx.meta b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Striker.onnx.meta new file mode 100644 index 0000000000000000000000000000000000000000..a65d7473848fcc48481c7886944801bb2c18cfd3 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Soccer/TFModels/Striker.onnx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Meshes.meta b/Project/Assets/ML-Agents/Examples/Sorter/Meshes.meta new file mode 100644 index 0000000000000000000000000000000000000000..57c61037d26b60c2dc5e52540c5b7ecf0f30d399 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Meshes.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Meshes/ArenaWalls.fbx b/Project/Assets/ML-Agents/Examples/Sorter/Meshes/ArenaWalls.fbx new file mode 100644 index 0000000000000000000000000000000000000000..a85b5a6806ecda0c476c86f60ce0b2094a53c74d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Meshes/ArenaWalls.fbx differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Meshes/ArenaWalls.fbx.meta b/Project/Assets/ML-Agents/Examples/Sorter/Meshes/ArenaWalls.fbx.meta new file mode 100644 index 0000000000000000000000000000000000000000..97c1b3169ef5fae63e251992bb43251fa07cb827 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Meshes/ArenaWalls.fbx.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Prefabs.meta b/Project/Assets/ML-Agents/Examples/Sorter/Prefabs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e894be1cc1a41c5f37697d921269a83a239f8106 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Prefabs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Prefabs/Area.prefab b/Project/Assets/ML-Agents/Examples/Sorter/Prefabs/Area.prefab new file mode 100644 index 0000000000000000000000000000000000000000..bcd748fad4128bc516995f6b5a3944f1dd24b70a Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Prefabs/Area.prefab differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Prefabs/Area.prefab.meta b/Project/Assets/ML-Agents/Examples/Sorter/Prefabs/Area.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..d9a5cf11e04d244cfb047c4789cca8f4e03eb738 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Prefabs/Area.prefab.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Scenes.meta b/Project/Assets/ML-Agents/Examples/Sorter/Scenes.meta new file mode 100644 index 0000000000000000000000000000000000000000..a887c02a9d8da2c9cdf5a73301827b6e53676d5a Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Scenes.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Scenes/Sorter.unity b/Project/Assets/ML-Agents/Examples/Sorter/Scenes/Sorter.unity new file mode 100644 index 0000000000000000000000000000000000000000..a4610e4a7fcd292ded6ff66f6df75201534bce8a Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Scenes/Sorter.unity differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Scenes/Sorter.unity.meta b/Project/Assets/ML-Agents/Examples/Sorter/Scenes/Sorter.unity.meta new file mode 100644 index 0000000000000000000000000000000000000000..27a84ffe806742b4712f3cf29419f53289f23e9d Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Scenes/Sorter.unity.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Scripts.meta b/Project/Assets/ML-Agents/Examples/Sorter/Scripts.meta new file mode 100644 index 0000000000000000000000000000000000000000..97d759dc65b5c5fb2bdacc6b3a6cfa5438c09c37 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Scripts.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Scripts/NumberTile.cs b/Project/Assets/ML-Agents/Examples/Sorter/Scripts/NumberTile.cs new file mode 100644 index 0000000000000000000000000000000000000000..f1f80a8f4a588ac00d9a964fc216533dab34499e --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Sorter/Scripts/NumberTile.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +public class NumberTile : MonoBehaviour +{ + public int NumberValue; + public Material DefaultMaterial; + public Material SuccessMaterial; + + private bool m_Visited; + private MeshRenderer m_Renderer; + + public bool IsVisited + { + get { return m_Visited; } + } + + public void VisitTile() + { + m_Renderer.sharedMaterial = SuccessMaterial; + m_Visited = true; + } + + public void ResetTile() + { + if (m_Renderer is null) + { + m_Renderer = GetComponentInChildren(); + } + m_Renderer.sharedMaterial = DefaultMaterial; + m_Visited = false; + } +} diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Scripts/NumberTile.cs.meta b/Project/Assets/ML-Agents/Examples/Sorter/Scripts/NumberTile.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..99fe6f91620a96dfa7fea9b8423f31b741e77134 Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Scripts/NumberTile.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Scripts/SorterAgent.cs b/Project/Assets/ML-Agents/Examples/Sorter/Scripts/SorterAgent.cs new file mode 100644 index 0000000000000000000000000000000000000000..cc22e217a4bbce83e584ca42955d14912433d89d --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Sorter/Scripts/SorterAgent.cs @@ -0,0 +1,269 @@ +using System.Collections.Generic; +using UnityEngine; +using Unity.MLAgents; +using Unity.MLAgents.Actuators; +using Unity.MLAgents.Sensors; +using Random = UnityEngine.Random; + + +public class SorterAgent : Agent +{ + [Range(1, 20)] + public int DefaultMaxNumTiles; + private const int k_HighestTileValue = 20; + + int m_NumberOfTilesToSpawn; + int m_MaxNumberOfTiles; + Rigidbody m_AgentRb; + + // The BufferSensorComponent is the Sensor that allows the Agent to observe + // a variable number of items (here, numbered tiles) + BufferSensorComponent m_BufferSensor; + + public List NumberTilesList = new List(); + + private List CurrentlyVisibleTilesList = new List(); + private List AlreadyTouchedList = new List(); + + private List m_UsedPositionsList = new List(); + private Vector3 m_StartingPos; + + GameObject m_Area; + EnvironmentParameters m_ResetParams; + + private int m_NextExpectedTileIndex; + + + public override void Initialize() + { + m_Area = transform.parent.gameObject; + m_MaxNumberOfTiles = k_HighestTileValue; + m_ResetParams = Academy.Instance.EnvironmentParameters; + m_BufferSensor = GetComponent(); + m_AgentRb = GetComponent(); + m_StartingPos = transform.position; + } + + public override void OnEpisodeBegin() + { + m_MaxNumberOfTiles = (int)m_ResetParams.GetWithDefault("num_tiles", DefaultMaxNumTiles); + + m_NumberOfTilesToSpawn = Random.Range(1, m_MaxNumberOfTiles + 1); + SelectTilesToShow(); + SetTilePositions(); + + transform.position = m_StartingPos; + m_AgentRb.linearVelocity = Vector3.zero; + m_AgentRb.angularVelocity = Vector3.zero; + } + + + public override void CollectObservations(VectorSensor sensor) + { + sensor.AddObservation((transform.position.x - m_Area.transform.position.x) / 20f); + sensor.AddObservation((transform.position.z - m_Area.transform.position.z) / 20f); + + sensor.AddObservation(transform.forward.x); + sensor.AddObservation(transform.forward.z); + + foreach (var item in CurrentlyVisibleTilesList) + { + // Each observation / tile in the BufferSensor will have 22 values + // The first 20 are one hot encoding of the value of the tile + // The 21st and 22nd are the position of the tile relative to the agent + // The 23rd is a boolean : 1 if the tile was visited already and 0 otherwise + float[] listObservation = new float[k_HighestTileValue + 3]; + listObservation[item.NumberValue] = 1.0f; + var tileTransform = item.transform.GetChild(1); + listObservation[k_HighestTileValue] = (tileTransform.position.x - transform.position.x) / 20f; + listObservation[k_HighestTileValue + 1] = (tileTransform.position.z - transform.position.z) / 20f; + listObservation[k_HighestTileValue + 2] = item.IsVisited ? 1.0f : 0.0f; + // Here, the observation for the tile is added to the BufferSensor + m_BufferSensor.AppendObservation(listObservation); + + } + + } + + private void OnCollisionEnter(Collision col) + { + if (!col.gameObject.CompareTag("tile")) + { + return; + } + if (AlreadyTouchedList.Contains(col.transform)) + { + return; + } + if (col.transform.parent != CurrentlyVisibleTilesList[m_NextExpectedTileIndex].transform) + { + // The Agent Failed + AddReward(-1); + EndEpisode(); + } + else + { + // The Agent Succeeded + AddReward(1); + var tile = col.gameObject.GetComponentInParent(); + tile.VisitTile(); + m_NextExpectedTileIndex++; + + AlreadyTouchedList.Add(col.transform); + + //We got all of them. Can reset now. + if (m_NextExpectedTileIndex == m_NumberOfTilesToSpawn) + { + EndEpisode(); + } + } + } + + void SetTilePositions() + { + + m_UsedPositionsList.Clear(); + + //Disable all. We will enable the ones selected + foreach (var item in NumberTilesList) + { + item.ResetTile(); + item.gameObject.SetActive(false); + } + + + foreach (var item in CurrentlyVisibleTilesList) + { + //Select a rnd spawnAngle + bool posChosen = false; + int rndPosIndx = 0; + while (!posChosen) + { + rndPosIndx = Random.Range(0, k_HighestTileValue); + if (!m_UsedPositionsList.Contains(rndPosIndx)) + { + m_UsedPositionsList.Add(rndPosIndx); + posChosen = true; + } + } + item.transform.localRotation = Quaternion.Euler(0, rndPosIndx * (360f / k_HighestTileValue), 0); + item.gameObject.SetActive(true); + } + } + + void SelectTilesToShow() + { + + CurrentlyVisibleTilesList.Clear(); + AlreadyTouchedList.Clear(); + + int numLeft = m_NumberOfTilesToSpawn; + while (numLeft > 0) + { + int rndInt = Random.Range(0, k_HighestTileValue); + var tmp = NumberTilesList[rndInt]; + if (!CurrentlyVisibleTilesList.Contains(tmp)) + { + CurrentlyVisibleTilesList.Add(tmp); + numLeft--; + } + } + + //Sort Ascending + CurrentlyVisibleTilesList.Sort((x, y) => x.NumberValue.CompareTo(y.NumberValue)); + m_NextExpectedTileIndex = 0; + } + + + /// + /// Moves the agent according to the selected action. + /// + public void MoveAgent(ActionSegment act) + { + var dirToGo = Vector3.zero; + var rotateDir = Vector3.zero; + + var forwardAxis = act[0]; + var rightAxis = act[1]; + var rotateAxis = act[2]; + + switch (forwardAxis) + { + case 1: + dirToGo = transform.forward * 1f; + break; + case 2: + dirToGo = transform.forward * -1f; + break; + } + + switch (rightAxis) + { + case 1: + dirToGo = transform.right * 1f; + break; + case 2: + dirToGo = transform.right * -1f; + break; + } + + switch (rotateAxis) + { + case 1: + rotateDir = transform.up * -1f; + break; + case 2: + rotateDir = transform.up * 1f; + break; + } + + transform.Rotate(rotateDir, Time.deltaTime * 200f); + m_AgentRb.AddForce(dirToGo * 2, ForceMode.VelocityChange); + + } + + /// + /// Called every step of the engine. Here the agent takes an action. + /// + 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); + } + + public override void Heuristic(in ActionBuffers actionsOut) + { + var discreteActionsOut = actionsOut.DiscreteActions; + //forward + if (Input.GetKey(KeyCode.W)) + { + discreteActionsOut[0] = 1; + } + if (Input.GetKey(KeyCode.S)) + { + discreteActionsOut[0] = 2; + } + //rotate + if (Input.GetKey(KeyCode.A)) + { + discreteActionsOut[2] = 1; + } + if (Input.GetKey(KeyCode.D)) + { + discreteActionsOut[2] = 2; + } + //right + if (Input.GetKey(KeyCode.E)) + { + discreteActionsOut[1] = 1; + } + if (Input.GetKey(KeyCode.Q)) + { + discreteActionsOut[1] = 2; + } + } +} diff --git a/Project/Assets/ML-Agents/Examples/Sorter/Scripts/SorterAgent.cs.meta b/Project/Assets/ML-Agents/Examples/Sorter/Scripts/SorterAgent.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..fbee5bb066da2a0ec0aeff38ab01a86a038b300b Binary files /dev/null and b/Project/Assets/ML-Agents/Examples/Sorter/Scripts/SorterAgent.cs.meta differ diff --git a/Project/Assets/ML-Agents/Examples/Sorter/TFModels/Sorter.onnx b/Project/Assets/ML-Agents/Examples/Sorter/TFModels/Sorter.onnx new file mode 100644 index 0000000000000000000000000000000000000000..28d2b150f7923f951d457951a2ba09b7c935bc60 --- /dev/null +++ b/Project/Assets/ML-Agents/Examples/Sorter/TFModels/Sorter.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b827c9653b84754829085faf0932b32b4dc2a7ca118d3e2efa87262d12932f4e +size 510893