├── python ├── ppo │ ├── __init__.py │ └── history.py ├── unityagents │ ├── __init__.py │ ├── exception.py │ └── brain.py ├── requirements.txt ├── setup.py ├── README.md └── test_unityagents.py ├── unity-environment ├── ProjectSettings │ ├── ProjectVersion.txt │ ├── ClusterInputManager.asset │ ├── NetworkManager.asset │ ├── TimeManager.asset │ ├── AudioManager.asset │ ├── EditorSettings.asset │ ├── EditorBuildSettings.asset │ ├── TagManager.asset │ ├── DynamicsManager.asset │ ├── UnityConnectSettings.asset │ ├── Physics2DSettings.asset │ ├── NavMeshAreas.asset │ ├── GraphicsSettings.asset │ └── QualitySettings.asset ├── Assets │ ├── ML-Agents │ │ ├── Materials │ │ │ ├── MaterialsBall │ │ │ │ ├── logo.png │ │ │ │ ├── floor.jpg │ │ │ │ ├── Materials.meta │ │ │ │ ├── Text.mat.meta │ │ │ │ ├── floor.mat.meta │ │ │ │ ├── Materials │ │ │ │ │ ├── logo 1.mat.meta │ │ │ │ │ ├── logo 2.mat.meta │ │ │ │ │ ├── logo.mat.meta │ │ │ │ │ ├── logo.mat │ │ │ │ │ ├── logo 2.mat │ │ │ │ │ └── logo 1.mat │ │ │ │ ├── floor.jpg.meta │ │ │ │ ├── floor.mat │ │ │ │ ├── logo.png.meta │ │ │ │ └── Text.mat │ │ │ ├── ball.mat.meta │ │ │ ├── MaterialsGrid │ │ │ │ ├── Wall.mat.meta │ │ │ │ ├── Floor.mat.meta │ │ │ │ ├── agent_mat.mat.meta │ │ │ │ ├── goal_mat.mat.meta │ │ │ │ ├── pit_mat.mat.meta │ │ │ │ ├── Wall.mat │ │ │ │ ├── goal_mat.mat │ │ │ │ ├── pit_mat.mat │ │ │ │ ├── agent_mat.mat │ │ │ │ └── Floor.mat │ │ │ ├── MaterialsBall.meta │ │ │ ├── MaterialsGrid.meta │ │ │ ├── MaterialsTennis.meta │ │ │ ├── UIDefault.mat.meta │ │ │ ├── MaterialsTennis │ │ │ │ ├── bounce.physicMaterial.meta │ │ │ │ └── bounce.physicMaterial │ │ │ ├── ball.mat │ │ │ └── UIDefault.mat │ │ ├── Plugins │ │ │ ├── JSON │ │ │ │ ├── Newtonsoft.Json.dll │ │ │ │ └── Newtonsoft.Json.dll.meta │ │ │ └── JSON.meta │ │ ├── Examples │ │ │ ├── 3DBall │ │ │ │ ├── TFModels │ │ │ │ │ ├── 3DBall.bytes │ │ │ │ │ └── 3DBall.bytes.meta │ │ │ │ ├── Scene.unity.meta │ │ │ │ ├── Prefabs.meta │ │ │ │ ├── Scripts.meta │ │ │ │ ├── TFModels.meta │ │ │ │ ├── Prefabs │ │ │ │ │ └── Game.prefab.meta │ │ │ │ └── Scripts │ │ │ │ │ ├── Ball3DAcademy.cs │ │ │ │ │ ├── Ball3DAgent.cs.meta │ │ │ │ │ ├── Ball3DAcademy.cs.meta │ │ │ │ │ ├── Ball3DDecision.cs.meta │ │ │ │ │ ├── Ball3DDecision.cs │ │ │ │ │ └── Ball3DAgent.cs │ │ │ ├── Tennis │ │ │ │ ├── Racket │ │ │ │ │ ├── RacketTex.png │ │ │ │ │ ├── Racket.mtl │ │ │ │ │ ├── Racket.mtl.meta │ │ │ │ │ ├── Materials.meta │ │ │ │ │ ├── Materials │ │ │ │ │ │ ├── None.mat.meta │ │ │ │ │ │ └── None.mat │ │ │ │ │ ├── RacketTex.png.meta │ │ │ │ │ └── Racket.obj.meta │ │ │ │ ├── TFModels │ │ │ │ │ ├── Tennis.bytes │ │ │ │ │ └── Tennis.bytes.meta │ │ │ │ ├── Tennis.unity.meta │ │ │ │ ├── Materials.meta │ │ │ │ ├── Racket.meta │ │ │ │ ├── Scripts.meta │ │ │ │ ├── TFModels.meta │ │ │ │ ├── Materials │ │ │ │ │ ├── sand.mat.meta │ │ │ │ │ ├── NetMat.mat.meta │ │ │ │ │ ├── invisible.mat.meta │ │ │ │ │ ├── ballMat.physicMaterial.meta │ │ │ │ │ ├── racketMat.physicMaterial.meta │ │ │ │ │ ├── ballMat.physicMaterial │ │ │ │ │ ├── racketMat.physicMaterial │ │ │ │ │ ├── NetMat.mat │ │ │ │ │ ├── sand.mat │ │ │ │ │ └── invisible.mat │ │ │ │ └── Scripts │ │ │ │ │ ├── hitWall.cs.meta │ │ │ │ │ ├── TennisAcademy.cs.meta │ │ │ │ │ ├── TennisAgent.cs.meta │ │ │ │ │ ├── TennisAcademy.cs │ │ │ │ │ ├── TennisAgent.cs │ │ │ │ │ └── hitWall.cs │ │ │ ├── GridWorld │ │ │ │ ├── TFModels │ │ │ │ │ ├── GridWorld.bytes │ │ │ │ │ └── GridWorld.bytes.meta │ │ │ │ ├── GridWorld.unity.meta │ │ │ │ ├── Scripts.meta │ │ │ │ ├── Resources.meta │ │ │ │ ├── TFModels.meta │ │ │ │ ├── Resources │ │ │ │ │ ├── agent.prefab.meta │ │ │ │ │ ├── goal.prefab.meta │ │ │ │ │ └── pit.prefab.meta │ │ │ │ └── Scripts │ │ │ │ │ ├── GridAgent.cs.meta │ │ │ │ │ ├── GridAcademy.cs.meta │ │ │ │ │ ├── GridAcademy.cs │ │ │ │ │ └── GridAgent.cs │ │ │ ├── Basic │ │ │ │ ├── Scene.unity.meta │ │ │ │ ├── Materials.meta │ │ │ │ ├── Scripts.meta │ │ │ │ ├── Materials │ │ │ │ │ ├── agent.mat.meta │ │ │ │ │ ├── goal.mat.meta │ │ │ │ │ ├── agent.mat │ │ │ │ │ └── goal.mat │ │ │ │ └── Scripts │ │ │ │ │ ├── BasicAcademy.cs │ │ │ │ │ ├── BasicAcademy.cs.meta │ │ │ │ │ ├── BasicAgent.cs.meta │ │ │ │ │ ├── BasicDecision.cs.meta │ │ │ │ │ ├── BasicDecision.cs │ │ │ │ │ └── BasicAgent.cs │ │ │ ├── 3DBall.meta │ │ │ ├── Basic.meta │ │ │ ├── Tennis.meta │ │ │ └── GridWorld.meta │ │ ├── Template │ │ │ ├── Scene.unity.meta │ │ │ ├── Scripts.meta │ │ │ └── Scripts │ │ │ │ ├── TemplateAcademy.cs │ │ │ │ ├── TemplateAgent.cs.meta │ │ │ │ ├── TemplateAcademy.cs.meta │ │ │ │ ├── TemplateDecision.cs.meta │ │ │ │ ├── TemplateAgent.cs │ │ │ │ └── TemplateDecision.cs │ │ ├── Editor.meta │ │ ├── Examples.meta │ │ ├── Materials.meta │ │ ├── Plugins.meta │ │ ├── Resources.meta │ │ ├── Scripts.meta │ │ ├── Template.meta │ │ ├── Resources │ │ │ └── AgentMonitor.prefab.meta │ │ ├── Scripts │ │ │ ├── Academy.cs.meta │ │ │ ├── Agent.cs.meta │ │ │ ├── Brain.cs.meta │ │ │ ├── Decision.cs.meta │ │ │ ├── AgentMonitor.cs.meta │ │ │ ├── Communicator.cs.meta │ │ │ ├── CoreBrain.cs.meta │ │ │ ├── CoreBrainExternal.cs.meta │ │ │ ├── CoreBrainHeuristic.cs.meta │ │ │ ├── CoreBrainInternal.cs.meta │ │ │ ├── CoreBrainPlayer.cs.meta │ │ │ ├── ExternalCommunicator.cs.meta │ │ │ ├── UnityAgentsException.cs.meta │ │ │ ├── UnityAgentsException.cs │ │ │ ├── CoreBrain.cs │ │ │ ├── Decision.cs │ │ │ ├── Communicator.cs │ │ │ ├── CoreBrainExternal.cs │ │ │ ├── CoreBrainHeuristic.cs │ │ │ └── CoreBrainPlayer.cs │ │ └── Editor │ │ │ ├── BrainEditor.cs.meta │ │ │ └── BrainEditor.cs │ └── ML-Agents.meta └── README.md ├── images ├── agent.png ├── banner.png ├── brain.png ├── tennis.png ├── academy.png ├── balance.png ├── gridworld.png ├── unity-wide.png ├── agents_diagram.png ├── internal_brain.png ├── player_brain.png ├── unity-logo-rgb.png └── scene-hierarchy.png ├── docs ├── Readme.md ├── best-practices.md ├── Organizing-the-Scene.md ├── installation.md ├── Limitations-&-Common-Issues.md ├── Training-on-Amazon-Web-Service.md ├── Example-Environments.md ├── Unity-Agents---Python-API.md └── Agents-Editor-Interface.md ├── .gitignore ├── README.md └── CODE_OF_CONDUCT.md /python/ppo/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.1.0f3 2 | -------------------------------------------------------------------------------- /images/agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/agent.png -------------------------------------------------------------------------------- /images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/banner.png -------------------------------------------------------------------------------- /images/brain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/brain.png -------------------------------------------------------------------------------- /images/tennis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/tennis.png -------------------------------------------------------------------------------- /images/academy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/academy.png -------------------------------------------------------------------------------- /images/balance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/balance.png -------------------------------------------------------------------------------- /images/gridworld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/gridworld.png -------------------------------------------------------------------------------- /images/unity-wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/unity-wide.png -------------------------------------------------------------------------------- /images/agents_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/agents_diagram.png -------------------------------------------------------------------------------- /images/internal_brain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/internal_brain.png -------------------------------------------------------------------------------- /images/player_brain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/player_brain.png -------------------------------------------------------------------------------- /images/unity-logo-rgb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/unity-logo-rgb.png -------------------------------------------------------------------------------- /images/scene-hierarchy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/images/scene-hierarchy.png -------------------------------------------------------------------------------- /python/unityagents/__init__.py: -------------------------------------------------------------------------------- 1 | from .environment import * 2 | from .brain import * 3 | from .exception import * 4 | -------------------------------------------------------------------------------- /python/requirements.txt: -------------------------------------------------------------------------------- 1 | tensorflow>=1.0 2 | Pillow>=4.2.1 3 | matplotlib 4 | numpy>=1.11.0 5 | jupyter 6 | mock>=2.0.0 7 | pytest>=3.2.2 8 | docopt -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/unity-environment/Assets/ML-Agents/Materials/MaterialsBall/logo.png -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Plugins/JSON/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/unity-environment/Assets/ML-Agents/Plugins/JSON/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/floor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/unity-environment/Assets/ML-Agents/Materials/MaterialsBall/floor.jpg -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/TFModels/3DBall.bytes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/unity-environment/Assets/ML-Agents/Examples/3DBall/TFModels/3DBall.bytes -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/RacketTex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/RacketTex.png -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/TFModels/Tennis.bytes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/unity-environment/Assets/ML-Agents/Examples/Tennis/TFModels/Tennis.bytes -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/TFModels/GridWorld.bytes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulyspinach/ml-agents/HEAD/unity-environment/Assets/ML-Agents/Examples/GridWorld/TFModels/GridWorld.bytes -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template/Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e81622878c805493fb0e3d0e0141e7c6 3 | timeCreated: 1504127824 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a83e830ec5bcd4b1db836428921d59b0 3 | timeCreated: 1497054080 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf1d119a8748d406e90ecb623b45f92f 3 | timeCreated: 1504127824 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/ball.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edd958d75ed1448138de86f3335ea4fa 3 | timeCreated: 1497123463 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11630fa83cc8b4194b94352e3e6cdb9d 3 | folderAsset: yes 4 | timeCreated: 1504127524 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Tennis.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25c0c9e81e55c4e129e1a5c0ac254100 3 | timeCreated: 1502509723 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/GridWorld.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c777442467e245108558a5155153927 3 | timeCreated: 1502222754 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/Racket.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl None 5 | Ns 0 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.8 0.8 0.8 8 | Ks 0.8 0.8 0.8 9 | d 1 10 | illum 2 11 | map_Kd RacketTex.png 12 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/Racket.mtl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 853a87fd8f74f486a98dab97294b75f5 3 | timeCreated: 1502590668 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/Wall.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 214660f4189b04cada2137381f5c3607 3 | timeCreated: 1497379290 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 67b4fb0b937cc471eae742addf6bda86 3 | folderAsset: yes 4 | timeCreated: 1503177274 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6584f096f53dc43eeb32803b91f36c5c 3 | folderAsset: yes 4 | timeCreated: 1504127503 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/TFModels/3DBall.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e28cc81d8dc98464b952e295ae9850fc 3 | timeCreated: 1505509054 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/TFModels/Tennis.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b2cb2adc95cb4d3c917355b436fc503 3 | timeCreated: 1505510464 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22a4f9d7f79784743a74a982f928bc72 3 | folderAsset: yes 4 | timeCreated: 1497123440 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/Floor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d8e8962a89d44eb28cf1b21b88014ec 3 | timeCreated: 1497391420 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/agent_mat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0457b417479684a52a3403f88f1b6b72 3 | timeCreated: 1488916554 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/goal_mat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 150ff20e417f4463ca87b7ecb6765510 3 | timeCreated: 1488916547 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/pit_mat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f75d575578054ad1a9c93db6072ecd0 3 | timeCreated: 1488918025 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6d56028f4c564724878c82cfa3c9e14 3 | folderAsset: yes 4 | timeCreated: 1502996258 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 10f3eff160a3b46fcb86042594151eae 3 | folderAsset: yes 4 | timeCreated: 1501551323 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a3740bf890474fc9857a8ec39739a35 3 | folderAsset: yes 4 | timeCreated: 1502223516 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11b74a3b21c094e088c0e9fb4d4167ee 3 | folderAsset: yes 4 | timeCreated: 1504127695 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8097eaa1623c4a8ab4eff559e20fedb 3 | folderAsset: yes 4 | timeCreated: 1504127718 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 230c334ab2f144bcda6eea42d18ebdc8 3 | folderAsset: yes 4 | timeCreated: 1506189168 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/TFModels/GridWorld.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c75cb395cc9943838c0694ad4bc2604 3 | timeCreated: 1505542949 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62e0860165bb840f99b906aa21a9e841 3 | folderAsset: yes 4 | timeCreated: 1503445471 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Plugins/JSON.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19240955c74d74ddf87ba8e888965f7b 3 | folderAsset: yes 4 | timeCreated: 1504198536 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99fcc6585b4e641d79032e5e1f1d50cd 3 | folderAsset: yes 4 | timeCreated: 1504127603 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7180b2e9f97774db6a291c04dceba7ca 3 | folderAsset: yes 4 | timeCreated: 1503355437 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f76e451b3030e54eac0f7c5488d22e9 3 | folderAsset: yes 4 | timeCreated: 1506066534 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1aca8883d579a491ca2a55ea7a8127c3 3 | folderAsset: yes 4 | timeCreated: 1503455136 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/TFModels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1354ffcdf130e41dfb6b16f0bcba7b67 3 | folderAsset: yes 4 | timeCreated: 1505434885 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f9b2a7b3f61045b8a791eeae8175dc5 3 | folderAsset: yes 4 | timeCreated: 1506189694 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fbcbd038eb29041f580c463e454e10fc 3 | folderAsset: yes 4 | timeCreated: 1503355437 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14b9bd700bd0942c3884597c37ac3cf3 3 | folderAsset: yes 4 | timeCreated: 1502996134 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b05b2bb7541a4e71901e388d093ae6e 3 | folderAsset: yes 4 | timeCreated: 1502589776 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d841f086352548b7b1c984eaf2d9e0f 3 | folderAsset: yes 4 | timeCreated: 1502590668 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ccbe12ca56a942148cb40eb57d25d1f 3 | folderAsset: yes 4 | timeCreated: 1502511502 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/TFModels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 890692685cfe34896b8005803ef23059 3 | folderAsset: yes 4 | timeCreated: 1505357884 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f480b7a50f9974756b821ca885514018 3 | folderAsset: yes 4 | timeCreated: 1497125575 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 547bbb0c7e9b540fba9aeeed1e5e7cfe 3 | folderAsset: yes 4 | timeCreated: 1502222858 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsTennis.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4bfa52d8c11844e109d2a79d90364691 3 | folderAsset: yes 4 | timeCreated: 1505334627 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7858069efa4794699844aa77e7effb64 3 | folderAsset: yes 4 | timeCreated: 1504978425 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/TFModels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9c5639f5544e49d785119b8a28305bd 3 | folderAsset: yes 4 | timeCreated: 1505509039 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe6108f2916a54fb586fffc98a704793 3 | folderAsset: yes 4 | timeCreated: 1502590668 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1d20401220d74fef901ca46558766ea 3 | folderAsset: yes 4 | timeCreated: 1501267188 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/UIDefault.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 463606e709fd24f29ac1096d0aade647 3 | timeCreated: 1503267725 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /python/unityagents/exception.py: -------------------------------------------------------------------------------- 1 | class UnityEnvironmentException(Exception): 2 | """ 3 | Related to errors starting and closing environment. 4 | """ 5 | pass 6 | 7 | 8 | class UnityActionException(Exception): 9 | """ 10 | Related to errors with sending actions. 11 | """ 12 | pass 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Materials/agent.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 260483cdfc6b14e26823a02f23bd8baa 3 | timeCreated: 1506189720 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Materials/goal.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 624b24bbec31f44babfb57ef2dfbc537 3 | timeCreated: 1506189863 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Resources/agent.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 628960e910f094ad1909ecc88cc8016d 3 | timeCreated: 1504978468 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Resources/goal.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ec4e4e96e7514d45b7ebc3ba5a9a481 3 | timeCreated: 1504978468 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Resources/pit.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d13ee2db77b3a4dcc8664d2fe2a0f219 3 | timeCreated: 1504978468 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/sand.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e875dae9102374b76b5e8a26d06478a0 3 | timeCreated: 1502668024 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Text.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58e2b2715aaee4686a912897f823f8f5 3 | timeCreated: 1501268164 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/floor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5a827147332b4e80b0586e4b0df358f 3 | timeCreated: 1501124758 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Resources/AgentMonitor.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d260e4fc4d3db49e494c8cc1529db087 3 | timeCreated: 1502058539 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Prefabs/Game.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff026d63a00abdc48ad6ddcff89aba04 3 | timeCreated: 1506066551 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/NetMat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5efa51385ecfb42549467cd60c42821a 3 | timeCreated: 1504289048 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/invisible.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b8d9f163db3b438c9577737f468e0a2 3 | timeCreated: 1502511309 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/Materials/None.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd3afa08ccbd34d38afbb8a50097bbb8 3 | timeCreated: 1502590668 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Materials/logo 1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e35c6159207d7448e988c8cf0c137ab6 3 | timeCreated: 1501267793 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Materials/logo 2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4efff3f0f46984b78ae6161ef6558291 3 | timeCreated: 1501706173 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Materials/logo.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8f8a9c03cd1f4fdbb7a3e95be9ea341 3 | timeCreated: 1501267188 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/ballMat.physicMaterial.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 422ac22c624b247749ec84410e5d3462 3 | timeCreated: 1502510675 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 13400000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsTennis/bounce.physicMaterial.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56162663048874fd4b10e065f9cf78b7 3 | timeCreated: 1500942139 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 13400000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/racketMat.physicMaterial.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81bc1938a128a417eae63a8d644e3baf 3 | timeCreated: 1504560869 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 13400000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicAcademy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class BasicAcademy : Academy { 6 | 7 | public override void AcademyReset() 8 | { 9 | 10 | } 11 | 12 | public override void AcademyStep() 13 | { 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAcademy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Ball3DAcademy : Academy 6 | { 7 | public override void AcademyReset() 8 | { 9 | 10 | } 11 | 12 | public override void AcademyStep() 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/Academy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1fc0029fee784d9cb9854f8912bfd07 3 | timeCreated: 1503613254 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/Agent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88b6042bc9a5d4aa58d931eae49442e5 3 | timeCreated: 1501802662 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/Brain.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c676a8ddf5a5f4f64b35e9ed5028679d 3 | timeCreated: 1503211687 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/Decision.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13e74744309fd4571b76e46fafc6d37f 3 | timeCreated: 1503182472 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template/Scripts/TemplateAcademy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class TemplateAcademy : Academy { 6 | 7 | public override void AcademyReset() 8 | { 9 | 10 | 11 | } 12 | 13 | public override void AcademyStep() 14 | { 15 | 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Editor/BrainEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1895a43ed0f54ffd9ee06234c4399e7 3 | timeCreated: 1503270350 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/AgentMonitor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e040eaa8759024abbbb14994dc4c55ee 3 | timeCreated: 1502056030 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/Communicator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18600657fd7d241a199e6caf2ba7cceb 3 | timeCreated: 1504820023 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrain.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dcbf9c1714a8d4b819ce2caa23b2eaf4 3 | timeCreated: 1504070234 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrainExternal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35813a1be64e144f887d7d5f15b963fa 3 | timeCreated: 1504070319 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrainHeuristic.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 943466ab374444748a364f9d6c3e2fe2 3 | timeCreated: 1504070366 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b23992c8eb17439887f5e944bf04a40 3 | timeCreated: 1504070347 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrainPlayer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41e9bda8f3cf1492fa74926a530f6f70 3 | timeCreated: 1504070375 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/hitWall.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05eee2a5536934f5684a65f151efd304 3 | timeCreated: 1502512662 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/ExternalCommunicator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9685de855ca1541409f4187c5ab7601d 3 | timeCreated: 1504820023 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/UnityAgentsException.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e63e4a66d820245778f9a2abfa5b68e0 3 | timeCreated: 1504131359 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template/Scripts/TemplateAgent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33bb739f1138d40798114d667776a1d6 3 | timeCreated: 1503355437 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aaba48bf82bee4751aa7b89569e57f73 3 | timeCreated: 1502223572 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicAcademy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19276d4dc78ee49f1ba258293f17636c 3 | timeCreated: 1503355437 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 624480a72e46148118ab2e2d89b537de 3 | timeCreated: 1503355437 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicDecision.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99399d2439f894b149d8e67b85b6e07a 3 | timeCreated: 1503355437 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 857707f3f352541d5b858efca4479b95 3 | timeCreated: 1501806151 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAcademy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1aadf59c24464a9fb5b4b3a2190c972 3 | timeCreated: 1503202602 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e51a3fb0b3186433ea84fc1e0549cc91 3 | timeCreated: 1503202602 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template/Scripts/TemplateAcademy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9af83cd96d4bc4088a966af174446d1b 3 | timeCreated: 1503355437 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template/Scripts/TemplateDecision.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3812a852e739e44d7ab2ad777eeb0212 3 | timeCreated: 1503355437 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAcademy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb15e3c3d55e54abaafb74c635b6a458 3 | timeCreated: 1502223572 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccaa8f43c15264209b137d8dc26a8d63 3 | timeCreated: 1503595709 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAcademy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 506d4052eefa14ec9bbb356e3669043d 3 | timeCreated: 1501806151 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/ballMat.physicMaterial: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!134 &13400000 4 | PhysicMaterial: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: ballMat 9 | dynamicFriction: 0 10 | staticFriction: 0 11 | bounciness: 1 12 | frictionCombine: 1 13 | bounceCombine: 3 14 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/racketMat.physicMaterial: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!134 &13400000 4 | PhysicMaterial: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: racketMat 9 | dynamicFriction: 0 10 | staticFriction: 0 11 | bounciness: 1 12 | frictionCombine: 1 13 | bounceCombine: 3 14 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsTennis/bounce.physicMaterial: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!134 &13400000 4 | PhysicMaterial: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: bounce 9 | dynamicFriction: 0.6 10 | staticFriction: 0.6 11 | bounciness: 0.1 12 | frictionCombine: 0 13 | bounceCombine: 0 14 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template/Scripts/TemplateAgent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class TemplateAgent : Agent { 6 | 7 | 8 | 9 | public override List CollectState() 10 | { 11 | List state = new List(); 12 | 13 | return state; 14 | } 15 | 16 | public override void AgentStep(float[] act) 17 | { 18 | 19 | } 20 | 21 | public override void AgentReset() 22 | { 23 | 24 | } 25 | 26 | public override void AgentOnDone() 27 | { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_DefaultBehaviorMode: 0 10 | m_SpritePackerMode: 0 11 | m_SpritePackerPaddingPower: 1 12 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 13 | m_ProjectGenerationRootNamespace: 14 | m_UserGeneratedProjectSuffix: 15 | m_CollabEditorSettings: 16 | inProgressEnabled: 1 17 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicDecision.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class BasicDecision : MonoBehaviour, Decision { 6 | 7 | public float[] Decide (List state, List observation, float reward, bool done, float[] memory) 8 | { 9 | return default(float[]); 10 | 11 | } 12 | 13 | public float[] MakeMemory (List state, List observation, float reward, bool done, float[] memory) 14 | { 15 | return default(float[]); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Template/Scripts/TemplateDecision.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class TemplateDecision : MonoBehaviour, Decision { 6 | 7 | public float[] Decide (List state, List observation, float reward, bool done, float[] memory) 8 | { 9 | return default(float[]); 10 | 11 | } 12 | 13 | public float[] MakeMemory (List state, List observation, float reward, bool done, float[] memory) 14 | { 15 | return default(float[]); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/ML-Agents/Examples/3DBall/Scene.unity 10 | guid: a83e830ec5bcd4b1db836428921d59b0 11 | - enabled: 0 12 | path: Assets/ML-Agents/Examples/GridWorld/GridWorld.unity 13 | guid: 7c777442467e245108558a5155153927 14 | - enabled: 0 15 | path: Assets/ML-Agents/Examples/Tennis/Tennis.unity 16 | guid: 25c0c9e81e55c4e129e1a5c0ac254100 17 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Plugins/JSON/Newtonsoft.Json.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2471d838da1db4d07ad5ad6a2c196a5b 3 | timeCreated: 1489286987 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | Any: 13 | enabled: 1 14 | settings: {} 15 | Editor: 16 | enabled: 0 17 | settings: 18 | DefaultValueInitialized: true 19 | WindowsStoreApps: 20 | enabled: 0 21 | settings: 22 | CPU: AnyCPU 23 | userData: 24 | assetBundleName: 25 | assetBundleVariant: 26 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Ball3DDecision : MonoBehaviour, Decision 6 | { 7 | public float[] Decide(List state, List observation, float reward, bool done, float[] memory) 8 | { 9 | if (gameObject.GetComponent().brainParameters.actionSpaceType == StateType.continuous) 10 | { 11 | return new float[4]{ 0f, 0f, 0f, 0.0f }; 12 | 13 | } 14 | else 15 | { 16 | return new float[1]{ 1f }; 17 | } 18 | } 19 | 20 | public float[] MakeMemory(List state, List observation, float reward, bool done, float[] memory) 21 | { 22 | return new float[0]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | m_AutoSimulation: 1 20 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/UnityAgentsException.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using System; 6 | [System.Serializable] 7 | /// Contains exceptions specific to ML-Agents. 8 | public class UnityAgentsException : System.Exception 9 | { 10 | /// When a UnityAgentsException is called, the timeScale is set to 0. 11 | /// The simulation will end since no steps will be taken. 12 | public UnityAgentsException(string message) : base(message) 13 | { 14 | Time.timeScale = 0f; 15 | } 16 | 17 | /// A constructor is needed for serialization when an exception propagates 18 | /// from a remoting server to the client. 19 | protected UnityAgentsException(System.Runtime.Serialization.SerializationInfo info, 20 | System.Runtime.Serialization.StreamingContext context) 21 | { } 22 | } 23 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrain.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | /** \brief An interface which defines the functions needed for a CoreBrain. */ 6 | /** There is no need to modify or implement CoreBrain to create a Unity environment. 7 | */ 8 | public interface CoreBrain 9 | { 10 | 11 | /// Implement setBrain so let the coreBrain know what brain is using it 12 | void SetBrain(Brain b); 13 | /// Implement this method to initialize CoreBrain 14 | void InitializeCoreBrain(); 15 | /// Implement this method to define the logic for deciding actions 16 | void DecideAction(); 17 | /// Implement this method to define the logic for sending the actions 18 | void SendState(); 19 | /// Implement this method to define what should be displayed in the brain Inspector 20 | void OnInspector(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_Enabled: 0 14 | m_CaptureEditorExceptions: 1 15 | UnityPurchasingSettings: 16 | m_Enabled: 0 17 | m_TestMode: 0 18 | UnityAnalyticsSettings: 19 | m_Enabled: 0 20 | m_InitializeOnStartup: 1 21 | m_TestMode: 0 22 | m_TestEventUrl: 23 | m_TestConfigUrl: 24 | UnityAdsSettings: 25 | m_Enabled: 0 26 | m_InitializeOnStartup: 1 27 | m_TestMode: 0 28 | m_EnabledPlatforms: 4294967295 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /docs/Readme.md: -------------------------------------------------------------------------------- 1 | # Unity ML Agents Documentation 2 | 3 | ## Basic 4 | * [Unity ML Agents Overview](Unity-Agents-Overview.md) 5 | * [Installation & Set-up](installation.md) 6 | * [Getting Started with the Balance Ball Environment](Getting-Started-with-Balance-Ball.md) 7 | * [Example Environments](Example-Environments.md) 8 | 9 | ## Advanced 10 | * [How to make a new Unity Environment](Making-a-new-Unity-Environment.md) 11 | * [Best practices when designing an Environment](best-practices.md) 12 | * [How to organize the Scene](Organizing-the-Scene.md) 13 | * [How to use the Python API](Unity-Agents---Python-API.md) 14 | * [How to use TensorflowSharp inside Unity [Experimental]](Using-TensorFlow-Sharp-in-Unity-(Experimental).md) 15 | * [Agents SDK Inspector Descriptions](Agents-Editor-Interface.md) 16 | * [Training on the Cloud with Amazon Web Services](Training-on-Amazon-Web-Service.md) 17 | 18 | ## Help 19 | * [Limitations & Common Issues](Limitations-&-Common-Issues.md) 20 | -------------------------------------------------------------------------------- /python/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from setuptools import setup, Command, find_packages 4 | 5 | 6 | with open('requirements.txt') as f: 7 | required = f.read().splitlines() 8 | 9 | setup(name='unityagents', 10 | version='0.1.1', 11 | description='Unity Machine Learning Agents', 12 | license='Apache License 2.0', 13 | author='Unity Technologies', 14 | author_email='ML-Agents@unity3d.com', 15 | url='https://github.com/Unity-Technologies/ml-agents', 16 | packages=find_packages(exclude = ['ppo']), 17 | install_requires = required, 18 | long_description= ("Unity Machine Learning Agents allows researchers and developers " 19 | "to transform games and simulations created using the Unity Editor into environments " 20 | "where intelligent agents can be trained using reinforcement learning, evolutionary " 21 | "strategies, or other machine learning methods through a simple to use Python API.") 22 | ) 23 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAcademy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | public class TennisAcademy : Academy 7 | { 8 | 9 | [Header("Specific to Tennis")] 10 | public GameObject ball; 11 | 12 | public override void AcademyReset() 13 | { 14 | float ballOut = Random.Range(4f, 11f); 15 | int flip = Random.Range(0, 2); 16 | if (flip == 0) 17 | { 18 | ball.transform.position = new Vector3(-ballOut, 5f, 5f); 19 | } 20 | else 21 | { 22 | ball.transform.position = new Vector3(ballOut, 5f, 5f); 23 | } 24 | ball.GetComponent().velocity = new Vector3(0f, 0f, 0f); 25 | ball.transform.localScale = new Vector3(1, 1, 1) * resetParameters["ballSize"]; 26 | } 27 | 28 | public override void AcademyStep() 29 | { 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /docs/best-practices.md: -------------------------------------------------------------------------------- 1 | # Environment Design Best Practices 2 | 3 | ## General 4 | * It is often helpful to being with the simplest version of the problem, to ensure the agent can learn it. From there increase 5 | complexity over time. 6 | * When possible, It is often helpful to ensure that you can complete the task by using a Player Brain to control the agent. 7 | 8 | ## Rewards 9 | * The magnitude of any given reward should typically not be greater than 1.0 in order to ensure a more stable learning process. 10 | * Positive rewards are often more helpful to shaping the desired behavior of an agent than negative rewards. 11 | * For locomotion tasks, a small positive reward (+0.1) for forward progress is typically used. 12 | * If you want the agent the finish a task quickly, it is often helpful to provide a small penalty every step (-0.1). 13 | 14 | ## States 15 | * The magnitude of each state variable should be normalized to around 1.0. 16 | * States should include all variables relevant to allowing the agent to take the optimally informed decision. 17 | * Categorical state variables such as type of object (Sword, Shield, Bow) should be encoded in one-hot fashion (ie `3` -> `0, 0, 1`). 18 | 19 | ## Actions 20 | * When using continuous control, action values should be clipped to an appropriate range. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /unity-environment/[Ll]ibrary/ 2 | /unity-environment/[Tt]emp/ 3 | /unity-environment/[Oo]bj/ 4 | /unity-environment/[Bb]uild/ 5 | /unity-environment/[Bb]uilds/ 6 | /unity-environment/Assets/AssetStoreTools* 7 | 8 | # Tensorflow Model Info 9 | /python/models 10 | /python/summaries 11 | 12 | # Visual Studio 2015 cache directory 13 | /unity-environment/.vs/ 14 | 15 | # Autogenerated VS/MD/Consulo solution and project files 16 | /unity-environmentExportedObj/ 17 | /unity-environment.consulo/ 18 | *.csproj 19 | *.unityproj 20 | *.sln 21 | *.suo 22 | *.tmp 23 | *.user 24 | *.userprefs 25 | *.pidb 26 | *.booproj 27 | *.svd 28 | *.pdb 29 | 30 | # Unity3D generated meta files 31 | *.pidb.meta 32 | 33 | # Unity3D Generated File On Crash Reports 34 | /unity-environment/sysinfo.txt 35 | 36 | # Builds 37 | *.apk 38 | *.unitypackage 39 | *.app 40 | *.exe 41 | *.x86_64 42 | *.x86 43 | 44 | # Tensorflow Sharp Files 45 | /unity-environment/Assets/ML-Agents/Plugins/Android* 46 | /unity-environment/Assets/ML-Agents/Plugins/iOS* 47 | /unity-environment/Assets/ML-Agents/Plugins/Computer* 48 | /unity-environment/Assets/ML-Agents/Plugins/System* 49 | 50 | 51 | # Mac hidden files 52 | *.DS_Store 53 | */.ipynb_checkpoints 54 | */.idea 55 | *.pyc 56 | *.idea/misc.xml 57 | *.idea/modules.xml 58 | *.iml 59 | *.xml 60 | *.cache 61 | */build/ 62 | */dist/ 63 | *.egg-info* 64 | *.eggs* 65 | *.gitignore.swp 66 | 67 | .DS_Store 68 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AlwaysShowColliders: 0 28 | m_ShowColliderSleep: 1 29 | m_ShowColliderContacts: 0 30 | m_ShowColliderAABB: 0 31 | m_ContactArrowScale: 0.2 32 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 33 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 34 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 35 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 36 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 37 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/Decision.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | /// Generic functions for Decision Interface 6 | public interface Decision 7 | { 8 | /// \brief Implement this method to define the logic of decision making 9 | /// for the CoreBrainHeuristic 10 | /** Given the information about the agent, return a vector of actions. 11 | * @param state The state of the agent 12 | * @param observation The cameras the agent uses 13 | * @param reward The reward the agent had at the previous step 14 | * @param done Weather or not the agent is done 15 | * @param memory The memories stored from the previous step with MakeMemory() 16 | * @return The vector of actions the agent will take at the next step 17 | */ 18 | float[] Decide(List state, List observation, float reward, bool done, float[] memory); 19 | 20 | /// \brief Implement this method to define the logic of memory making for 21 | /// the CoreBrainHeuristic 22 | /** Given the information about the agent, return the new memory vector for the agent. 23 | * @param state The state of the agent 24 | * @param observation The cameras the agent uses 25 | * @param reward The reward the agent had at the previous step 26 | * @param done Weather or not the agent is done 27 | * @param memory The memories stored from the previous step with MakeMemory() 28 | * @return The vector of memories the agent will use at the next step 29 | */ 30 | float[] MakeMemory(List state, List observation, float reward, bool done, float[] memory); 31 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Unity ML - Agents (Beta) 4 | 5 | **Unity Machine Learning Agents** allows researchers and developers to 6 | create games and simulations using the Unity Editor which serve as 7 | environments where intelligent agents can be trained using 8 | reinforcement learning, neuroevolution, or other machine learning 9 | methods through a simple-to-use Python API. For more information, see 10 | the [documentation page](docs). 11 | 12 | For a walkthrough on how to train an agent in one of the provided 13 | example environments, start 14 | [here](docs/Getting-Started-with-Balance-Ball.md). 15 | 16 | ## Features 17 | * Unity Engine flexibility and simplicity 18 | * Multiple observations (cameras) 19 | * Flexible Multi-agent support 20 | * Discrete and continuous action spaces 21 | * Python (2 and 3) control interface 22 | * Visualizing network outputs in environment 23 | * Tensorflow Sharp Agent Embedding _[Experimental]_ 24 | 25 | ## Creating an Environment 26 | 27 | The _Agents SDK_, including example environment scenes is located in 28 | `unity-environment` folder. For requirements, instructions, and other 29 | information, see the contained Readme and the relevant 30 | [documentation](docs/Making-a-new-Unity-Environment.md). 31 | 32 | ## Training your Agents 33 | 34 | Once you've built a Unity Environment, example Reinforcement Learning 35 | algorithms and the Python API are available in the `python` 36 | folder. For requirements, instructions, and other information, see the 37 | contained Readme and the relevant 38 | [documentation](docs/Unity-Agents---Python-API.md). 39 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | m_SettingNames: 89 | - Humanoid 90 | -------------------------------------------------------------------------------- /docs/Organizing-the-Scene.md: -------------------------------------------------------------------------------- 1 | # Organizing the Scene Layout 2 | 3 | This tutorial will help you understand how to organize your scene when using Agents in your Unity environment. 4 | 5 | ## ML-Agents Game Objects 6 | 7 | There are three kinds of game objects you need to include in your scene in order to use Unity ML-Agents: 8 | * Academy 9 | * Brain 10 | * Agents 11 | 12 | #### Keep in mind : 13 | * There can only be one Academy game object in a scene. 14 | * You can have multiple Brain game objects but they must be child of the Academy game object. 15 | 16 | #### Here is an example of what your scene hierarchy should look like : 17 | 18 | ![Scene Hierarchy](../images/scene-hierarchy.png) 19 | 20 | ### Functionality 21 | 22 | #### The Academy 23 | The Academy is responsible for: 24 | * Synchronizing the environment and keeping all agent's steps in pace. As such, there can only be one per scene. 25 | * Determining the speed of the engine, its quality, and the display's resolution. 26 | * Modifying the environment at every step and every reset according to the logic defined in `AcademyStep()` and `AcademyReset()`. 27 | * Coordingating the Brains which must be set as children of the Academy. 28 | 29 | #### Brains 30 | Each brain corresponds to a specific Decision-making method. This often aligns with a specific neural network model. A Brains is responsible for deciding the action of all the Agents which are linked to it. There can be multiple brains in the same scene and multiple agents can subscribe to the same brain. 31 | 32 | #### Agents 33 | Each agent within a scene takes actions according to the decisions provided by it's linked Brain. There can be as many Agents of as many types as you like in the scene. The state size and action size of each agent must match the brain's parameters in order for the Brain to decide actions for it. 34 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class BasicAgent : Agent 6 | { 7 | 8 | public int position; 9 | public int smallGoalPosition; 10 | public int largeGoalPosition; 11 | public GameObject largeGoal; 12 | public GameObject smallGoal; 13 | public int minPosition; 14 | public int maxPosition; 15 | 16 | public override List CollectState() 17 | { 18 | List state = new List(); 19 | state.Add(position); 20 | return state; 21 | } 22 | 23 | public override void AgentStep(float[] act) 24 | { 25 | float movement = act[0]; 26 | int direction = 0; 27 | if (movement == 0) { direction = -1; } 28 | if (movement == 1) { direction = 1; } 29 | 30 | position += direction; 31 | if (position < minPosition) { position = minPosition; } 32 | if (position > maxPosition) { position = maxPosition; } 33 | 34 | gameObject.transform.position = new Vector3(position, 0f, 0f); 35 | 36 | if (position == smallGoalPosition) 37 | { 38 | done = true; 39 | reward = 0.1f; 40 | } 41 | 42 | if (position == largeGoalPosition) 43 | { 44 | done = true; 45 | reward = 1f; 46 | } 47 | } 48 | 49 | public override void AgentReset() 50 | { 51 | position = 0; 52 | minPosition = -10; 53 | maxPosition = 10; 54 | smallGoalPosition = -3; 55 | largeGoalPosition = 7; 56 | smallGoal.transform.position = new Vector3(smallGoalPosition, 0f, 0f); 57 | largeGoal.transform.position = new Vector3(largeGoalPosition, 0f, 0f); 58 | } 59 | 60 | public override void AgentOnDone() 61 | { 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | ![alt text](../images/banner.png "Unity ML - Agents") 2 | 3 | # Unity ML - Agents (Python API) 4 | 5 | ## Python Setup 6 | 7 | ### Requirements 8 | * Jupyter 9 | * docopt 10 | * Matplotlib 11 | * numpy 12 | * Pillow 13 | * Python (2 or 3) 14 | * Tensorflow (1.0+) 15 | 16 | ### Installing Dependencies 17 | To install dependencies, run: 18 | 19 | `pip install .` 20 | 21 | or 22 | 23 | `pip3 install .` 24 | 25 | If your Python environment doesn't include `pip`, see these [instructions](https://packaging.python.org/guides/installing-using-linux-tools/#installing-pip-setuptools-wheel-with-linux-package-managers) on installing it. 26 | 27 | ## Provided Jupyter Notebooks 28 | 29 | * **Basic** - Demonstrates usage of `UnityEnvironment` class for launching and interfacing with Unity Environments. 30 | * **PPO** - Used for training agents. Contains an implementation of Proximal Policy Optimization Reinforcement Learning algorithm. 31 | 32 | ### Running each notebook 33 | 34 | To launch jupyter, run: 35 | 36 | `jupyter notebook` 37 | 38 | Then navigate to `localhost:8888` to access each training notebook. 39 | 40 | To monitor training progress, run the following from the root directory of this repo: 41 | 42 | `tensorboard --logdir=summaries` 43 | 44 | Then navigate to `localhost:6006` to monitor progress with Tensorboard. 45 | 46 | ## Training PPO directly 47 | 48 | To train using PPO without the notebook, run: 49 | 50 | `python3 ppo.py --train` 51 | 52 | For a list of additional hyperparameters, run: 53 | 54 | `python3 ppo.py --help` 55 | 56 | ## Using Python API 57 | See this [documentation](../docs/Unity-Agents---Python-API.md) for a detailed description of the functions and uses of the Python API. 58 | 59 | ## Training on AWS 60 | See this related [blog post](https://medium.com/towards-data-science/how-to-run-unity-on-amazon-cloud-or-without-monitor-3c10ce022639) for a description of how to run Unity Environments on AWS EC2 instances with the GPU. 61 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/floor.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1012bb9d8c534d0fa98a08734656eda 3 | timeCreated: 1501124750 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/RacketTex.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 687db29a8bca1408e89755541ecaa897 3 | timeCreated: 1502590668 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: -1 37 | wrapV: -1 38 | wrapW: -1 39 | nPOTScale: 1 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 0 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | spriteSheet: 67 | serializedVersion: 2 68 | sprites: [] 69 | outline: [] 70 | physicsShape: [] 71 | spritePackingTag: 72 | userData: 73 | assetBundleName: 74 | assetBundleVariant: 75 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/Communicator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | /** \brief AcademyParameters is a structure containing basic information about the 6 | * training environment. */ 7 | /** The AcademyParameters will be sent via socket at the start of the Environment. 8 | * This structure does not need to be modified. 9 | */ 10 | public struct AcademyParameters 11 | { 12 | public string AcademyName; 13 | /**< \brief The name of the Academy. If the communicator is External, 14 | * it will be the name of the Academy GameObject */ 15 | public Dictionary resetParameters; 16 | /**< \brief The default reset parameters are sent via socket*/ 17 | public List brainNames; 18 | /**< \brief A list of the External brains names sent via socket*/ 19 | public List brainParameters; 20 | /**< \brief A list of the External brains parameters sent via socket*/ 21 | } 22 | 23 | public enum ExternalCommand 24 | { 25 | STEP, 26 | RESET, 27 | QUIT 28 | } 29 | 30 | /** 31 | * This is the interface used to generate coordinators. 32 | * This does not need to be modified nor implemented to create a 33 | * Unity environment. 34 | */ 35 | public interface Communicator 36 | { 37 | 38 | /// Implement this method to allow brains to subscribe to the 39 | /// decisions made outside of Unity 40 | void SubscribeBrain(Brain brain); 41 | 42 | /// Implement this method to initialize the communicator 43 | void InitializeCommunicator(); 44 | 45 | /// Implement this method to receive actions from outside of Unity and 46 | /// update the actions of the brains that subscribe 47 | void UpdateActions(); 48 | 49 | /// Implement this method to return the ExternalCommand that 50 | /// was given outside of Unity 51 | ExternalCommand GetCommand(); 52 | 53 | /// Implement this method to return the new dictionary of resetParameters 54 | /// that was given outside of Unity 55 | Dictionary GetResetParameters(); 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Editor/BrainEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using UnityEditor; 6 | using System.Linq; 7 | /* 8 | This code is meant to modify the behavior of the inspector on Brain Components. 9 | Depending on the type of brain that is used, the available fields will be modified in the inspector accordingly. 10 | */ 11 | [CustomEditor (typeof(Brain))] 12 | public class BrainEditor : Editor 13 | { 14 | 15 | 16 | public override void OnInspectorGUI () 17 | { 18 | Brain myBrain = (Brain)target; 19 | SerializedObject serializedBrain = new SerializedObject (target); 20 | 21 | if (myBrain.transform.parent == null) { 22 | EditorGUILayout.HelpBox ("A Brain GameObject myst be a child of an Academy GameObject!", MessageType.Error); 23 | } else if (myBrain.transform.parent.GetComponent () == null) { 24 | EditorGUILayout.HelpBox ("The Parent of a Brain must have an Academy Component attached to it!", MessageType.Error); 25 | } 26 | 27 | 28 | SerializedProperty bp = serializedBrain.FindProperty ("brainParameters"); 29 | if (myBrain.brainParameters.actionDescriptions == null) { 30 | myBrain.brainParameters.actionDescriptions = new string[myBrain.brainParameters.actionSize]; 31 | } 32 | if (myBrain.brainParameters.actionSize != myBrain.brainParameters.actionDescriptions.Count()) { 33 | myBrain.brainParameters.actionDescriptions = new string[myBrain.brainParameters.actionSize]; 34 | } 35 | serializedBrain.Update (); 36 | EditorGUILayout.PropertyField (bp, true); 37 | serializedBrain.ApplyModifiedProperties (); 38 | 39 | myBrain.brainType = (BrainType)EditorGUILayout.EnumPopup ("Type Of Brain ", myBrain.brainType); 40 | 41 | if ((int)myBrain.brainType >= System.Enum.GetValues (typeof(BrainType)).Length) { 42 | myBrain.brainType = BrainType.Player; 43 | } 44 | 45 | myBrain.UpdateCoreBrains (); 46 | 47 | myBrain.coreBrain.OnInspector (); 48 | 49 | #if !NET_4_6 && ENABLE_TENSORFLOW 50 | EditorGUILayout.HelpBox ("You cannot have ENABLE_TENSORFLOW without NET_4_6", MessageType.Error); 51 | #endif 52 | 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /python/unityagents/brain.py: -------------------------------------------------------------------------------- 1 | class BrainInfo: 2 | def __init__(self, observation, state, memory=None, reward=None, agents=None, local_done=None): 3 | """ 4 | Describes experience at current step of all agents linked to a brain. 5 | """ 6 | self.observations = observation 7 | self.states = state 8 | self.memories = memory 9 | self.rewards = reward 10 | self.local_done = local_done 11 | self.agents = agents 12 | 13 | 14 | class BrainParameters: 15 | def __init__(self, brain_name, brain_param): 16 | """ 17 | Contains all brain-specific parameters. 18 | :param brain_name: Name of brain. 19 | :param brain_param: Dictionary of brain parameters. 20 | """ 21 | self.brain_name = brain_name 22 | self.state_space_size = brain_param["stateSize"] 23 | self.number_observations = len(brain_param["cameraResolutions"]) 24 | self.camera_resolutions = brain_param["cameraResolutions"] 25 | self.action_space_size = brain_param["actionSize"] 26 | self.memory_space_size = brain_param["memorySize"] 27 | self.action_descriptions = brain_param["actionDescriptions"] 28 | self.action_space_type = ["discrete", "continuous"][brain_param["actionSpaceType"]] 29 | self.state_space_type = ["discrete", "continuous"][brain_param["stateSpaceType"]] 30 | 31 | def __str__(self): 32 | return '''Unity brain name: {0} 33 | Number of observations (per agent): {1} 34 | State space type: {2} 35 | State space size (per agent): {3} 36 | Action space type: {4} 37 | Action space size (per agent): {5} 38 | Memory space size (per agent): {6} 39 | Action descriptions: {7}'''.format(self.brain_name, 40 | str(self.number_observations), self.state_space_type, 41 | str(self.state_space_size), self.action_space_type, 42 | str(self.action_space_size), 43 | str(self.memory_space_size), 44 | ', '.join(self.action_descriptions)) 45 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrainExternal.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | /// CoreBrain which decides actions via communication with an external system such as Python. 6 | public class CoreBrainExternal : ScriptableObject, CoreBrain 7 | { 8 | 9 | public Brain brain; 10 | /**< Reference to the brain that uses this CoreBrainExternal */ 11 | 12 | ExternalCommunicator coord; 13 | 14 | /// Creates the reference to the brain 15 | public void SetBrain(Brain b) 16 | { 17 | brain = b; 18 | } 19 | 20 | /// Generates the communicator for the Academy if none was present and 21 | /// subscribe to ExternalCommunicator if it was present. 22 | public void InitializeCoreBrain() 23 | { 24 | if (brain.gameObject.transform.parent.gameObject.GetComponent().communicator == null) 25 | { 26 | coord = new ExternalCommunicator(brain.gameObject.transform.parent.gameObject.GetComponent()); 27 | brain.gameObject.transform.parent.gameObject.GetComponent().communicator = coord; 28 | coord.SubscribeBrain(brain); 29 | } 30 | else 31 | { 32 | if (brain.gameObject.transform.parent.gameObject.GetComponent().communicator is ExternalCommunicator) 33 | { 34 | coord = (ExternalCommunicator)brain.gameObject.transform.parent.gameObject.GetComponent().communicator; 35 | coord.SubscribeBrain(brain); 36 | } 37 | } 38 | } 39 | 40 | /// Uses the communicator to retrieve the actions, memories and values and 41 | /// sends them to the agents 42 | public void DecideAction() 43 | { 44 | brain.SendActions(coord.GetDecidedAction(brain.gameObject.name)); 45 | brain.SendMemories(coord.GetMemories(brain.gameObject.name)); 46 | brain.SendValues(coord.GetValues(brain.gameObject.name)); 47 | } 48 | 49 | /// Uses the communicator to send the states, observations, rewards and 50 | /// dones outside of Unity 51 | public void SendState() 52 | { 53 | coord.giveBrainInfo(brain); 54 | } 55 | 56 | /// Nothing needs to appear in the inspector 57 | public void OnInspector() 58 | { 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /docs/installation.md: -------------------------------------------------------------------------------- 1 | # Installation & Set-up 2 | 3 | ## Install **Unity 2017.1** or later (required) 4 | 5 | Download link available [here](https://store.unity.com/download?ref=update). 6 | 7 | ## Clone the repository 8 | Once installed, you will want to clone the Agents GitHub repository. References will be made 9 | throughout to `unity-environment` and `python` directories. Both are located at the root of the repository. 10 | 11 | ## Installing Python API 12 | In order to train an agent within the framework, you will need to install Python 2 or 3, and the dependencies described below. 13 | 14 | ### Windows Users 15 | 16 | If you are a Windows user who is new to Python/TensorFlow, follow [this guide](https://nitishmutha.github.io/tensorflow/2017/01/22/TensorFlow-with-gpu-for-windows.html) to set up your Python environment. 17 | 18 | ### Requirements 19 | * Jupyter 20 | * Matplotlib 21 | * numpy 22 | * Pillow 23 | * Python (2 or 3; 64bit required) 24 | * docopt (Training) 25 | * TensorFlow (1.0+) (Training) 26 | 27 | ### Installing Dependencies 28 | To install dependencies, go into the `python` sub-directory of the repositroy, and run (depending on your python version) from the command line: 29 | 30 | `pip install .` 31 | 32 | or 33 | 34 | `pip3 install .` 35 | 36 | If your Python environment doesn't include `pip`, see these [instructions](https://packaging.python.org/guides/installing-using-linux-tools/#installing-pip-setuptools-wheel-with-linux-package-managers) on installing it. 37 | 38 | Once the requirements are successfully installed, the next step is to check out the [Getting Started guide](Getting-Started-with-Balance-Ball.md). 39 | 40 | ## Installation Help 41 | 42 | ### Using Jupyter Notebook 43 | 44 | For a walkthrough of how to use Jupyter notebook, see [here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html). 45 | 46 | ### General Issues 47 | 48 | If you run into issues while attempting to install and run Unity ML Agents, see [here](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Limitations-&-Common-Issues.md) for a list of common issues and solutions. 49 | 50 | If you have an issue that isn't covered here, feel free to contact us at ml-agents@unity3d.com. Alternatively, feel free to create an issue on the repository. 51 | Be sure to include relevant information on OS, Python version, and exact error message if possible. 52 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/NetMat.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: NetMat 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0, g: 1, b: 0.17241383, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Materials/agent.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: agent 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.10980392, g: 0.6039216, b: 1, a: 0.8392157} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Basic/Materials/goal.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: goal 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.5058824, g: 0.74509805, b: 0.25490198, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/Wall.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Wall 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.7411765, g: 0.7411765, b: 0.7529412, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/ball.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: ball 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0 64 | - _GlossyReflections: 1 65 | - _Metallic: 1 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 0.59607846, b: 0, a: 1} 76 | - _EmissionColor: {r: 0.29411763, g: 0.21966352, b: 0.08650518, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/goal_mat.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: goal_mat 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.5058824, g: 0.74509805, b: 0.25490198, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/pit_mat.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: pit_mat 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.9411765, g: 0.31764707, b: 0.23529412, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/agent_mat.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: agent_mat 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.10980392, g: 0.6039216, b: 0.8392157, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Materials/logo.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: logo 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 0.96, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 0.96, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0, g: 0.15686275, b: 0.20784314, a: 1} 76 | - _EmissionColor: {r: 0.1544118, g: 0.1544118, b: 0.1544118, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/floor.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: floor 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 2800000, guid: d1012bb9d8c534d0fa98a08734656eda, type: 3} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/sand.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: sand 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 0.5} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 2800000, guid: dc495e9a6ea74421ea2c1c70e6d7c7d2, type: 3} 43 | m_Scale: {x: 1, y: 0.5} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Materials/invisible.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: invisible 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _ALPHAPREMULTIPLY_ON 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: 3000 16 | stringTagMap: 17 | RenderType: Transparent 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 10 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 3 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 0 75 | m_Colors: 76 | - _Color: {r: 0, g: 0, b: 0, a: 0} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/Materials/None.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: None 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 2800000, guid: 687db29a8bca1408e89755541ecaa897, type: 3} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Materials/logo 2.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: logo 2 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 2800000, guid: 0d342588c0383439e92173c7356b6e4c, type: 3} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0.5 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 0 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 1, g: 1, b: 1, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsGrid/Floor.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Floor 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 0.9, y: 0.9} 40 | m_Offset: {x: 0.03, y: 0.06} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 0.9, y: 0.9} 44 | m_Offset: {x: 0.03, y: 0.06} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _Cutoff: 0.5 60 | - _DetailNormalMapScale: 1 61 | - _DstBlend: 0 62 | - _GlossMapScale: 1 63 | - _Glossiness: 0 64 | - _GlossyReflections: 1 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 1 68 | - _Parallax: 0.02 69 | - _SmoothnessTextureChannel: 1 70 | - _SpecularHighlights: 1 71 | - _SrcBlend: 1 72 | - _UVSec: 0 73 | - _ZWrite: 1 74 | m_Colors: 75 | - _Color: {r: 0.94509804, g: 0.9529412, b: 0.95686275, a: 1} 76 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 77 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/logo.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d342588c0383439e92173c7356b6e4c 3 | timeCreated: 1501268935 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapsPreserveCoverage: 0 16 | alphaTestReferenceValue: 0.5 17 | mipMapFadeDistanceStart: 1 18 | mipMapFadeDistanceEnd: 3 19 | bumpmap: 20 | convertToNormalMap: 0 21 | externalNormalMap: 0 22 | heightScale: 0.25 23 | normalMapFilter: 0 24 | isReadable: 0 25 | grayScaleToAlpha: 0 26 | generateCubemap: 6 27 | cubemapConvolution: 0 28 | seamlessCubemap: 0 29 | textureFormat: 1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | serializedVersion: 2 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapU: 0 37 | wrapV: 0 38 | wrapW: 0 39 | nPOTScale: 0 40 | lightmap: 0 41 | compressionQuality: 50 42 | spriteMode: 1 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaUsage: 1 50 | alphaIsTransparency: 1 51 | spriteTessellationDetail: -1 52 | textureType: 0 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | textureFormat: -1 61 | textureCompression: 1 62 | compressionQuality: 50 63 | crunchedCompression: 0 64 | allowsAlphaSplitting: 0 65 | overridden: 0 66 | - buildTarget: Standalone 67 | maxTextureSize: 2048 68 | textureFormat: -1 69 | textureCompression: 1 70 | compressionQuality: 50 71 | crunchedCompression: 0 72 | allowsAlphaSplitting: 0 73 | overridden: 0 74 | - buildTarget: WebGL 75 | maxTextureSize: 2048 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | spriteSheet: 83 | serializedVersion: 2 84 | sprites: [] 85 | outline: [] 86 | physicsShape: [] 87 | spritePackingTag: 88 | userData: 89 | assetBundleName: 90 | assetBundleVariant: 91 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Materials/logo 1.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: logo 1 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _ALPHAPREMULTIPLY_ON 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: 3000 16 | stringTagMap: 17 | RenderType: Transparent 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 2800000, guid: 0d342588c0383439e92173c7356b6e4c, type: 3} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 10 63 | - _GlossMapScale: 1 64 | - _Glossiness: 1 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 3 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 0 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/UIDefault.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: UIDefault 10 | m_Shader: {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _ColorMask: 15 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _Stencil: 0 74 | - _StencilComp: 8 75 | - _StencilOp: 0 76 | - _StencilReadMask: 255 77 | - _StencilWriteMask: 255 78 | - _UVSec: 0 79 | - _UseUIAlphaClip: 0 80 | - _ZWrite: 1 81 | m_Colors: 82 | - _Color: {r: 1, g: 1, b: 1, a: 1} 83 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 84 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Materials/MaterialsBall/Text.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Text 10 | m_Shader: {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 4 13 | m_EnableInstancingVariants: 0 14 | m_DoubleSidedGI: 0 15 | m_CustomRenderQueue: -1 16 | stringTagMap: {} 17 | disabledShaderPasses: [] 18 | m_SavedProperties: 19 | serializedVersion: 3 20 | m_TexEnvs: 21 | - _BumpMap: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | - _DetailAlbedoMap: 26 | m_Texture: {fileID: 0} 27 | m_Scale: {x: 1, y: 1} 28 | m_Offset: {x: 0, y: 0} 29 | - _DetailMask: 30 | m_Texture: {fileID: 0} 31 | m_Scale: {x: 1, y: 1} 32 | m_Offset: {x: 0, y: 0} 33 | - _DetailNormalMap: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | - _EmissionMap: 38 | m_Texture: {fileID: 0} 39 | m_Scale: {x: 1, y: 1} 40 | m_Offset: {x: 0, y: 0} 41 | - _MainTex: 42 | m_Texture: {fileID: 0} 43 | m_Scale: {x: 1, y: 1} 44 | m_Offset: {x: 0, y: 0} 45 | - _MetallicGlossMap: 46 | m_Texture: {fileID: 0} 47 | m_Scale: {x: 1, y: 1} 48 | m_Offset: {x: 0, y: 0} 49 | - _OcclusionMap: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | - _ParallaxMap: 54 | m_Texture: {fileID: 0} 55 | m_Scale: {x: 1, y: 1} 56 | m_Offset: {x: 0, y: 0} 57 | m_Floats: 58 | - _BumpScale: 1 59 | - _ColorMask: 15 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _Stencil: 0 74 | - _StencilComp: 8 75 | - _StencilOp: 0 76 | - _StencilReadMask: 255 77 | - _StencilWriteMask: 255 78 | - _UVSec: 0 79 | - _UseUIAlphaClip: 0 80 | - _ZWrite: 1 81 | m_Colors: 82 | - _Color: {r: 1, g: 1, b: 1, a: 1} 83 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 84 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Racket/Racket.obj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17d4dad0a373442b1b5d3e6ac481e5c8 3 | timeCreated: 1502590668 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 21 7 | fileIDToRecycleName: 8 | 100000: default 9 | 100002: //RootNode 10 | 400000: default 11 | 400002: //RootNode 12 | 2300000: default 13 | 3300000: default 14 | 4300000: default 15 | materials: 16 | importMaterials: 1 17 | materialName: 0 18 | materialSearch: 1 19 | animations: 20 | legacyGenerateAnimations: 4 21 | bakeSimulation: 0 22 | resampleCurves: 1 23 | optimizeGameObjects: 0 24 | motionNodeName: 25 | rigImportErrors: 26 | rigImportWarnings: 27 | animationImportErrors: 28 | animationImportWarnings: 29 | animationRetargetingWarnings: 30 | animationDoRetargetingWarnings: 0 31 | animationCompression: 1 32 | animationRotationError: 0.5 33 | animationPositionError: 0.5 34 | animationScaleError: 0.5 35 | animationWrapMode: 0 36 | extraExposedTransformPaths: [] 37 | extraUserProperties: [] 38 | clipAnimations: [] 39 | isReadable: 1 40 | meshes: 41 | lODScreenPercentages: [] 42 | globalScale: 1 43 | meshCompression: 0 44 | addColliders: 0 45 | importVisibility: 1 46 | importBlendShapes: 1 47 | importCameras: 1 48 | importLights: 1 49 | swapUVChannels: 0 50 | generateSecondaryUV: 0 51 | useFileUnits: 1 52 | optimizeMeshForGPU: 1 53 | keepQuads: 0 54 | weldVertices: 1 55 | secondaryUVAngleDistortion: 8 56 | secondaryUVAreaDistortion: 15.000001 57 | secondaryUVHardAngle: 88 58 | secondaryUVPackMargin: 4 59 | useFileScale: 1 60 | tangentSpace: 61 | normalSmoothAngle: 60 62 | normalImportMode: 0 63 | tangentImportMode: 3 64 | normalCalculationMode: 4 65 | importAnimation: 1 66 | copyAvatar: 0 67 | humanDescription: 68 | serializedVersion: 2 69 | human: [] 70 | skeleton: [] 71 | armTwist: 0.5 72 | foreArmTwist: 0.5 73 | upperLegTwist: 0.5 74 | legTwist: 0.5 75 | armStretch: 0.05 76 | legStretch: 0.05 77 | feetSpacing: 0 78 | rootMotionBoneName: 79 | rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} 80 | hasTranslationDoF: 0 81 | hasExtraRoot: 0 82 | skeletonHasParents: 1 83 | lastHumanDescriptionAvatarSource: {instanceID: 0} 84 | animationType: 0 85 | humanoidOversampling: 1 86 | additionalBone: 0 87 | userData: 88 | assetBundleName: 89 | assetBundleVariant: 90 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 42 | type: 0} 43 | m_CustomRenderPipeline: {fileID: 0} 44 | m_TransparencySortMode: 0 45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 46 | m_DefaultRenderingPath: 1 47 | m_DefaultMobileRenderingPath: 1 48 | m_TierSettings: [] 49 | m_LightmapStripping: 0 50 | m_FogStripping: 0 51 | m_InstancingStripping: 0 52 | m_LightmapKeepPlain: 1 53 | m_LightmapKeepDirCombined: 1 54 | m_LightmapKeepDynamicPlain: 1 55 | m_LightmapKeepDynamicDirCombined: 1 56 | m_LightmapKeepShadowMask: 1 57 | m_LightmapKeepSubtractive: 1 58 | m_FogKeepLinear: 1 59 | m_FogKeepExp: 1 60 | m_FogKeepExp2: 1 61 | m_AlbedoSwatchInfos: [] 62 | m_LightsUseLinearIntensity: 0 63 | m_LightsUseColorTemperature: 0 64 | -------------------------------------------------------------------------------- /docs/Limitations-&-Common-Issues.md: -------------------------------------------------------------------------------- 1 | # Limitations and Common Issues 2 | 3 | ## Unity SDK 4 | ### Headless Mode 5 | Currently headless mode is disabled. We hope to address these in a future version of Unity. 6 | 7 | ### Rendering Speed and Synchronization 8 | Currently the speed of the game physics can only be increased to 100x real-time. The Academy also moves in time with FixedUpdate() rather than Update(), so game behavior tied to frame updates may be out of sync. 9 | 10 | ### macOS Metal Support 11 | When running a Unity Environment on macOS using Metal rendering, the application can crash when the lock-screen is open. The solution is to set rendering to OpenGL. This can be done by navigating: `Edit -> Project Settings -> Player`. Clicking on `Other Settings`. Unchecking `Auto Graphics API for Mac`. Setting `OpenGL Core` to be above `Metal` in the priority list. 12 | 13 | ## Python API 14 | 15 | ### Environment Permission Error 16 | 17 | If you directly import your Unity environment without building it in the editor, you might need to give it additionnal permissions to execute it. 18 | 19 | If you receive such a permission error on macOS, run: 20 | 21 | `chmod -R 755 *.app` 22 | 23 | or on Linux: 24 | 25 | `chmod -R 755 *.x86_64` 26 | 27 | On Windows, you can find instructions [here](https://technet.microsoft.com/en-us/library/cc754344(v=ws.11).aspx). 28 | 29 | ### Environment Connection Timeout 30 | 31 | If you are able to launch the environment from `UnityEnvironment` but then recieve a timeout error, there may be a number of possible causes. 32 | * _Cause_: There may be no Brains in your environment which are set to `External`. In this case, the environment will not attempt to communicate with python. _Solution_: Set the train you wish to externally control through the Python API to `External` from the Unity Editor, and rebuild the environment. 33 | * _Cause_: On OSX, the firewall may be preventing communication with the environment. _Solution_: Add the built environment binary to the list of exceptions on the firewall by following instructions [here](https://support.apple.com/en-us/HT201642). 34 | 35 | ### Filename not found 36 | 37 | If you receive a file-not-found error while attempting to launch an environment, ensure that the environment files are in the root repository directory. For example, if there is a sub-folder containing the environment files, those files should be removed from the sub-folder and moved to the root. 38 | 39 | ### Communication port {} still in use 40 | 41 | If you receive an exception `"Couldn't launch new environment because communication port {} is still in use. "`, you can change the worker number in the python script when calling 42 | 43 | `UnityEnvironment(file_name=filename, worker_num=X)` 44 | -------------------------------------------------------------------------------- /docs/Training-on-Amazon-Web-Service.md: -------------------------------------------------------------------------------- 1 | # Training on Amazon Web Service 2 | 3 | This page contains instructions for setting up an EC2 instance on Amazon Web Service for use in training ML-Agents environments. Current limitations of the Unity Engine require that a screen be available to render to. In order to make this possible when training on a remote server, a virtual screen is required. We can do this by installing Xorg and creating a virtual screen. Once installed and created, we can display the Unity environment in the virtual environment, and train as we would on a local machine. 4 | 5 | ## Pre-Configured AMI 6 | A public pre-configured AMI is available with the ID: `ami-30ec184a` in the `us-east-1` region. It was created as a modification of the Amazon Deep Learning [AMI](https://aws.amazon.com/marketplace/pp/B01M0AXXQB). 7 | 8 | ## Configuring your own Instance 9 | Instructions here are adapted from this [Medium post](https://medium.com/towards-data-science/how-to-run-unity-on-amazon-cloud-or-without-monitor-3c10ce022639) on running general Unity applications in the cloud. 10 | 11 | 1. To begin with, you will need an EC2 instance which contains the latest Nvidia drivers, CUDA8, and cuDNN. There are a number of external tutorials which describe this, such as: 12 | * [Getting CUDA 8 to Work With openAI Gym on AWS and Compiling Tensorflow for CUDA 8 Compatibility](https://davidsanwald.github.io/2016/11/13/building-tensorflow-with-gpu-support.html) 13 | * [Installing TensorFlow on an AWS EC2 P2 GPU Instance](http://expressionflow.com/2016/10/09/installing-tensorflow-on-an-aws-ec2-p2-gpu-instance/) 14 | * [Updating Nvidia CUDA to 8.0.x in Ubuntu 16.04 – EC2 Gx instance](https://aichamp.wordpress.com/2016/11/09/updating-nvidia-cuda-to-8-0-x-in-ubuntu-16-04-ec2-gx-instance/) 15 | 2. Move `python` to remote instance. 16 | 2. Install the required packages with `pip install .`. 17 | 3. Run the following commands to install Xorg: 18 | ``` 19 | sudo apt-get update 20 | sudo apt-get install -y xserver-xorg mesa-utils 21 | sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024 22 | ``` 23 | 4. Restart the EC2 instance. 24 | 5. On start-up, run: 25 | ``` 26 | sudo /usr/bin/X :0 & 27 | export DISPLAY=:0 28 | ``` 29 | Depending on how Xorg is configured, you may need to run `sudo killall Xorg` before starting Xorg with the above command. 30 | 6. To ensure the installation was succesful, run `glxgears`. If there are no errors, then Xorg is correctly configured. 31 | 7. There is a bug in _Unity 2017.1_ which requires the uninstallation of `libxrandr2`, which can be removed with `apt-get remove --purge libxrandr2`. This is scheduled to be fixed in 2017.3. 32 | 33 | If all steps worked correctly, upload an example binary built for Linux to the instance, and test it from python with: 34 | ```python 35 | from unityagents import UnityEnvironment 36 | 37 | env = UnityEnvironment(your_env) 38 | ``` 39 | 40 | You should receive a message confirming that the environment was loaded succesfully. 41 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrainHeuristic.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | #if UNITY_EDITOR 6 | using UnityEditor; 7 | #endif 8 | 9 | /// CoreBrain which decides actions using developer-provided Decision.cs script. 10 | public class CoreBrainHeuristic : ScriptableObject, CoreBrain 11 | { 12 | 13 | public Brain brain; 14 | /**< Reference to the brain that uses this CoreBrainHeuristic */ 15 | 16 | public Decision decision; 17 | /**< Reference to the Decision component used to decide the actions */ 18 | 19 | /// Create the reference to the brain 20 | public void SetBrain(Brain b) 21 | { 22 | brain = b; 23 | } 24 | 25 | /// Create the reference to decision 26 | public void InitializeCoreBrain() 27 | { 28 | decision = brain.gameObject.GetComponent(); 29 | } 30 | 31 | /// Uses the Decision Component to decide that action to take 32 | public void DecideAction() 33 | { 34 | if (decision == null) 35 | { 36 | throw new UnityAgentsException("The Brain is set to Heuristic, but no decision script attached to it"); 37 | } 38 | 39 | Dictionary actions = new Dictionary(); 40 | Dictionary new_memories = new Dictionary(); 41 | Dictionary> states = brain.CollectStates(); 42 | Dictionary> observations = brain.CollectObservations(); 43 | Dictionary rewards = brain.CollectRewards(); 44 | Dictionary dones = brain.CollectDones(); 45 | Dictionary old_memories = brain.CollectMemories(); 46 | 47 | foreach (KeyValuePair idAgent in brain.agents) 48 | { 49 | actions.Add(idAgent.Key, decision.Decide( 50 | states[idAgent.Key], 51 | observations[idAgent.Key], 52 | rewards[idAgent.Key], 53 | dones[idAgent.Key], 54 | old_memories[idAgent.Key])); 55 | } 56 | foreach (KeyValuePair idAgent in brain.agents) 57 | { 58 | new_memories.Add(idAgent.Key, decision.MakeMemory( 59 | states[idAgent.Key], 60 | observations[idAgent.Key], 61 | rewards[idAgent.Key], 62 | dones[idAgent.Key], 63 | old_memories[idAgent.Key])); 64 | } 65 | brain.SendActions(actions); 66 | brain.SendMemories(new_memories); 67 | } 68 | 69 | /// Nothing needs to be implemented, the states are collected in DecideAction 70 | public void SendState() 71 | { 72 | 73 | } 74 | 75 | /// Displays an error if no decision component is attached to the brain 76 | public void OnInspector() 77 | { 78 | #if UNITY_EDITOR 79 | if (brain.gameObject.GetComponent() == null) 80 | { 81 | EditorGUILayout.HelpBox("You need to add a 'Decision' component to this gameObject", MessageType.Error); 82 | } 83 | #endif 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at ml-agents@unity3d.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct/ 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | -------------------------------------------------------------------------------- /docs/Example-Environments.md: -------------------------------------------------------------------------------- 1 | # Example Learning Environments 2 | 3 | ### About Example Environments 4 | Unity ML Agents currently contains three example environments which demonstrate various features of the platform. In the coming months more will be added. We are also actively open to adding community contributed environments as examples, as long as they are small, simple, demonstrate a unique feature of the platform, and provide a unique non-trivial challenge to modern RL algorithms. Feel free to submit these environments with a Pull-Request explaining the nature of the environment and task. 5 | 6 | Environments are located in `unity-environment/ML-Agents/Examples`. 7 | 8 | ## 3DBall 9 | 10 | ![Balance Ball](../images/balance.png) 11 | 12 | * Set-up: A balance-ball task, where the agent controls the platform. 13 | * Goal: The agent must balance the platform in order to keep the ball on it for as long as possible. 14 | * Agents: The environment contains 12 agents of the same kind, all linked to a single brain. 15 | * Agent Reward Function: 16 | * +0.1 for every step the ball remains on the platform. 17 | * -1.0 if the ball falls from the platform. 18 | * Brains: One brain with the following state/action space. 19 | * State space: (Continuous) 8 variables corresponding to rotation of platform, and position, rotation, and velocity of ball. 20 | * Action space: (Continuous) Size of 2, with one value corresponding to X-rotation, and the other to Z-rotation. 21 | * Observations: 0 22 | * Reset Parameters: None 23 | 24 | ## GridWorld 25 | 26 | ![GridWorld](../images/gridworld.png) 27 | 28 | * Set-up: A version of the classic grid-world task. Scene contains agent, goal, and obstacles. 29 | * Goal: The agent must navigate the grid to the goal while avoiding the obstacles. 30 | * Agents: The environment contains one agent linked to a single brain. 31 | * Agent Reward Function: 32 | * -0.01 for every step. 33 | * +1.0 if the agent navigates to the goal position of the grid (episode ends). 34 | * -1.0 if the agent navigates to an obstacle (episode ends). 35 | * Brains: One brain with the following state/action space. 36 | * State space: (Continuous) 6 variables corresponding to position of agent and nearest goal and obstacle. 37 | * Action space: (Discrete) Size of 4, corresponding to movement in cardinal directions. 38 | * Observations: One corresponding to top-down view of GridWorld. 39 | * Reset Parameters: Three, corresponding to grid size, number of obstacles, and number of goals. 40 | 41 | 42 | ## Tennis 43 | 44 | ![Tennis](../images/tennis.png) 45 | 46 | * Set-up: Two-player game where agents control rackets to bounce ball over a net. 47 | * Goal: The agents must bounce ball between one another while not dropping or sending ball out of bounds. 48 | * Agents: The environment contains two agent linked to a single brain. 49 | * Agent Reward Function (independent): 50 | * -0.1 To last agent to hit ball before going out of bounds or hitting ground/net (episode ends). 51 | * +0.1 To agent when hitting ball after ball was hit by the other agent. 52 | * +0.1 To agent who didn't hit ball last when ball hits ground. 53 | * Brains: One brain with the following state/action space. 54 | * State space: (Continuous) 6 variables corresponding to position of agent and nearest goal and obstacle. 55 | * Action space: (Discrete) Size of 4, corresponding to movement toward net, away from net, jumping, and no-movement. 56 | * Observations: None 57 | * Reset Parameters: One, corresponding to size of ball. 58 | 59 | -------------------------------------------------------------------------------- /docs/Unity-Agents---Python-API.md: -------------------------------------------------------------------------------- 1 | # Python API 2 | 3 | _Notice: Currently communication between Unity and Python takes place over an open socket without authentication. As such, please make sure that the network where training takes place is secure. This will be addressed in a future release._ 4 | 5 | ## Loading a Unity Environment 6 | 7 | Python-side communication happens through `UnityEnvironment` which is located in `python/unityagents`. To load a Unity environment from a built binary file, put the file in the same directory as `unityagents`. In python, run: 8 | 9 | 10 | ```python 11 | from unityagents import UnityEnvironment 12 | env = UnityEnvironment(file_name=filename, worker_num=0) 13 | ``` 14 | 15 | * `file_name` is the name of the environment binary (located in the root directory of the python project). 16 | * `worker_num` indicates which port to use for communication with the environment. For use in parallel training regimes such as A3C. 17 | 18 | ## Interacting with a Unity Environment 19 | 20 | A BrainInfo object contains the following fields: 21 | 22 | * **`observations`** : A list of 4 dimensional numpy arrays. Matrix n of the list corresponds to the nth observation of the brain. 23 | * **`states`** : A two dimensional numpy array of dimension `(batch size, state size)` if the state space is continuous and `(batch size, state size)` if the state space is discrete. 24 | * **`memories`** : A two dimensional numpy array of dimension `(batch size, memory size)` which corresponds to the memories sent at the previous step. 25 | * **`rewards`** : A list as long as the number of agents using the brain containing the rewards they each obtained at the previous step. 26 | * **`local_done`** : A list as long as the number of agents using the brain containing `done` flags (wether or not the agent is done). 27 | * **`agents`** : A list of the unique ids of the agents using the brain. 28 | 29 | Once loaded, `env` can be used in the following way: 30 | - **Print : `print(str(env))`** 31 | Prints all parameters relevant to the loaded environment and the external brains. 32 | - **Reset : `env.reset(train_model=True, config=None)`** 33 | Send a reset signal to the environment, and provides a dictionary mapping brain names to BrainInfo objects. 34 | - `train_model` indicates whether to run the environment in train (`True`) or test (`False`) mode. 35 | - `config` is an optional dictionary of configuration flags specific to the environment. For more information on adding optional config flags to an environment, see [here](Making-a-new-Unity-Environment.md#implementing-yournameacademy). For generic environments, `config` can be ignored. `config` is a dictionary of strings to floats where the keys are the names of the `resetParameters` and the values are their corresponding float values. 36 | - **Step : `env.step(action, memory=None, value = None)`** 37 | Sends a step signal to the environment using the actions. For each brain : 38 | - `action` can be one dimensional arrays or two dimensional arrays if you have multiple agents per brains. 39 | - `memory` is an optional input that can be used to send a list of floats per agents to be retrieved at the next step. 40 | - `value` is an optional input that be used to send a single float per agent to be displayed if and `AgentMonitor.cs` component is attached to the agent. 41 | 42 | Note that if you have more than one external brain in the environment, you must provide dictionaries from brain names to arrays for `action`, `memory` and `value`. For example: If you have two external brains named `brain1` and `brain2` each with one agent taking two continuous actions, then you can have: 43 | ```python 44 | action = {'brain1':[1.0, 2.0], 'brain2':[3.0,4.0]} 45 | ``` 46 | 47 | Returns a dictionary mapping brain names to BrainInfo objects. 48 | - **Close : `env.close()`** 49 | Sends a shutdown signal to the environment and closes the communication socket. 50 | 51 | -------------------------------------------------------------------------------- /unity-environment/README.md: -------------------------------------------------------------------------------- 1 | # Unity ML - Agents (Editor SDK) 2 | 3 | ![diagram](../images/agents_diagram.png) 4 | 5 | ## Unity Setup 6 | Make sure you have Unity 2017.1 or later installed. Download link available [here](https://store.unity.com/download?ref=update). 7 | 8 | ### Building a Unity Environment 9 | - (1) Open the project in the Unity editor *(If this is not first time running Unity, you'll be able to skip most of these immediate steps, choose directly from the list of recently opened projects and jump directly to )* 10 | - On the initial dialog, choose `Open` on the top options 11 | - On the file dialog, choose `ProjectName` and click `Open` *(It is safe to ignore any warning message about non-matching editor installation")* 12 | - Once the project is open, on the `Project` panel (bottom of the tool), click the top folder for `Assets` 13 | - Double-click the scene icon (Unity logo) to load all game assets 14 | - (2) *File -> Build Settings* 15 | - (3) Choose your target platform: 16 | - (opt) Select “Developer Build” to log debug messages. 17 | - (4) Set architecture: `X86_64` 18 | - (5) Click *Build*: 19 | - Save environment binary to a sub-directory containing the model to use for training *(you may need to click on the down arrow on the file chooser to be able to select that folder)* 20 | 21 | ## Example Projects 22 | The `Examples` subfolder contains a set of example environments to use either as starting points or templates for designing your own environments. 23 | * **3DBalanceBall** - Physics-based game where the agent must rotate a 3D-platform to keep a ball in the air. Supports both discrete and continuous control. 24 | * **GridWorld** - A simple gridworld containing regions which provide positive and negative reward. The agent must learn to move to the rewarding regions (green) and avoid the negatively rewarding ones (red). Supports discrete control. 25 | * **Tennis** - An adversarial game where two agents control rackets, which must be used to bounce a ball back and forth between them. Supports continuous control. 26 | 27 | For more informoation on each of these environments, see this [documentation page](../docs/Example-Environments.md). 28 | 29 | Within `ML-Agents/Template` there also exists: 30 | * **Template** - An empty Unity scene with a single _Academy_, _Brain_, and _Agent_. Designed to be used as a template for new environments. 31 | 32 | ## Agents SDK Package 33 | A link to Unity package containing the Agents SDK for Unity 2017.1 can be downloaded here : 34 | * [ML-Agents package without TensorflowSharp](https://s3.amazonaws.com/unity-agents/ML-AgentsNoPlugin.unitypackage) 35 | * [ML-Agents package with TensorflowSharp](https://s3.amazonaws.com/unity-agents/ML-AgentsWithPlugin.unitypackage) 36 | 37 | For information on the use of each script, see the comments and documentation within the files themselves, or read the [documentation](../../../wiki). 38 | 39 | ## Creating your own Unity Environment 40 | For information on how to create a new Unity Environment, see the walkthrough [here](../docs/Making-a-new-Unity-Environment.md). If you have questions or run into issues, please feel free to create issues through the repo, and we will do our best to address them. 41 | 42 | ## Embedding Models with TensorflowSharp _[Experimental]_ 43 | If you will be using Tensorflow Sharp in Unity, you must: 44 | 45 | 1. Make sure you are using Unity 2017.1 or newer. 46 | 2. Make sure the TensorflowSharp plugin is in your Asset folder. A Plugins folder which includes TF# can be downloaded [here](https://s3.amazonaws.com/unity-agents/TFSharpPlugin.unitypackage). 47 | 3. Go to `Edit` -> `Project Settings` -> `Player` 48 | 4. For each of the platforms you target (**`PC, Mac and Linux Standalone`**, **`iOS`** or **`Android`**): 49 | 1. Go into `Other Settings`. 50 | 2. Select `Scripting Runtime Version` to `Experimental (.NET 4.6 Equivalent)` 51 | 3. In `Scripting Defined Symbols`, add the flag `ENABLE_TENSORFLOW` 52 | 5. Restart the Unity Editor. 53 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | public class TennisAgent : Agent 7 | { 8 | [Header("Specific to Tennis")] 9 | public GameObject ball; 10 | public bool invertX; 11 | public float invertMult; 12 | public int score; 13 | public GameObject scoreText; 14 | 15 | public override List CollectState() 16 | { 17 | List state = new List(); 18 | state.Add(invertMult * gameObject.transform.position.x / 8f); 19 | state.Add(gameObject.transform.position.y / 2f); 20 | state.Add(invertMult * gameObject.GetComponent().velocity.x / 10f); 21 | state.Add(gameObject.GetComponent().velocity.y / 10f); 22 | 23 | state.Add(invertMult * ball.transform.position.x / 8f); 24 | state.Add(ball.transform.position.y / 8f); 25 | state.Add(invertMult * ball.GetComponent().velocity.x / 10f); 26 | state.Add(ball.GetComponent().velocity.y / 10f); 27 | return state; 28 | } 29 | 30 | // to be implemented by the developer 31 | public override void AgentStep(float[] act) 32 | { 33 | float moveX = 0.0f; 34 | float moveY = 0.0f; 35 | if (act[0] == 0f) 36 | { 37 | moveX = invertMult * -0.25f; 38 | } 39 | if (act[0] == 1f) 40 | { 41 | moveX = invertMult * 0.25f; 42 | } 43 | if (act[0] == 2f) 44 | { 45 | moveX = 0.0f; 46 | } 47 | if (act[0] == 3f) 48 | { 49 | moveY = 0.5f; 50 | } 51 | 52 | if (gameObject.transform.position.y > -1.9f) 53 | { 54 | moveY = 0f; 55 | } 56 | else 57 | { 58 | gameObject.GetComponent().velocity = new Vector3(0f, moveY * 12f, 0f); 59 | } 60 | 61 | gameObject.transform.position = new Vector3(gameObject.transform.position.x + moveX, gameObject.transform.position.y, 5f); 62 | 63 | if (invertX) 64 | { 65 | if (gameObject.transform.position.x > -(invertMult) * 11f) 66 | { 67 | gameObject.transform.position = new Vector3(-(invertMult) * 11f, gameObject.transform.position.y, 5f); 68 | } 69 | if (gameObject.transform.position.x < -(invertMult) * 2f) 70 | { 71 | gameObject.transform.position = new Vector3(-(invertMult) * 2f, gameObject.transform.position.y, 5f); 72 | } 73 | } 74 | else 75 | { 76 | if (gameObject.transform.position.x < -(invertMult) * 11f) 77 | { 78 | gameObject.transform.position = new Vector3(-(invertMult) * 11f, gameObject.transform.position.y, 5f); 79 | } 80 | if (gameObject.transform.position.x > -(invertMult) * 2f) 81 | { 82 | gameObject.transform.position = new Vector3(-(invertMult) * 2f, gameObject.transform.position.y, 5f); 83 | } 84 | } 85 | if (gameObject.transform.position.y < -2f) 86 | { 87 | gameObject.transform.position = new Vector3(gameObject.transform.position.x, -2f, 5f); 88 | } 89 | 90 | scoreText.GetComponent().text = score.ToString(); 91 | } 92 | 93 | // to be implemented by the developer 94 | public override void AgentReset() 95 | { 96 | if (invertX) 97 | { 98 | invertMult = -1f; 99 | } 100 | else 101 | { 102 | invertMult = 1f; 103 | } 104 | 105 | gameObject.transform.position = new Vector3(-(invertMult) * 7f, -1.5f, 5f); 106 | gameObject.GetComponent().velocity = new Vector3(0f, 0f, 0f); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/Tennis/Scripts/hitWall.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class hitWall : MonoBehaviour 6 | { 7 | 8 | int lastAgentHit; 9 | 10 | // Use this for initialization 11 | void Start() 12 | { 13 | lastAgentHit = -1; 14 | } 15 | 16 | // Update is called once per frame 17 | void Update() 18 | { 19 | 20 | } 21 | 22 | private void OnCollisionEnter(Collision collision) 23 | { 24 | TennisAgent agentA = GameObject.Find("AgentA").GetComponent(); 25 | TennisAgent agentB = GameObject.Find("AgentB").GetComponent(); 26 | TennisAcademy academy = GameObject.Find("Academy").GetComponent(); 27 | 28 | if (collision.gameObject.tag == "iWall") 29 | { 30 | academy.done = true; 31 | if (collision.gameObject.name == "wallA") 32 | { 33 | if (lastAgentHit == 0) 34 | { 35 | agentA.reward = -0.1f; 36 | agentB.reward = 0; 37 | agentB.score += 1; 38 | } 39 | else 40 | { 41 | agentA.reward = 0; 42 | agentB.reward = -0.1f; 43 | agentA.score += 1; 44 | } 45 | } 46 | else if (collision.gameObject.name == "wallB") 47 | { 48 | if (lastAgentHit == 0) 49 | { 50 | agentA.reward = -0.1f; 51 | agentB.reward = 0; 52 | agentB.score += 1; 53 | } 54 | else 55 | { 56 | agentA.reward = 0; 57 | agentB.reward = -0.1f; 58 | agentA.score += 1; 59 | } 60 | } 61 | else if (collision.gameObject.name == "floorA") 62 | { 63 | if (lastAgentHit != 1) 64 | { 65 | agentA.reward = -0.1f; 66 | agentB.reward = 0; 67 | agentB.score += 1; 68 | } 69 | else 70 | { 71 | agentA.reward = -0.1f; 72 | agentB.reward = 0.1f; 73 | agentB.score += 1; 74 | 75 | } 76 | } 77 | else if (collision.gameObject.name == "floorB") 78 | { 79 | if (lastAgentHit == 0) 80 | { 81 | agentA.reward = 0.1f; 82 | agentB.reward = -0.1f; 83 | agentA.score += 1; 84 | } 85 | else 86 | { 87 | agentA.reward = 0; 88 | agentB.reward = -0.1f; 89 | agentA.score += 1; 90 | } 91 | } 92 | else if (collision.gameObject.name == "net") 93 | { 94 | if (lastAgentHit == 0) 95 | { 96 | agentA.reward = -0.1f; 97 | agentB.reward = 0.0f; 98 | agentB.score += 1; 99 | } 100 | else 101 | { 102 | agentA.reward = 0.0f; 103 | agentB.reward = -0.1f; 104 | agentA.score += 1; 105 | } 106 | } 107 | } 108 | 109 | if (collision.gameObject.tag == "agent") 110 | { 111 | if (collision.gameObject.name == "AgentA") 112 | { 113 | if (lastAgentHit != 0) 114 | { 115 | agentA.reward = 0.1f; 116 | agentB.reward = 0.05f; 117 | } 118 | lastAgentHit = 0; 119 | } 120 | else 121 | { 122 | if (lastAgentHit != 1) 123 | { 124 | agentB.reward = 0.1f; 125 | agentA.reward = 0.05f; 126 | } 127 | lastAgentHit = 1; 128 | } 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /python/ppo/history.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | history_keys = ['states', 'observations', 'actions', 'rewards', 'action_probs', 'epsilons', 4 | 'value_estimates', 'advantages', 'discounted_returns'] 5 | 6 | 7 | def discount_rewards(r, gamma=0.99, value_next=0.0): 8 | """ 9 | Computes discounted sum of future rewards for use in updating value estimate. 10 | :param r: List of rewards. 11 | :param gamma: Discount factor. 12 | :param value_next: T+1 value estimate for returns calculation. 13 | :return: discounted sum of future rewards as list. 14 | """ 15 | discounted_r = np.zeros_like(r) 16 | running_add = value_next 17 | for t in reversed(range(0, r.size)): 18 | running_add = running_add * gamma + r[t] 19 | discounted_r[t] = running_add 20 | return discounted_r 21 | 22 | 23 | def get_gae(rewards, value_estimates, value_next=0.0, gamma=0.99, lambd=0.95): 24 | """ 25 | Computes generalized advantage estimate for use in updating policy. 26 | :param rewards: list of rewards for time-steps t to T. 27 | :param value_next: Value estimate for time-step T+1. 28 | :param value_estimates: list of value estimates for time-steps t to T. 29 | :param gamma: Discount factor. 30 | :param lambd: GAE weighing factor. 31 | :return: list of advantage estimates for time-steps t to T. 32 | """ 33 | value_estimates = np.asarray(value_estimates.tolist() + [value_next]) 34 | delta_t = rewards + gamma * value_estimates[1:] - value_estimates[:-1] 35 | advantage = discount_rewards(r=delta_t, gamma=gamma*lambd) 36 | return advantage 37 | 38 | 39 | def empty_local_history(agent_dict): 40 | """ 41 | Empties the experience history for a single agent. 42 | :param agent_dict: Dictionary of agent experience history. 43 | :return: Emptied dictionary (except for cumulative_reward and episode_steps). 44 | """ 45 | for key in history_keys: 46 | agent_dict[key] = [] 47 | return agent_dict 48 | 49 | 50 | def vectorize_history(agent_dict): 51 | """ 52 | Converts dictionary of lists into dictionary of numpy arrays. 53 | :param agent_dict: Dictionary of agent experience history. 54 | :return: dictionary of numpy arrays. 55 | """ 56 | for key in history_keys: 57 | agent_dict[key] = np.array(agent_dict[key]) 58 | return agent_dict 59 | 60 | 61 | def empty_all_history(agent_info): 62 | """ 63 | Clears all agent histories and resets reward and episode length counters. 64 | :param agent_info: a BrainInfo object. 65 | :return: an emptied history dictionary. 66 | """ 67 | history_dict = {} 68 | for agent in agent_info.agents: 69 | history_dict[agent] = {} 70 | history_dict[agent] = empty_local_history(history_dict[agent]) 71 | history_dict[agent]['cumulative_reward'] = 0 72 | history_dict[agent]['episode_steps'] = 0 73 | return history_dict 74 | 75 | 76 | def append_history(global_buffer, local_buffer=None): 77 | """ 78 | Appends agent experience history to global history buffer. 79 | :param global_buffer: Global buffer for all agents experiences. 80 | :param local_buffer: Local history for individual agents experiences. 81 | :return: Global buffer with new experiences added. 82 | """ 83 | for key in history_keys: 84 | global_buffer[key] = np.concatenate([global_buffer[key], local_buffer[key]], axis=0) 85 | return global_buffer 86 | 87 | 88 | def set_history(global_buffer, local_buffer=None): 89 | """ 90 | Creates new global_buffer from existing local_buffer 91 | :param global_buffer: Global buffer for all agents experiences. 92 | :param local_buffer: Local history for individual agents experiences. 93 | :return: Global buffer with new experiences. 94 | """ 95 | for key in history_keys: 96 | global_buffer[key] = np.copy(local_buffer[key]) 97 | return global_buffer 98 | 99 | 100 | def shuffle_buffer(global_buffer): 101 | """ 102 | Randomizes experiences in global_buffer 103 | :param global_buffer: training_buffer to randomize. 104 | :return: Randomized buffer 105 | """ 106 | s = np.arange(global_buffer[history_keys[2]].shape[0]) 107 | np.random.shuffle(s) 108 | for key in history_keys: 109 | if len(global_buffer[key]) > 0: 110 | global_buffer[key] = global_buffer[key][s] 111 | return global_buffer 112 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Ball3DAgent : Agent 6 | { 7 | [Header("Specific to Ball3D")] 8 | public GameObject ball; 9 | 10 | public override List CollectState() 11 | { 12 | List state = new List(); 13 | state.Add(gameObject.transform.rotation.z); 14 | state.Add(gameObject.transform.rotation.x); 15 | state.Add((ball.transform.position.x - gameObject.transform.position.x) / 5f); 16 | state.Add((ball.transform.position.y - gameObject.transform.position.y) / 5f); 17 | state.Add((ball.transform.position.z - gameObject.transform.position.z) / 5f); 18 | state.Add(ball.transform.GetComponent().velocity.x / 5f); 19 | state.Add(ball.transform.GetComponent().velocity.y / 5f); 20 | state.Add(ball.transform.GetComponent().velocity.z / 5f); 21 | return state; 22 | } 23 | 24 | // to be implemented by the developer 25 | public override void AgentStep(float[] act) 26 | { 27 | if (brain.brainParameters.actionSpaceType == StateType.continuous) 28 | { 29 | float action_z = act[0]; 30 | if (action_z > 2f) 31 | { 32 | action_z = 2f; 33 | } 34 | if (action_z < -2f) 35 | { 36 | action_z = -2f; 37 | } 38 | if ((gameObject.transform.rotation.z < 0.25f && action_z > 0f) || 39 | (gameObject.transform.rotation.z > -0.25f && action_z < 0f)) 40 | { 41 | gameObject.transform.Rotate(new Vector3(0, 0, 1), action_z); 42 | } 43 | float action_x = act[1]; 44 | if (action_x > 2f) 45 | { 46 | action_x = 2f; 47 | } 48 | if (action_x < -2f) 49 | { 50 | action_x = -2f; 51 | } 52 | if ((gameObject.transform.rotation.x < 0.25f && action_x > 0f) || 53 | (gameObject.transform.rotation.x > -0.25f && action_x < 0f)) 54 | { 55 | gameObject.transform.Rotate(new Vector3(1, 0, 0), action_x); 56 | } 57 | 58 | 59 | if (done == false) 60 | { 61 | reward = 0.1f; 62 | } 63 | } 64 | else 65 | { 66 | int action = (int)act[0]; 67 | if (action == 0 || action == 1) 68 | { 69 | action = (action * 2) - 1; 70 | float changeValue = action * 2f; 71 | if ((gameObject.transform.rotation.z < 0.25f && changeValue > 0f) || 72 | (gameObject.transform.rotation.z > -0.25f && changeValue < 0f)) 73 | { 74 | gameObject.transform.Rotate(new Vector3(0, 0, 1), changeValue); 75 | } 76 | } 77 | if (action == 2 || action == 3) 78 | { 79 | action = ((action - 2) * 2) - 1; 80 | float changeValue = action * 2f; 81 | if ((gameObject.transform.rotation.x < 0.25f && changeValue > 0f) || 82 | (gameObject.transform.rotation.x > -0.25f && changeValue < 0f)) 83 | { 84 | gameObject.transform.Rotate(new Vector3(1, 0, 0), changeValue); 85 | } 86 | } 87 | if (done == false) 88 | { 89 | reward = 0.1f; 90 | } 91 | } 92 | if ((ball.transform.position.y - gameObject.transform.position.y) < -2f || 93 | Mathf.Abs(ball.transform.position.x - gameObject.transform.position.x) > 3f || 94 | Mathf.Abs(ball.transform.position.z - gameObject.transform.position.z) > 3f) 95 | { 96 | done = true; 97 | reward = -1f; 98 | } 99 | 100 | } 101 | 102 | // to be implemented by the developer 103 | public override void AgentReset() 104 | { 105 | gameObject.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); 106 | gameObject.transform.Rotate(new Vector3(1, 0, 0), Random.Range(-10f, 10f)); 107 | gameObject.transform.Rotate(new Vector3(0, 0, 1), Random.Range(-10f, 10f)); 108 | ball.GetComponent().velocity = new Vector3(0f, 0f, 0f); 109 | ball.transform.position = new Vector3(Random.Range(-1.5f, 1.5f), 4f, Random.Range(-1.5f, 1.5f)) + gameObject.transform.position; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAcademy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using UnityEngine.UI; 6 | using System.Linq; 7 | using Newtonsoft.Json; 8 | using System.Net; 9 | using System.Net.Sockets; 10 | using System.Text; 11 | 12 | public class GridAcademy : Academy 13 | { 14 | [HideInInspector] 15 | public List actorObjs; 16 | [HideInInspector] 17 | public string[] players; 18 | [HideInInspector] 19 | public GameObject trueAgent; 20 | [HideInInspector] 21 | public GameObject visualAgent; 22 | 23 | public override void InitializeAcademy() 24 | { 25 | 26 | } 27 | 28 | public void SetEnvironment() 29 | { 30 | trueAgent = GameObject.Find("trueAgent"); 31 | List playersList = new List(); 32 | actorObjs = new List(); 33 | for (int i = 0; i < (int)resetParameters["numObstacles"]; i++) 34 | { 35 | playersList.Add("pit"); 36 | } 37 | playersList.Add("agent"); 38 | 39 | for (int i = 0; i < (int)resetParameters["numGoals"]; i++) 40 | { 41 | playersList.Add("goal"); 42 | } 43 | players = playersList.ToArray(); 44 | Camera cam = GameObject.Find("Main Camera").GetComponent(); 45 | 46 | cam.transform.position = new Vector3(-((int)resetParameters["gridSize"] - 1) / 2f, (int)resetParameters["gridSize"] * 1.25f, -((int)resetParameters["gridSize"] - 1) / 2f); 47 | cam.orthographicSize = ((int)resetParameters["gridSize"] + 5f) / 2f; 48 | GameObject.Find("Plane").transform.localScale = new Vector3((int)resetParameters["gridSize"] / 10.0f, 1f, (int)resetParameters["gridSize"] / 10.0f); 49 | GameObject.Find("Plane").transform.position = new Vector3(((int)resetParameters["gridSize"] - 1) / 2f, -0.5f, ((int)resetParameters["gridSize"] - 1) / 2f); 50 | GameObject.Find("sN").transform.localScale = new Vector3(1, 1, (int)resetParameters["gridSize"] + 2); 51 | GameObject.Find("sS").transform.localScale = new Vector3(1, 1, (int)resetParameters["gridSize"] + 2); 52 | GameObject.Find("sN").transform.position = new Vector3(((int)resetParameters["gridSize"] - 1) / 2f, 0.0f, (int)resetParameters["gridSize"]); 53 | GameObject.Find("sS").transform.position = new Vector3(((int)resetParameters["gridSize"] - 1) / 2f, 0.0f, -1); 54 | GameObject.Find("sE").transform.localScale = new Vector3(1, 1, (int)resetParameters["gridSize"] + 2); 55 | GameObject.Find("sW").transform.localScale = new Vector3(1, 1, (int)resetParameters["gridSize"] + 2); 56 | GameObject.Find("sE").transform.position = new Vector3((int)resetParameters["gridSize"], 0.0f, ((int)resetParameters["gridSize"] - 1) / 2f); 57 | GameObject.Find("sW").transform.position = new Vector3(-1, 0.0f, ((int)resetParameters["gridSize"] - 1) / 2f); 58 | Camera aCam = GameObject.Find("agentCam").GetComponent(); 59 | aCam.orthographicSize = ((int)resetParameters["gridSize"]) / 2f; 60 | aCam.transform.position = new Vector3(((int)resetParameters["gridSize"] - 1) / 2f, (int)resetParameters["gridSize"] + 1f, ((int)resetParameters["gridSize"] - 1) / 2f); 61 | 62 | } 63 | 64 | public override void AcademyReset() 65 | { 66 | foreach (GameObject actor in actorObjs) 67 | { 68 | DestroyImmediate(actor); 69 | } 70 | SetEnvironment(); 71 | 72 | actorObjs = new List(); 73 | 74 | HashSet numbers = new HashSet(); 75 | while (numbers.Count < players.Length) 76 | { 77 | numbers.Add(Random.Range(0, (int)resetParameters["gridSize"] * (int)resetParameters["gridSize"])); 78 | } 79 | int[] numbersA = Enumerable.ToArray(numbers); 80 | 81 | for (int i = 0; i < players.Length; i++) 82 | { 83 | int x = (numbersA[i]) / (int)resetParameters["gridSize"]; 84 | int y = (numbersA[i]) % (int)resetParameters["gridSize"]; 85 | GameObject actorObj = (GameObject)GameObject.Instantiate(Resources.Load(players[i])); 86 | actorObj.transform.position = new Vector3(x, -0.25f, y); 87 | actorObj.name = players[i]; 88 | actorObjs.Add(actorObj); 89 | if (players[i] == "agent") 90 | { 91 | trueAgent.transform.position = actorObj.transform.position; 92 | trueAgent.transform.rotation = actorObj.transform.rotation; 93 | visualAgent = actorObj; 94 | } 95 | } 96 | 97 | } 98 | 99 | public override void AcademyStep() 100 | { 101 | 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Scripts/CoreBrainPlayer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | #if UNITY_EDITOR 6 | using UnityEditor; 7 | #endif 8 | 9 | 10 | /// CoreBrain which decides actions using Player input. 11 | public class CoreBrainPlayer : ScriptableObject, CoreBrain 12 | { 13 | 14 | [System.Serializable] 15 | private struct DiscretePlayerAction 16 | { 17 | public KeyCode key; 18 | public int value; 19 | } 20 | 21 | [System.Serializable] 22 | private struct ContinuousPlayerAction 23 | { 24 | public KeyCode key; 25 | public int index; 26 | public float value; 27 | } 28 | 29 | [SerializeField] 30 | /// Contains the mapping from input to continuous actions 31 | private ContinuousPlayerAction[] continuousPlayerActions; 32 | [SerializeField] 33 | /// Contains the mapping from input to discrete actions 34 | private DiscretePlayerAction[] discretePlayerActions; 35 | [SerializeField] 36 | private int defaultAction = -1; 37 | 38 | /// Reference to the brain that uses this CoreBrainPlayer 39 | public Brain brain; 40 | 41 | /// Create the reference to the brain 42 | public void SetBrain(Brain b) 43 | { 44 | brain = b; 45 | } 46 | 47 | /// Nothing to implement 48 | public void InitializeCoreBrain() 49 | { 50 | 51 | } 52 | 53 | /// Uses the continuous inputs or dicrete inputs of the player to 54 | /// decide action 55 | public void DecideAction() 56 | { 57 | if (brain.brainParameters.actionSpaceType == StateType.continuous) 58 | { 59 | float[] action = new float[brain.brainParameters.actionSize]; 60 | foreach (ContinuousPlayerAction cha in continuousPlayerActions) 61 | { 62 | if (Input.GetKey(cha.key)) 63 | { 64 | action[cha.index] = cha.value; 65 | } 66 | } 67 | Dictionary actions = new Dictionary(); 68 | foreach (KeyValuePair idAgent in brain.agents) 69 | { 70 | actions.Add(idAgent.Key, action); 71 | } 72 | brain.SendActions(actions); 73 | } 74 | else 75 | { 76 | float[] action = new float[1] { defaultAction }; 77 | foreach (DiscretePlayerAction dha in discretePlayerActions) 78 | { 79 | if (Input.GetKey(dha.key)) 80 | { 81 | action[0] = (float)dha.value; 82 | break; 83 | } 84 | } 85 | Dictionary actions = new Dictionary(); 86 | foreach (KeyValuePair idAgent in brain.agents) 87 | { 88 | actions.Add(idAgent.Key, action); 89 | } 90 | brain.SendActions(actions); 91 | } 92 | } 93 | 94 | /// Nothing to implement, the Player does not use the state to make 95 | /// decisions 96 | public void SendState() 97 | { 98 | 99 | } 100 | 101 | /// Displays continuous or discrete input mapping in the inspector 102 | public void OnInspector() 103 | { 104 | #if UNITY_EDITOR 105 | EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); 106 | SerializedObject serializedBrain = new SerializedObject(this); 107 | if (brain.brainParameters.actionSpaceType == StateType.continuous) 108 | { 109 | GUILayout.Label("Edit the continuous inputs for you actions", EditorStyles.boldLabel); 110 | SerializedProperty chas = serializedBrain.FindProperty("continuousPlayerActions"); 111 | serializedBrain.Update(); 112 | EditorGUILayout.PropertyField(chas, true); 113 | serializedBrain.ApplyModifiedProperties(); 114 | if (continuousPlayerActions == null) 115 | { 116 | continuousPlayerActions = new ContinuousPlayerAction[0]; 117 | } 118 | foreach (ContinuousPlayerAction cha in continuousPlayerActions) 119 | { 120 | if (cha.index >= brain.brainParameters.actionSize) 121 | { 122 | EditorGUILayout.HelpBox(string.Format("Key {0} is assigned to index {1} but the action size is only of size {2}" 123 | , cha.key.ToString(), cha.index.ToString(), brain.brainParameters.actionSize.ToString()), MessageType.Error); 124 | } 125 | } 126 | 127 | } 128 | else 129 | { 130 | GUILayout.Label("Edit the discrete inputs for you actions", EditorStyles.boldLabel); 131 | defaultAction = EditorGUILayout.IntField("Default Action", defaultAction); 132 | SerializedProperty dhas = serializedBrain.FindProperty("discretePlayerActions"); 133 | serializedBrain.Update(); 134 | EditorGUILayout.PropertyField(dhas, true); 135 | serializedBrain.ApplyModifiedProperties(); 136 | } 137 | #endif 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /docs/Agents-Editor-Interface.md: -------------------------------------------------------------------------------- 1 | # ML Agents Editor Interface 2 | 3 | This page contains an explanation of the use of each of the inspector panels relating to the `Academy`, `Brain`, and `Agent` objects. 4 | 5 | ## Academy 6 | 7 | ![Academy Inspector](../images/academy.png) 8 | 9 | * `Max Steps` - Total number of steps per-episode. `0` corresponds to episodes without a maximum number 10 | of steps. Once the step counter reaches maximum, the environment will reset. 11 | * `Frames To Skip` - How many steps of the environment to skip before asking Brains for decisions. 12 | * `Wait Time` - How many seconds to wait between steps when running in `Inference`. 13 | * `Configuration` - The engine-level settings which correspond to rendering quality and engine speed. 14 | * `Width` - Width of the environment window in pixels. 15 | * `Height` - Width of the environment window in pixels. 16 | * `Quality Level` - Rendering quality of environment. (Higher is better) 17 | * `Time Scale` - Speed at which environment is run. (Higher is faster) 18 | * `Target Frame Rate` - FPS engine attempts to maintain. 19 | * `Default Reset Parameters` - List of custom parameters that can be changed in the environment on reset. 20 | 21 | ## Brain 22 | 23 | ![Brain Inspector](../images/brain.png) 24 | 25 | * `Brain Parameters` - Define state, observation, and action spaces for the Brain. 26 | * `State Size` - Length of state vector for brain (In _Continuous_ state space). Or number of possible 27 | values (in _Discrete_ state space). 28 | * `Action Size` - Length of action vector for brain (In _Continuous_ state space). Or number of possible 29 | values (in _Discrete_ action space). 30 | * `Memory Size` - Length of memory vector for brain. Used with Recurrent networks and frame-stacking CNNs. 31 | * `Camera Resolution` - Describes height, width, and whether to greyscale visual observations for the Brain. 32 | * `Action Descriptions` - A list of strings used to name the available actions for the Brain. 33 | * `State Space Type` - Corresponds to whether state vector contains a single integer (Discrete) or a series of real-valued floats (Continuous). 34 | * `Action Space Type` - Corresponds to whether action vector contains a single integer (Discrete) or a series of real-valued floats (Continuous). 35 | * `Type of Brain` - Describes how Brain will decide actions. 36 | * `External` - Actions are decided using Python API. 37 | * `Internal` - Actions are decided using internal TensorflowSharp model. 38 | * `Player` - Actions are decided using Player input mappings. 39 | * `Heuristic` - Actions are decided using custom `Decision` script, which should be attached to the Brain game object. 40 | 41 | ### Internal Brain 42 | 43 | ![Internal Brain Inspector](../images/internal_brain.png) 44 | 45 | * `Graph Model` : This must be the `bytes` file corresponding to the pretrained Tensorflow graph. (You must first drag this file into your Resources folder and then from the Resources folder into the inspector) 46 | * `Graph Scope` : If you set a scope while training your tensorflow model, all your placeholder name will have a prefix. You must specify that prefix here. 47 | * `Batch Size Node Name` : If the batch size is one of the inputs of your graph, you must specify the name if the placeholder here. The brain will make the batch size equal to the number of agents connected to the brain automatically. 48 | * `State Node Name` : If your graph uses the state as an input, you must specify the name if the placeholder here. 49 | * `Recurrent Input Node Name` : If your graph uses a recurrent input / memory as input and outputs new recurrent input / memory, you must specify the name if the input placeholder here. 50 | * `Recurrent Output Node Name` : If your graph uses a recurrent input / memory as input and outputs new recurrent input / memory, you must specify the name if the output placeholder here. 51 | * `Observation Placeholder Name` : If your graph uses observations as input, you must specify it here. Note that the number of observations is equal to the length of `Camera Resolutions` in the brain parameters. 52 | * `Action Node Name` : Specify the name of the placeholder corresponding to the actions of the brain in your graph. If the action space type is continuous, the output must be a one dimensional tensor of float of length `Action Space Size`, if the action space type is discrete, the output must be a one dimensional tensor of int of length 1. 53 | * `Graph Placeholder` : If your graph takes additional inputs that are fixed (example: noise level) you can specify them here. Note that in your graph, these must correspond to one dimensional tensors of int or float of size 1. 54 | * `Name` : Corresponds to the name of the placeholdder. 55 | * `Value Type` : Either Integer or Floating Point. 56 | * `Min Value` and `Max Value` : Specify the range of the value here. The value will be sampled from the uniform distribution ranging from `Min Value` to `Max Value` inclusive. 57 | 58 | 59 | ### Player Brain 60 | 61 | ![Player Brain Inspector](../images/player_brain.png) 62 | 63 | If the action space is discrete, you must map input keys to their corresponding integer values. If the action space is continuous, you must map input keys to their corresponding indices and float values. 64 | 65 | ## Agent 66 | 67 | ![Agent Inspector](../images/agent.png) 68 | 69 | * `Brain` - The brain to register this agent to. Can be dragged into the inspector using the Editor. 70 | * `Observations` - A list of `Cameras` which will be used to generate observations. 71 | * `Max Step` - The per-agent maximum number of steps. Once this number is reached, the agent will be reset if `Reset On Done` is checked. 72 | -------------------------------------------------------------------------------- /unity-environment/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Samsung TV: 2 185 | Standalone: 5 186 | Tizen: 2 187 | Web: 5 188 | WebGL: 3 189 | WiiU: 5 190 | Windows Store Apps: 5 191 | XboxOne: 5 192 | iPhone: 2 193 | tvOS: 2 194 | -------------------------------------------------------------------------------- /python/test_unityagents.py: -------------------------------------------------------------------------------- 1 | import mock 2 | import numpy as np 3 | import os 4 | import pytest 5 | import socket 6 | import mock 7 | 8 | from unityagents import UnityEnvironment, UnityEnvironmentException, UnityActionException, BrainInfo, BrainParameters 9 | 10 | dummy_start = '''{ 11 | "AcademyName": "RealFakeAcademy", 12 | "resetParameters": {}, 13 | "brainNames": ["RealFakeBrain"], 14 | "brainParameters": [{ 15 | "stateSize": 3, 16 | "actionSize": 2, 17 | "memorySize": 0, 18 | "cameraResolutions": [], 19 | "actionDescriptions": ["",""], 20 | "actionSpaceType": 1, 21 | "stateSpaceType": 1 22 | }] 23 | }'''.encode() 24 | 25 | dummy_reset = [ 26 | 'CONFIG_REQUEST'.encode(), 27 | ''' 28 | { 29 | "brain_name": "RealFakeBrain", 30 | "agents": [1,2], 31 | "states": [1,2,3,4,5,6], 32 | "rewards": [1,2], 33 | "actions": null, 34 | "memories": [], 35 | "dones": [false, false] 36 | }'''.encode(), 37 | 'False'.encode()] 38 | 39 | dummy_step = ['actions'.encode(), 40 | ''' 41 | { 42 | "brain_name": "RealFakeBrain", 43 | "agents": [1,2,3], 44 | "states": [1,2,3,4,5,6,7,8,9], 45 | "rewards": [1,2,3], 46 | "actions": null, 47 | "memories": [], 48 | "dones": [false, false, false] 49 | }'''.encode(), 50 | 'False'.encode(), 51 | 'actions'.encode(), 52 | ''' 53 | { 54 | "brain_name": "RealFakeBrain", 55 | "agents": [1,2,3], 56 | "states": [1,2,3,4,5,6,7,8,9], 57 | "rewards": [1,2,3], 58 | "actions": null, 59 | "memories": [], 60 | "dones": [false, false, true] 61 | }'''.encode(), 62 | 'True'.encode()] 63 | 64 | 65 | def test_handles_bad_filename(): 66 | with pytest.raises(UnityEnvironmentException): 67 | UnityEnvironment(' ') 68 | 69 | def test_initialialization(): 70 | with mock.patch('subprocess.Popen') as mock_subproc_popen: 71 | with mock.patch('socket.socket') as mock_socket: 72 | mock_socket.return_value.accept.return_value = (mock_socket, 0) 73 | mock_socket.recv.return_value.decode.return_value = dummy_start 74 | env = UnityEnvironment(' ') 75 | with pytest.raises(UnityActionException): 76 | env.step([0]) 77 | assert env.brain_names[0] == 'RealFakeBrain' 78 | env.close() 79 | 80 | 81 | def test_reset(): 82 | with mock.patch('subprocess.Popen') as mock_subproc_popen: 83 | with mock.patch('socket.socket') as mock_socket: 84 | mock_socket.return_value.accept.return_value = (mock_socket, 0) 85 | mock_socket.recv.return_value.decode.return_value = dummy_start 86 | env = UnityEnvironment(' ') 87 | brain = env.brains['RealFakeBrain'] 88 | mock_socket.recv.side_effect = dummy_reset 89 | brain_info = env.reset() 90 | env.close() 91 | assert not env.global_done 92 | assert isinstance(brain_info, dict) 93 | assert isinstance(brain_info['RealFakeBrain'], BrainInfo) 94 | assert isinstance(brain_info['RealFakeBrain'].observations, list) 95 | assert isinstance(brain_info['RealFakeBrain'].states, np.ndarray) 96 | assert len(brain_info['RealFakeBrain'].observations) == brain.number_observations 97 | assert brain_info['RealFakeBrain'].states.shape[0] == len(brain_info['RealFakeBrain'].agents) 98 | assert brain_info['RealFakeBrain'].states.shape[1] == brain.state_space_size 99 | 100 | 101 | def test_step(): 102 | with mock.patch('subprocess.Popen') as mock_subproc_popen: 103 | with mock.patch('socket.socket') as mock_socket: 104 | mock_socket.return_value.accept.return_value = (mock_socket, 0) 105 | mock_socket.recv.return_value.decode.return_value = dummy_start 106 | env = UnityEnvironment(' ') 107 | brain = env.brains['RealFakeBrain'] 108 | mock_socket.recv.side_effect = dummy_reset 109 | brain_info = env.reset() 110 | mock_socket.recv.side_effect = dummy_step 111 | brain_info = env.step([0] * brain.action_space_size * len(brain_info['RealFakeBrain'].agents)) 112 | with pytest.raises(UnityActionException): 113 | env.step([0]) 114 | brain_info = env.step([0] * brain.action_space_size * len(brain_info['RealFakeBrain'].agents)) 115 | with pytest.raises(UnityActionException): 116 | env.step([0] * brain.action_space_size * len(brain_info['RealFakeBrain'].agents)) 117 | env.close() 118 | assert env.global_done 119 | assert isinstance(brain_info, dict) 120 | assert isinstance(brain_info['RealFakeBrain'], BrainInfo) 121 | assert isinstance(brain_info['RealFakeBrain'].observations, list) 122 | assert isinstance(brain_info['RealFakeBrain'].states, np.ndarray) 123 | assert len(brain_info['RealFakeBrain'].observations) == brain.number_observations 124 | assert brain_info['RealFakeBrain'].states.shape[0] == len(brain_info['RealFakeBrain'].agents) 125 | assert brain_info['RealFakeBrain'].states.shape[1] == brain.state_space_size 126 | assert not brain_info['RealFakeBrain'].local_done[0] 127 | assert brain_info['RealFakeBrain'].local_done[2] 128 | 129 | 130 | 131 | 132 | def test_close(): 133 | with mock.patch('subprocess.Popen') as mock_subproc_popen: 134 | with mock.patch('socket.socket') as mock_socket: 135 | mock_socket.return_value.accept.return_value = (mock_socket, 0) 136 | mock_socket.recv.return_value.decode.return_value = dummy_start 137 | env = UnityEnvironment(' ') 138 | assert env._loaded 139 | env.close() 140 | assert not env._loaded 141 | mock_socket.close.assert_called_once() 142 | 143 | 144 | 145 | if __name__ == '__main__': 146 | pytest.main() 147 | -------------------------------------------------------------------------------- /unity-environment/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | using UnityEngine.UI; 6 | using System.Linq; 7 | using Newtonsoft.Json; 8 | using System.Net; 9 | using System.Net.Sockets; 10 | using System.Text; 11 | 12 | public class GridAgent : Agent 13 | { 14 | [Header("Specific to GridWorld")] 15 | public GridAcademy academy; 16 | [HideInInspector] 17 | public int gridSize; 18 | 19 | GameObject trueAgent; 20 | 21 | public override void InitializeAgent() 22 | { 23 | trueAgent = gameObject; 24 | gridSize = (int)academy.resetParameters["gridSize"]; 25 | } 26 | 27 | public override List CollectState() 28 | { 29 | int closestGoalDistance = 2 * (int)academy.resetParameters["gridSize"]; 30 | GameObject currentClosestGoal = academy.actorObjs[0]; 31 | int closestPitDistance = 2 * (int)academy.resetParameters["gridSize"]; 32 | GameObject currentClosestPit = academy.actorObjs[0]; 33 | GameObject agent = academy.actorObjs[0]; 34 | List state = new List(); 35 | foreach (GameObject actor in academy.actorObjs) 36 | { 37 | if (actor.tag == "agent") 38 | { 39 | agent = actor; 40 | state.Add(actor.transform.position.x / (gridSize + 1)); 41 | state.Add(actor.transform.position.z / (gridSize + 1)); 42 | continue; 43 | } 44 | } 45 | foreach (GameObject actor in academy.actorObjs) 46 | { 47 | if (actor.tag == "goal") 48 | { 49 | int distance = (int)Mathf.Abs(agent.transform.position.x - actor.transform.position.x) + (int)Mathf.Abs(agent.transform.position.z - actor.transform.position.z); 50 | if (closestGoalDistance > distance) 51 | { 52 | closestGoalDistance = distance; 53 | currentClosestGoal = actor; 54 | } 55 | } 56 | if (actor.tag == "pit") 57 | { 58 | int distance = (int)Mathf.Abs(agent.transform.position.x - actor.transform.position.x) + (int)Mathf.Abs(agent.transform.position.z - actor.transform.position.z); 59 | if (closestPitDistance > distance) 60 | { 61 | closestPitDistance = distance; 62 | currentClosestPit = actor; 63 | } 64 | } 65 | } 66 | 67 | state.Add(currentClosestGoal.transform.position.x / (gridSize + 1)); 68 | state.Add(currentClosestGoal.transform.position.z / (gridSize + 1)); 69 | state.Add(currentClosestPit.transform.position.x / (gridSize + 1)); 70 | state.Add(currentClosestPit.transform.position.z / (gridSize + 1)); 71 | 72 | return state; 73 | } 74 | 75 | // to be implemented by the developer 76 | public override void AgentStep(float[] act) 77 | { 78 | 79 | reward = -0.01f; 80 | int action = Mathf.FloorToInt(act[0]); 81 | 82 | // 0 - Forward, 1 - Backward, 2 - Left, 3 - Right 83 | if (action == 3) 84 | { 85 | Collider[] blockTest = Physics.OverlapBox(new Vector3(trueAgent.transform.position.x + 1, 0, trueAgent.transform.position.z), new Vector3(0.3f, 0.3f, 0.3f)); 86 | if (blockTest.Where(col => col.gameObject.tag == "wall").ToArray().Length == 0) 87 | { 88 | trueAgent.transform.position = new Vector3(trueAgent.transform.position.x + 1, 0, trueAgent.transform.position.z); 89 | } 90 | } 91 | 92 | if (action == 2) 93 | { 94 | Collider[] blockTest = Physics.OverlapBox(new Vector3(trueAgent.transform.position.x - 1, 0, trueAgent.transform.position.z), new Vector3(0.3f, 0.3f, 0.3f)); 95 | if (blockTest.Where(col => col.gameObject.tag == "wall").ToArray().Length == 0) 96 | { 97 | trueAgent.transform.position = new Vector3(trueAgent.transform.position.x - 1, 0, trueAgent.transform.position.z); 98 | } 99 | } 100 | 101 | if (action == 0) 102 | { 103 | Collider[] blockTest = Physics.OverlapBox(new Vector3(trueAgent.transform.position.x, 0, trueAgent.transform.position.z + 1), new Vector3(0.3f, 0.3f, 0.3f)); 104 | if (blockTest.Where(col => col.gameObject.tag == "wall").ToArray().Length == 0) 105 | { 106 | trueAgent.transform.position = new Vector3(trueAgent.transform.position.x, 0, trueAgent.transform.position.z + 1); 107 | } 108 | } 109 | 110 | if (action == 1) 111 | { 112 | Collider[] blockTest = Physics.OverlapBox(new Vector3(trueAgent.transform.position.x, 0, trueAgent.transform.position.z - 1), new Vector3(0.3f, 0.3f, 0.3f)); 113 | if (blockTest.Where(col => col.gameObject.tag == "wall").ToArray().Length == 0) 114 | { 115 | trueAgent.transform.position = new Vector3(trueAgent.transform.position.x, 0, trueAgent.transform.position.z - 1); 116 | } 117 | } 118 | 119 | Collider[] hitObjects = Physics.OverlapBox(trueAgent.transform.position, new Vector3(0.3f, 0.3f, 0.3f)); 120 | if (hitObjects.Where(col => col.gameObject.tag == "goal").ToArray().Length == 1) 121 | { 122 | reward = 1f; 123 | done = true; 124 | } 125 | if (hitObjects.Where(col => col.gameObject.tag == "pit").ToArray().Length == 1) 126 | { 127 | reward = -1f; 128 | done = true; 129 | } 130 | 131 | //if (trainMode == "train") { 132 | if (true) 133 | { 134 | academy.visualAgent.transform.position = trueAgent.transform.position; 135 | academy.visualAgent.transform.rotation = trueAgent.transform.rotation; 136 | } 137 | } 138 | 139 | // to be implemented by the developer 140 | public override void AgentReset() 141 | { 142 | academy.AcademyReset(); 143 | } 144 | } 145 | --------------------------------------------------------------------------------