├── .gitignore ├── Assets ├── Bitmaps.meta ├── Bitmaps │ ├── stroke.png │ └── stroke.png.meta ├── Brains.meta ├── Brains │ ├── HandwritingBrain.asset │ └── HandwritingBrain.asset.meta ├── Gizmos.meta ├── Gizmos │ ├── HeuristicBrain Icon.png │ ├── HeuristicBrain Icon.png.meta │ ├── LearningBrain Icon.png │ ├── LearningBrain Icon.png.meta │ ├── PlayerBrain Icon.png │ └── PlayerBrain Icon.png.meta ├── ML-Agents.meta ├── ML-Agents │ ├── Editor.meta │ ├── Editor │ │ ├── AgentEditor.cs │ │ ├── AgentEditor.cs.meta │ │ ├── BrainEditor.cs │ │ ├── BrainEditor.cs.meta │ │ ├── BrainParametersDrawer.cs │ │ ├── BrainParametersDrawer.cs.meta │ │ ├── BroadcastHubDrawer.cs │ │ ├── BroadcastHubDrawer.cs.meta │ │ ├── Builder.cs │ │ ├── Builder.cs.meta │ │ ├── BuilderUtils.cs │ │ ├── BuilderUtils.cs.meta │ │ ├── DemonstrationDrawer.cs │ │ ├── DemonstrationDrawer.cs.meta │ │ ├── DemonstrationImporter.cs │ │ ├── DemonstrationImporter.cs.meta │ │ ├── HeuristicBrainEditor.cs │ │ ├── HeuristicBrainEditor.cs.meta │ │ ├── LearningBrainEditor.cs │ │ ├── LearningBrainEditor.cs.meta │ │ ├── PlayerBrainEditor.cs │ │ ├── PlayerBrainEditor.cs.meta │ │ ├── ResetParameterDrawer.cs │ │ ├── ResetParameterDrawer.cs.meta │ │ ├── UnityColors.colors │ │ └── UnityColors.colors.meta │ ├── Plugins.meta │ ├── Plugins │ │ ├── Barracuda.Core.meta │ │ ├── Barracuda.Core │ │ │ ├── Barracuda.md │ │ │ ├── Barracuda.md.meta │ │ │ ├── Barracuda.meta │ │ │ ├── Barracuda │ │ │ │ ├── Barracuda.dll │ │ │ │ ├── Barracuda.dll.meta │ │ │ │ ├── Plugins.meta │ │ │ │ ├── Plugins │ │ │ │ │ ├── Editor.meta │ │ │ │ │ ├── Editor │ │ │ │ │ │ ├── BarracudaEditor.meta │ │ │ │ │ │ └── BarracudaEditor │ │ │ │ │ │ │ ├── Barracuda-editor.asmdef │ │ │ │ │ │ │ ├── Barracuda-editor.asmdef.meta │ │ │ │ │ │ │ ├── NNModelIcon.png │ │ │ │ │ │ │ ├── NNModelIcon.png.meta │ │ │ │ │ │ │ ├── NNModelImporter.cs │ │ │ │ │ │ │ └── NNModelImporter.cs.meta │ │ │ │ │ ├── OSX.meta │ │ │ │ │ ├── OSX │ │ │ │ │ │ ├── MacBLAS.asmdef │ │ │ │ │ │ ├── MacBLAS.asmdef.meta │ │ │ │ │ │ ├── MacBLAS.cs │ │ │ │ │ │ ├── MacBLAS.cs.meta │ │ │ │ │ │ ├── macblas.bundle.meta │ │ │ │ │ │ └── macblas.bundle │ │ │ │ │ │ │ ├── Contents.meta │ │ │ │ │ │ │ └── Contents │ │ │ │ │ │ │ ├── Info.plist │ │ │ │ │ │ │ ├── Info.plist.meta │ │ │ │ │ │ │ ├── MacOS.meta │ │ │ │ │ │ │ ├── MacOS │ │ │ │ │ │ │ ├── macblas │ │ │ │ │ │ │ └── macblas.meta │ │ │ │ │ │ │ ├── _CodeSignature.meta │ │ │ │ │ │ │ └── _CodeSignature │ │ │ │ │ │ │ ├── CodeResources │ │ │ │ │ │ │ └── CodeResources.meta │ │ │ │ │ ├── iOS.meta │ │ │ │ │ └── iOS │ │ │ │ │ │ ├── iOSBLAS.asmdef │ │ │ │ │ │ ├── iOSBLAS.asmdef.meta │ │ │ │ │ │ ├── iOSBLAS.cs │ │ │ │ │ │ ├── iOSBLAS.cs.meta │ │ │ │ │ │ ├── iOSBLAS.mm │ │ │ │ │ │ └── iOSBLAS.mm.meta │ │ │ │ ├── Resources.meta │ │ │ │ └── Resources │ │ │ │ │ ├── Activation.compute │ │ │ │ │ ├── Activation.compute.meta │ │ │ │ │ ├── BarracudaReferenceImpl.compute │ │ │ │ │ ├── BarracudaReferenceImpl.compute.meta │ │ │ │ │ ├── Broadcast.compute │ │ │ │ │ ├── Broadcast.compute.meta │ │ │ │ │ ├── Conv.compute │ │ │ │ │ ├── Conv.compute.meta │ │ │ │ │ ├── ConvOld.compute │ │ │ │ │ ├── ConvOld.compute.meta │ │ │ │ │ ├── Dense.compute │ │ │ │ │ ├── Dense.compute.meta │ │ │ │ │ ├── DenseFP16.compute │ │ │ │ │ ├── DenseFP16.compute.meta │ │ │ │ │ ├── Experimental.compute │ │ │ │ │ ├── Experimental.compute.meta │ │ │ │ │ ├── FastNV.compute │ │ │ │ │ ├── FastNV.compute.meta │ │ │ │ │ ├── Generic.compute │ │ │ │ │ ├── Generic.compute.meta │ │ │ │ │ ├── Random.cginc │ │ │ │ │ ├── Random.cginc.meta │ │ │ │ │ ├── Tensor.cginc │ │ │ │ │ ├── Tensor.cginc.meta │ │ │ │ │ ├── TexConv.compute │ │ │ │ │ └── TexConv.compute.meta │ │ │ ├── LICENSE.md │ │ │ ├── LICENSE.md.meta │ │ │ ├── ReleaseNotes.md │ │ │ ├── ReleaseNotes.md.meta │ │ │ ├── package.json │ │ │ └── package.json.meta │ │ ├── ProtoBuffer.meta │ │ ├── ProtoBuffer │ │ │ ├── Google.Protobuf.dll │ │ │ ├── Google.Protobuf.dll.meta │ │ │ ├── Grpc.Core.dll │ │ │ ├── Grpc.Core.dll.meta │ │ │ ├── System.Interactive.Async.dll │ │ │ ├── System.Interactive.Async.dll.meta │ │ │ ├── runtimes.meta │ │ │ └── runtimes │ │ │ │ ├── linux.meta │ │ │ │ ├── linux │ │ │ │ ├── native.meta │ │ │ │ └── native │ │ │ │ │ ├── libgrpc_csharp_ext.x64.so │ │ │ │ │ ├── libgrpc_csharp_ext.x64.so.meta │ │ │ │ │ ├── libgrpc_csharp_ext.x86.so │ │ │ │ │ └── libgrpc_csharp_ext.x86.so.meta │ │ │ │ ├── osx.meta │ │ │ │ ├── osx │ │ │ │ ├── native.meta │ │ │ │ └── native │ │ │ │ │ ├── libgrpc_csharp_ext.x64.bundle │ │ │ │ │ └── libgrpc_csharp_ext.x64.bundle.meta │ │ │ │ ├── win.meta │ │ │ │ └── win │ │ │ │ ├── native.meta │ │ │ │ └── native │ │ │ │ ├── grpc_csharp_ext.x64.dll │ │ │ │ ├── grpc_csharp_ext.x64.dll.meta │ │ │ │ ├── grpc_csharp_ext.x86.dll │ │ │ │ └── grpc_csharp_ext.x86.dll.meta │ │ ├── System.IO.Abstractions.TestingHelpers.dll │ │ ├── System.IO.Abstractions.TestingHelpers.dll.meta │ │ ├── System.IO.Abstractions.dll │ │ └── System.IO.Abstractions.dll.meta │ ├── Resources.meta │ ├── Resources │ │ ├── DemoIcon.png │ │ └── DemoIcon.png.meta │ ├── Scripts.meta │ └── Scripts │ │ ├── Academy.cs │ │ ├── Academy.cs.meta │ │ ├── ActionMasker.cs │ │ ├── ActionMasker.cs.meta │ │ ├── Agent.cs │ │ ├── Agent.cs.meta │ │ ├── BCTeacherHelper.cs │ │ ├── BCTeacherHelper.cs.meta │ │ ├── Batcher.cs │ │ ├── Batcher.cs.meta │ │ ├── Brain.cs │ │ ├── Brain.cs.meta │ │ ├── BrainParameters.cs │ │ ├── BrainParameters.cs.meta │ │ ├── BroadcastHub.cs │ │ ├── BroadcastHub.cs.meta │ │ ├── CommunicatorObjects.meta │ │ ├── CommunicatorObjects │ │ ├── AgentActionProto.cs │ │ ├── AgentActionProto.cs.meta │ │ ├── AgentInfoProto.cs │ │ ├── AgentInfoProto.cs.meta │ │ ├── BrainParametersProto.cs │ │ ├── BrainParametersProto.cs.meta │ │ ├── CommandProto.cs │ │ ├── CommandProto.cs.meta │ │ ├── CustomAction.cs │ │ ├── CustomAction.cs.meta │ │ ├── CustomObservation.cs │ │ ├── CustomObservation.cs.meta │ │ ├── CustomResetParameters.cs │ │ ├── CustomResetParameters.cs.meta │ │ ├── DemonstrationMetaProto.cs │ │ ├── DemonstrationMetaProto.cs.meta │ │ ├── EngineConfigurationProto.cs │ │ ├── EngineConfigurationProto.cs.meta │ │ ├── EnvironmentParametersProto.cs │ │ ├── EnvironmentParametersProto.cs.meta │ │ ├── Header.cs │ │ ├── Header.cs.meta │ │ ├── ResolutionProto.cs │ │ ├── ResolutionProto.cs.meta │ │ ├── SpaceTypeProto.cs │ │ ├── SpaceTypeProto.cs.meta │ │ ├── UnityInput.cs │ │ ├── UnityInput.cs.meta │ │ ├── UnityMessage.cs │ │ ├── UnityMessage.cs.meta │ │ ├── UnityOutput.cs │ │ ├── UnityOutput.cs.meta │ │ ├── UnityRlInitializationInput.cs │ │ ├── UnityRlInitializationInput.cs.meta │ │ ├── UnityRlInitializationOutput.cs │ │ ├── UnityRlInitializationOutput.cs.meta │ │ ├── UnityRlInput.cs │ │ ├── UnityRlInput.cs.meta │ │ ├── UnityRlOutput.cs │ │ ├── UnityRlOutput.cs.meta │ │ ├── UnityToExternal.cs │ │ ├── UnityToExternal.cs.meta │ │ ├── UnityToExternalGrpc.cs │ │ └── UnityToExternalGrpc.cs.meta │ │ ├── Decision.cs │ │ ├── Decision.cs.meta │ │ ├── Demonstration.cs │ │ ├── Demonstration.cs.meta │ │ ├── DemonstrationRecorder.cs │ │ ├── DemonstrationRecorder.cs.meta │ │ ├── DemonstrationStore.cs │ │ ├── DemonstrationStore.cs.meta │ │ ├── HeuristicBrain.cs │ │ ├── HeuristicBrain.cs.meta │ │ ├── ICommunicator.cs │ │ ├── ICommunicator.cs.meta │ │ ├── InferenceBrain.meta │ │ ├── InferenceBrain │ │ ├── ApplierImpl.cs │ │ ├── ApplierImpl.cs.meta │ │ ├── BarracudaModelParamLoader.cs │ │ ├── BarracudaModelParamLoader.cs.meta │ │ ├── GeneratorImpl.cs │ │ ├── GeneratorImpl.cs.meta │ │ ├── TensorApplier.cs │ │ ├── TensorApplier.cs.meta │ │ ├── TensorGenerator.cs │ │ ├── TensorGenerator.cs.meta │ │ ├── TensorNames.cs │ │ ├── TensorNames.cs.meta │ │ ├── TensorProxy.cs │ │ ├── TensorProxy.cs.meta │ │ ├── Utils.meta │ │ └── Utils │ │ │ ├── Multinomial.cs │ │ │ ├── Multinomial.cs.meta │ │ │ ├── RandomNormal.cs │ │ │ └── RandomNormal.cs.meta │ │ ├── LearningBrain.cs │ │ ├── LearningBrain.cs.meta │ │ ├── Monitor.cs │ │ ├── Monitor.cs.meta │ │ ├── PlayerBrain.cs │ │ ├── PlayerBrain.cs.meta │ │ ├── ResetParameters.cs │ │ ├── ResetParameters.cs.meta │ │ ├── RpcCommunicator.cs │ │ ├── RpcCommunicator.cs.meta │ │ ├── SocketCommunicator.cs │ │ ├── SocketCommunicator.cs.meta │ │ ├── Startup.cs │ │ ├── Startup.cs.meta │ │ ├── UnityAgentsException.cs │ │ ├── UnityAgentsException.cs.meta │ │ ├── Utilities.cs │ │ └── Utilities.cs.meta ├── Materials.meta ├── Materials │ ├── Black.mat │ ├── Black.mat.meta │ ├── Stroke.mat │ ├── Stroke.mat.meta │ ├── White.mat │ └── White.mat.meta ├── NN Models.meta ├── NN Models │ ├── emnist_110317.nn │ ├── emnist_110317.nn.meta │ ├── emnist_dense.nn │ └── emnist_dense.nn.meta ├── Plugins.meta ├── Plugins │ └── Editor.meta ├── Prefabs.meta ├── Prefabs │ ├── Simple Black Line.prefab │ ├── Simple Black Line.prefab.meta │ ├── Writing Surface (Mouse Raycast).prefab │ ├── Writing Surface (Mouse Raycast).prefab.meta │ ├── Writing Surface (Pen Tip).prefab │ └── Writing Surface (Pen Tip).prefab.meta ├── Scenes.meta ├── Scenes │ ├── SampleScene.unity │ └── SampleScene.unity.meta ├── Scripts.meta └── Scripts │ ├── HandwritingAcademy.cs │ ├── HandwritingAcademy.cs.meta │ ├── HandwritingAgent.cs │ ├── HandwritingAgent.cs.meta │ ├── Invert.cs │ ├── Invert.cs.meta │ ├── PenTipTriggerWriting.cs │ ├── PenTipTriggerWriting.cs.meta │ ├── ScreenRaycastWriting.cs │ ├── ScreenRaycastWriting.cs.meta │ ├── Shaders.meta │ ├── Shaders │ ├── Invert.shader │ └── Invert.shader.meta │ ├── Writing.cs │ └── Writing.cs.meta ├── LICENSE ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset └── XRSettings.asset ├── README.md └── handwriting.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | /.idea/ 13 | 14 | # Never ignore Asset meta data 15 | !/[Aa]ssets/**/*.meta 16 | 17 | # Uncomment this line if you wish to ignore the asset store tools plugin 18 | # /[Aa]ssets/AssetStoreTools* 19 | 20 | # Autogenerated Jetbrains Rider plugin 21 | [Aa]ssets/Plugins/Editor/JetBrains* 22 | 23 | # Visual Studio cache directory 24 | .vs/ 25 | 26 | # Gradle cache directory 27 | .gradle/ 28 | 29 | # Autogenerated VS/MD/Consulo solution and project files 30 | ExportedObj/ 31 | .consulo/ 32 | *.csproj 33 | *.unityproj 34 | *.sln 35 | *.suo 36 | *.tmp 37 | *.user 38 | *.userprefs 39 | *.pidb 40 | *.booproj 41 | *.svd 42 | *.pdb 43 | *.mdb 44 | *.opendb 45 | *.VC.db 46 | 47 | # Unity3D generated meta files 48 | *.pidb.meta 49 | *.pdb.meta 50 | *.mdb.meta 51 | 52 | # Unity3D generated file on crash reports 53 | sysinfo.txt 54 | 55 | # Builds 56 | *.apk 57 | *.unitypackage 58 | 59 | # Crashlytics generated file 60 | crashlytics-build.properties 61 | -------------------------------------------------------------------------------- /Assets/Bitmaps.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 457e1fc9c2c27db4cbfb569d6dd6773a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Bitmaps/stroke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/Bitmaps/stroke.png -------------------------------------------------------------------------------- /Assets/Bitmaps/stroke.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 368d195d5d6fa094982fcfd5f8e6dc8b 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | spriteSheet: 73 | serializedVersion: 2 74 | sprites: [] 75 | outline: [] 76 | physicsShape: [] 77 | bones: [] 78 | spriteID: 79 | internalID: 0 80 | vertices: [] 81 | indices: 82 | edges: [] 83 | weights: [] 84 | secondaryTextures: [] 85 | spritePackingTag: 86 | pSDRemoveMatte: 0 87 | pSDShowRemoveMatteOption: 0 88 | userData: 89 | assetBundleName: 90 | assetBundleVariant: 91 | -------------------------------------------------------------------------------- /Assets/Brains.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddca9aa777ec9114a971c3fed8501a82 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Brains/HandwritingBrain.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8b23992c8eb17439887f5e944bf04a40, type: 3} 13 | m_Name: HandwritingBrain 14 | m_EditorClassIdentifier: 15 | brainParameters: 16 | vectorObservationSize: 0 17 | numStackedVectorObservations: 1 18 | vectorActionSize: 3e000000 19 | cameraResolutions: 20 | - width: 28 21 | height: 28 22 | blackAndWhite: 1 23 | vectorActionDescriptions: 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | - 41 | - 42 | - 43 | - 44 | - 45 | - 46 | - 47 | - 48 | - 49 | - 50 | - 51 | - 52 | - 53 | - 54 | - 55 | - 56 | - 57 | - 58 | - 59 | - 60 | - 61 | - 62 | - 63 | - 64 | - 65 | - 66 | - 67 | - 68 | - 69 | - 70 | - 71 | - 72 | - 73 | - 74 | - 75 | - 76 | - 77 | - 78 | - 79 | - 80 | - 81 | - 82 | - 83 | - 84 | - 85 | - 86 | vectorActionSpaceType: 1 87 | model: {fileID: 5022602860645237092, guid: 2eccfd42b536e954e9ac0ec9d4ba9f4c, type: 3} 88 | inferenceDevice: 0 89 | -------------------------------------------------------------------------------- /Assets/Brains/HandwritingBrain.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7da7a0bf2710f6f40b7d7468842cf996 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Gizmos.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e3df640b8153c624e990d4643855c388 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Gizmos/HeuristicBrain Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/Gizmos/HeuristicBrain Icon.png -------------------------------------------------------------------------------- /Assets/Gizmos/HeuristicBrain Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fbee1fddc738f410ea0b37fe6301d7c0 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 4 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapU: -1 36 | wrapV: -1 37 | wrapW: -1 38 | nPOTScale: 1 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 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 | resizeAlgorithm: 0 61 | textureFormat: -1 62 | textureCompression: 1 63 | compressionQuality: 50 64 | crunchedCompression: 0 65 | allowsAlphaSplitting: 0 66 | overridden: 0 67 | androidETC2FallbackOverride: 0 68 | spriteSheet: 69 | serializedVersion: 2 70 | sprites: [] 71 | outline: [] 72 | physicsShape: [] 73 | spritePackingTag: 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/Gizmos/LearningBrain Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/Gizmos/LearningBrain Icon.png -------------------------------------------------------------------------------- /Assets/Gizmos/LearningBrain Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aff60a06d6c704801a2d09a8e72cbefc 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 4 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapU: -1 36 | wrapV: -1 37 | wrapW: -1 38 | nPOTScale: 1 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 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 | resizeAlgorithm: 0 61 | textureFormat: -1 62 | textureCompression: 1 63 | compressionQuality: 50 64 | crunchedCompression: 0 65 | allowsAlphaSplitting: 0 66 | overridden: 0 67 | androidETC2FallbackOverride: 0 68 | spriteSheet: 69 | serializedVersion: 2 70 | sprites: [] 71 | outline: [] 72 | physicsShape: [] 73 | spritePackingTag: 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/Gizmos/PlayerBrain Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/Gizmos/PlayerBrain Icon.png -------------------------------------------------------------------------------- /Assets/Gizmos/PlayerBrain Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 224cd0666bb7b4477b0806fd29cf5966 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 4 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapU: -1 36 | wrapV: -1 37 | wrapW: -1 38 | nPOTScale: 1 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 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 | resizeAlgorithm: 0 61 | textureFormat: -1 62 | textureCompression: 1 63 | compressionQuality: 50 64 | crunchedCompression: 0 65 | allowsAlphaSplitting: 0 66 | overridden: 0 67 | androidETC2FallbackOverride: 0 68 | spriteSheet: 69 | serializedVersion: 2 70 | sprites: [] 71 | outline: [] 72 | physicsShape: [] 73 | spritePackingTag: 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/ML-Agents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ff2c5808d3c07649909462ce4f16ffc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/AgentEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3b291e1cd0c64781861652b579d0ac1 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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/BrainEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | 5 | namespace MLAgents 6 | { 7 | /// 8 | /// CustomEditor for the Brain base class. Defines the default Inspector view for a Brain. 9 | /// Shows the BrainParameters of the Brain and expose a tool to deep copy BrainParameters 10 | /// between brains. 11 | /// 12 | [CustomEditor(typeof(Brain))] 13 | public class BrainEditor : Editor 14 | { 15 | public override void OnInspectorGUI() 16 | { 17 | var brain = (Brain)target; 18 | var brainToCopy = EditorGUILayout.ObjectField( 19 | "Copy Brain Parameters from : ", null, typeof(Brain), false) as Brain; 20 | if (brainToCopy != null) 21 | { 22 | brain.brainParameters = brainToCopy.brainParameters.Clone(); 23 | EditorUtility.SetDirty(brain); 24 | AssetDatabase.SaveAssets(); 25 | return; 26 | } 27 | var serializedBrain = serializedObject; 28 | serializedBrain.Update(); 29 | EditorGUILayout.PropertyField(serializedBrain.FindProperty("brainParameters"), true); 30 | serializedBrain.ApplyModifiedProperties(); 31 | 32 | // Draws a horizontal thick line 33 | EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/BrainEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b07bebd03994ed08559c725da882b62 3 | timeCreated: 1537834304 -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/BrainParametersDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b060ae8e687cf49bcae88b24db17bfa6 3 | timeCreated: 1517291065 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/BroadcastHubDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa1bef9e5833447ab7251fc6f7a3a609 3 | timeCreated: 1536852419 -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/Builder.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_CLOUD_BUILD 2 | 3 | namespace MLAgents 4 | { 5 | public static class Builder 6 | { 7 | public static void PreExport() 8 | { 9 | BuilderUtils.SwitchAllLearningBrainToControlMode(); 10 | } 11 | } 12 | } 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/Builder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41ad366a346f4fbdaeb7dc8fff9a5025 3 | timeCreated: 1555622970 -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/BuilderUtils.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_CLOUD_BUILD 2 | 3 | using System.Linq; 4 | using UnityEditor; 5 | using UnityEditor.SceneManagement; 6 | using UnityEngine; 7 | using System.IO; 8 | 9 | namespace MLAgents 10 | { 11 | public static class BuilderUtils 12 | { 13 | public static void SwitchAllLearningBrainToControlMode() 14 | { 15 | Debug.Log("The Switching to control mode function is triggered"); 16 | string[] scenePaths = Directory.GetFiles("Assets/ML-Agents/Examples/", "*.unity", SearchOption.AllDirectories); 17 | foreach (string scenePath in scenePaths) 18 | { 19 | var curScene = EditorSceneManager.OpenScene(scenePath); 20 | var aca = SceneAsset.FindObjectOfType(); 21 | if (aca != null) 22 | { 23 | var learningBrains = aca.broadcastHub.broadcastingBrains.Where( 24 | x => x != null && x is LearningBrain); 25 | foreach (Brain brain in learningBrains) 26 | { 27 | if (!aca.broadcastHub.IsControlled(brain)) 28 | { 29 | Debug.Log("Switched brain in scene " + scenePath); 30 | aca.broadcastHub.SetControlled(brain, true); 31 | } 32 | } 33 | EditorSceneManager.SaveScene(curScene); 34 | } 35 | else 36 | { 37 | Debug.Log("scene " + scenePath + " doesn't have a Academy in it"); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/BuilderUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08deb8536161410982b88716adb02f69 3 | timeCreated: 1555623012 -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/DemonstrationDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84f9cd83f56c74790a51444a6cfe4945 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/DemonstrationImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using MLAgents.CommunicatorObjects; 4 | using UnityEditor; 5 | using UnityEngine; 6 | using UnityEditor.Experimental.AssetImporters; 7 | 8 | namespace MLAgents 9 | { 10 | /// 11 | /// Asset Importer used to parse demonstration files. 12 | /// 13 | [ScriptedImporter(1, new[] {"demo"})] 14 | public class DemonstrationImporter : ScriptedImporter 15 | { 16 | private const string k_IconPath = "Assets/ML-Agents/Resources/DemoIcon.png"; 17 | 18 | public override void OnImportAsset(AssetImportContext ctx) 19 | { 20 | var inputType = Path.GetExtension(ctx.assetPath); 21 | if (inputType == null) 22 | { 23 | throw new Exception("Demonstration import error."); 24 | } 25 | 26 | try 27 | { 28 | // Read first two proto objects containing metadata and brain parameters. 29 | Stream reader = File.OpenRead(ctx.assetPath); 30 | 31 | var metaDataProto = DemonstrationMetaProto.Parser.ParseDelimitedFrom(reader); 32 | var metaData = new DemonstrationMetaData(metaDataProto); 33 | 34 | reader.Seek(DemonstrationStore.MetaDataBytes + 1, 0); 35 | var brainParamsProto = BrainParametersProto.Parser.ParseDelimitedFrom(reader); 36 | var brainParameters = new BrainParameters(brainParamsProto); 37 | 38 | reader.Close(); 39 | 40 | var demonstration = ScriptableObject.CreateInstance(); 41 | demonstration.Initialize(brainParameters, metaData); 42 | userData = demonstration.ToString(); 43 | 44 | var texture = (Texture2D) 45 | AssetDatabase.LoadAssetAtPath(k_IconPath, typeof(Texture2D)); 46 | 47 | #if UNITY_2017_3_OR_NEWER 48 | ctx.AddObjectToAsset(ctx.assetPath, demonstration, texture); 49 | ctx.SetMainObject(demonstration); 50 | #else 51 | ctx.SetMainAsset(ctx.assetPath, demonstration); 52 | #endif 53 | } 54 | catch 55 | { 56 | // ignored 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/DemonstrationImporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bd65ce151aaa4a41a45312543c56be1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/HeuristicBrainEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace MLAgents 5 | { 6 | /// 7 | /// CustomEditor for the Heuristic Brain class. Defines the default Inspector view for a 8 | /// HeuristicBrain. 9 | /// Shows the BrainParameters of the Brain and expose a tool to deep copy BrainParameters 10 | /// between brains. Provides a drag box for a Decision Monoscript that will be used by 11 | /// the Heuristic Brain. 12 | /// 13 | [CustomEditor(typeof(HeuristicBrain))] 14 | public class HeuristicBrainEditor : BrainEditor 15 | { 16 | public override void OnInspectorGUI() 17 | { 18 | EditorGUILayout.LabelField("Heuristic Brain", EditorStyles.boldLabel); 19 | var brain = (HeuristicBrain)target; 20 | base.OnInspectorGUI(); 21 | 22 | // Expose the Heuristic Brain's Monoscript for decision in a drag and drop box. 23 | brain.decisionScript = EditorGUILayout.ObjectField( 24 | "Decision Script", brain.decisionScript, typeof(MonoScript), true) as MonoScript; 25 | 26 | CheckIsDecision(brain); 27 | // Draw an error box if the Decision is not set. 28 | if (brain.decisionScript == null) 29 | { 30 | EditorGUILayout.HelpBox("You need to add a 'Decision' component to this Object", 31 | MessageType.Error); 32 | } 33 | } 34 | 35 | /// 36 | /// Ensures tht the Monoscript for the decision of the HeuristicBrain is either null or 37 | /// an implementation of Decision. If the Monoscript is not an implementation of 38 | /// Decision, it will be set to null. 39 | /// 40 | /// The HeuristicBrain with the decision script attached 41 | private static void CheckIsDecision(HeuristicBrain brain) 42 | { 43 | if (brain.decisionScript != null) 44 | { 45 | var decisionInstance = (CreateInstance(brain.decisionScript.name) as Decision); 46 | if (decisionInstance == null) 47 | { 48 | Debug.LogError( 49 | "Instance of " + brain.decisionScript.name + " couldn't be created. " + 50 | "The script class needs to derive from Decision."); 51 | brain.decisionScript = null; 52 | } 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/HeuristicBrainEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3347a9ad704411896dd4898423c6515 3 | timeCreated: 1536852553 -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/LearningBrainEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace MLAgents 5 | { 6 | /// 7 | /// CustomEditor for the LearningBrain class. Defines the default Inspector view for a 8 | /// LearningBrain. 9 | /// Shows the BrainParameters of the Brain and expose a tool to deep copy BrainParameters 10 | /// between brains. Also exposes a drag box for the Model that will be used by the 11 | /// LearningBrain. 12 | /// 13 | [CustomEditor(typeof(LearningBrain))] 14 | public class LearningBrainEditor : BrainEditor 15 | { 16 | private const string k_ModelPropName = "model"; 17 | private const string k_InferenceDevicePropName = "inferenceDevice"; 18 | private const float k_TimeBetweenModelReloads = 2f; 19 | // Time since the last reload of the model 20 | private float m_TimeSinceModelReload; 21 | // Whether or not the model needs to be reloaded 22 | private bool m_RequireReload; 23 | 24 | /// 25 | /// Called when the user opens the Inspector for the LearningBrain 26 | /// 27 | public void OnEnable() 28 | { 29 | m_RequireReload = true; 30 | EditorApplication.update += IncreaseTimeSinceLastModelReload; 31 | } 32 | 33 | /// 34 | /// Called when the user leaves the Inspector for the LearningBrain 35 | /// 36 | public void OnDisable() 37 | { 38 | EditorApplication.update -= IncreaseTimeSinceLastModelReload; 39 | } 40 | 41 | public override void OnInspectorGUI() 42 | { 43 | EditorGUILayout.LabelField("Learning Brain", EditorStyles.boldLabel); 44 | var brain = (LearningBrain)target; 45 | var serializedBrain = serializedObject; 46 | EditorGUI.BeginChangeCheck(); 47 | base.OnInspectorGUI(); 48 | serializedBrain.Update(); 49 | var tfGraphModel = serializedBrain.FindProperty(k_ModelPropName); 50 | EditorGUILayout.ObjectField(tfGraphModel); 51 | var inferenceDevice = serializedBrain.FindProperty(k_InferenceDevicePropName); 52 | EditorGUILayout.PropertyField(inferenceDevice); 53 | serializedBrain.ApplyModifiedProperties(); 54 | if (EditorGUI.EndChangeCheck()) 55 | { 56 | m_RequireReload = true; 57 | } 58 | if (m_RequireReload && m_TimeSinceModelReload > k_TimeBetweenModelReloads) 59 | { 60 | brain.ReloadModel(); 61 | m_RequireReload = false; 62 | m_TimeSinceModelReload = 0; 63 | } 64 | // Display all failed checks 65 | var failedChecks = brain.GetModelFailedChecks(); 66 | foreach (var check in failedChecks) 67 | { 68 | if (check != null) 69 | { 70 | EditorGUILayout.HelpBox(check, MessageType.Warning); 71 | } 72 | } 73 | } 74 | 75 | /// 76 | /// Increases the time since last model reload by the deltaTime since the last Update call 77 | /// from the UnityEditor 78 | /// 79 | private void IncreaseTimeSinceLastModelReload() 80 | { 81 | m_TimeSinceModelReload += Time.deltaTime; 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/LearningBrainEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b538d92cc78b4a62a596822eca31423e 3 | timeCreated: 1536970736 -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/PlayerBrainEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d99e43f78e54b4f96a346219e2ca2d2 3 | timeCreated: 1536851993 -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/ResetParameterDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 740b9a60fe38f476ab020dcf91f3f94a 3 | timeCreated: 1517291065 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/UnityColors.colors: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 52 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 1 11 | m_Script: {fileID: 12323, guid: 0000000000000000e000000000000000, type: 0} 12 | m_Name: UnityColors 13 | m_EditorClassIdentifier: 14 | m_Presets: 15 | - m_Name: 16 | m_Color: {r: 0.12941177, g: 0.5882353, b: 0.9529412, a: 1} 17 | - m_Name: 18 | m_Color: {r: 0, g: 0.34117648, b: 0.6039216, a: 1} 19 | - m_Name: 20 | m_Color: {r: 0.2627451, g: 0.7019608, b: 0.9019608, a: 1} 21 | - m_Name: 22 | m_Color: {r: 0.92156863, g: 0.25490198, b: 0.47843137, a: 1} 23 | - m_Name: 24 | m_Color: {r: 0.92941177, g: 0.3254902, b: 0.31764707, a: 1} 25 | - m_Name: 26 | m_Color: {r: 0.3647059, g: 0.41568628, b: 0.69411767, a: 1} 27 | - m_Name: 28 | m_Color: {r: 0.46666667, g: 0.5647059, b: 0.60784316, a: 1} 29 | - m_Name: 30 | m_Color: {r: 0.74509805, g: 0.7372549, b: 0.7411765, a: 1} 31 | - m_Name: 32 | m_Color: {r: 0.9254902, g: 0.9372549, b: 0.9411765, a: 1} 33 | - m_Name: 34 | m_Color: {r: 0.6039216, g: 0.31764707, b: 0.627451, a: 1} 35 | - m_Name: 36 | m_Color: {r: 0.2901961, g: 0.1764706, b: 0.5254902, a: 1} 37 | - m_Name: 38 | m_Color: {r: 0.4627451, g: 0.35686275, b: 0.654902, a: 1} 39 | - m_Name: 40 | m_Color: {r: 0.6039216, g: 0.31764707, b: 0.627451, a: 1} 41 | - m_Name: 42 | m_Color: {r: 0.20392157, g: 0.75686276, b: 0.8392157, a: 1} 43 | - m_Name: 44 | m_Color: {r: 0.1254902, g: 0.6509804, b: 0.60784316, a: 1} 45 | - m_Name: 46 | m_Color: {r: 0.39609292, g: 0.49962592, b: 0.6509434, a: 0} 47 | - m_Name: 48 | m_Color: {r: 0.40392157, g: 0.7372549, b: 0.41960785, a: 1} 49 | - m_Name: 50 | m_Color: {r: 0.60784316, g: 0.8039216, b: 0.39607844, a: 1} 51 | - m_Name: 52 | m_Color: {r: 0.8235294, g: 0.8784314, b: 0.34901962, a: 1} 53 | - m_Name: 54 | m_Color: {r: 1, g: 0.79607844, b: 0.15294118, a: 1} 55 | - m_Name: 56 | m_Color: {r: 1, g: 0.93333334, b: 0.34509805, a: 1} 57 | - m_Name: 58 | m_Color: {r: 0.98039216, g: 0.6509804, b: 0.16078432, a: 1} 59 | - m_Name: 60 | m_Color: {r: 0.9529412, g: 0.4392157, b: 0.27450982, a: 1} 61 | - m_Name: 62 | m_Color: {r: 0.74509805, g: 0.22745098, b: 0.15294118, a: 1} 63 | - m_Name: 64 | m_Color: {r: 0.9529412, g: 0.4392157, b: 0.27450982, a: 1} 65 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Editor/UnityColors.colors.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b20b0226063034686a6cf92ade284285 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13df47c141a644f57bdb0a667879ef0b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3cf2bcd7dcfe144bebf6cf271e7dfbe0 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d59cec597ba94288831c0cade38b14e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Barracuda.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Barracuda.dll -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Barracuda.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de59cc66e5e394f93b2a692e50bce97f 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | Any: 13 | second: 14 | enabled: 1 15 | settings: {} 16 | - first: 17 | Editor: Editor 18 | second: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | - first: 23 | Windows Store Apps: WindowsStoreApps 24 | second: 25 | enabled: 0 26 | settings: 27 | CPU: AnyCPU 28 | userData: 29 | assetBundleName: 30 | assetBundleVariant: 31 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7bba248e968b476a875260a8127a595 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b10c58689ee84c2abe895327686f532 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor/BarracudaEditor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e192a80b369ad4683a329432eeb5ec20 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor/BarracudaEditor/Barracuda-editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Barracuda-editor", 3 | "references": [], 4 | "includePlatforms": [ 5 | "Editor" 6 | ], 7 | "excludePlatforms": [] 8 | } -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor/BarracudaEditor/Barracuda-editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f1e7d835703842dda0e25142ed6c3c9 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor/BarracudaEditor/NNModelIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor/BarracudaEditor/NNModelIcon.png -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor/BarracudaEditor/NNModelIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8682ff569c4c7457a8a8e3a527aad537 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 4 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 0 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: -1 33 | aniso: 1 34 | mipBias: -1 35 | wrapU: 1 36 | wrapV: 1 37 | wrapW: -1 38 | nPOTScale: 0 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 49 | alphaUsage: 1 50 | alphaIsTransparency: 1 51 | spriteTessellationDetail: -1 52 | textureType: 2 53 | textureShape: 1 54 | maxTextureSizeSet: 0 55 | compressionQualitySet: 0 56 | textureFormatSet: 0 57 | platformSettings: 58 | - buildTarget: DefaultTexturePlatform 59 | maxTextureSize: 2048 60 | resizeAlgorithm: 0 61 | textureFormat: -1 62 | textureCompression: 1 63 | compressionQuality: 50 64 | crunchedCompression: 0 65 | allowsAlphaSplitting: 0 66 | overridden: 0 67 | androidETC2FallbackOverride: 0 68 | - buildTarget: Standalone 69 | maxTextureSize: 2048 70 | resizeAlgorithm: 0 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | androidETC2FallbackOverride: 0 78 | - buildTarget: iPhone 79 | maxTextureSize: 2048 80 | resizeAlgorithm: 0 81 | textureFormat: -1 82 | textureCompression: 1 83 | compressionQuality: 50 84 | crunchedCompression: 0 85 | allowsAlphaSplitting: 0 86 | overridden: 0 87 | androidETC2FallbackOverride: 0 88 | - buildTarget: Android 89 | maxTextureSize: 2048 90 | resizeAlgorithm: 0 91 | textureFormat: -1 92 | textureCompression: 1 93 | compressionQuality: 50 94 | crunchedCompression: 0 95 | allowsAlphaSplitting: 0 96 | overridden: 0 97 | androidETC2FallbackOverride: 0 98 | spriteSheet: 99 | serializedVersion: 2 100 | sprites: [] 101 | outline: [] 102 | physicsShape: [] 103 | spritePackingTag: 104 | userData: 105 | assetBundleName: 106 | assetBundleVariant: 107 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor/BarracudaEditor/NNModelImporter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using UnityEditor; 3 | using UnityEngine; 4 | using UnityEditor.Experimental.AssetImporters; 5 | 6 | namespace Barracuda 7 | { 8 | /// 9 | /// Asset Importer of barracuda models. 10 | /// 11 | [ScriptedImporter(1, new[] {"nn"})] 12 | public class NNModelImporter : ScriptedImporter 13 | { 14 | private const string k_IconName = "NNModelIcon"; 15 | 16 | private Texture2D m_IconTexture; 17 | 18 | public override void OnImportAsset(AssetImportContext ctx) 19 | { 20 | var model = File.ReadAllBytes(ctx.assetPath); 21 | var asset = ScriptableObject.CreateInstance(); 22 | asset.Value = model; 23 | 24 | ctx.AddObjectToAsset("main obj", asset, LoadIconTexture()); 25 | ctx.SetMainObject(asset); 26 | } 27 | 28 | private Texture2D LoadIconTexture() 29 | { 30 | if (m_IconTexture == null) 31 | { 32 | var allCandidates = AssetDatabase.FindAssets(k_IconName); 33 | 34 | if (allCandidates.Length > 0) 35 | { 36 | m_IconTexture = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(allCandidates[0]), typeof(Texture2D)) as Texture2D; 37 | } 38 | } 39 | return m_IconTexture; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/Editor/BarracudaEditor/NNModelImporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19ed1486aa27d4903b34839f37b8f69f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5087a463bec2b4b76808e7307a94887f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/MacBLAS.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MacBLAS", 3 | "references": [], 4 | "optionalUnityReferences": [], 5 | "includePlatforms": [ 6 | "Editor", 7 | "macOSStandalone" 8 | ], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": true 11 | } -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/MacBLAS.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53fc9961397934ed38a573ce1392c80c 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/MacBLAS.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX 2 | using System.Runtime.InteropServices; 3 | using Barracuda; 4 | using UnityEngine; 5 | using UnityEngine.Scripting; 6 | 7 | 8 | [Preserve] 9 | public class MacBLAS : BLASPlugin 10 | { 11 | [DllImport("macblas")] 12 | static extern unsafe void macsgemm(float* ap, int an, int am, 13 | float* bp, int bn, int bm, 14 | float* cp, int cn, int cm, 15 | int bs, bool transposeA, bool transposeB); 16 | 17 | public bool IsCurrentPlatformSupported() 18 | { 19 | return Application.platform == RuntimePlatform.OSXEditor || 20 | Application.platform == RuntimePlatform.OSXPlayer; 21 | } 22 | 23 | public unsafe void SGEMM(float* ap, int an, int am, float* bp, int bn, int bm, float* cp, int cn, int cm, int bs, 24 | bool transposeA = false, bool transposeB = false) 25 | { 26 | macsgemm(ap, an, am, bp, bn, bm, cp, cn, cm, bs, transposeA, transposeB); 27 | } 28 | } 29 | #endif // UNITY_OSX 30 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/MacBLAS.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 680f04373f71f48a89408105d3f58a08 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6633afded85ec4f00a4cc653053461bb 3 | folderAsset: yes 4 | PluginImporter: 5 | externalObjects: {} 6 | serializedVersion: 2 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | - first: 13 | '': OSXIntel 14 | second: 15 | enabled: 1 16 | settings: {} 17 | - first: 18 | '': OSXIntel64 19 | second: 20 | enabled: 1 21 | settings: {} 22 | - first: 23 | Any: 24 | second: 25 | enabled: 0 26 | settings: {} 27 | - first: 28 | Editor: Editor 29 | second: 30 | enabled: 1 31 | settings: 32 | DefaultValueInitialized: true 33 | - first: 34 | Standalone: OSXUniversal 35 | second: 36 | enabled: 1 37 | settings: {} 38 | userData: 39 | assetBundleName: 40 | assetBundleVariant: 41 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5de42c62131964fc999e1dc3d292cc31 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 14F27 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | macblas 11 | CFBundleIdentifier 12 | com.unity3d.macblas 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | macblas 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 0.1.4 21 | CFBundleVersion 22 | 1 23 | DTCompiler 24 | com.apple.compilers.llvm.clang.1_0 25 | DTPlatformBuild 26 | 6A1052d 27 | DTPlatformVersion 28 | GM 29 | DTSDKBuild 30 | 14A382 31 | DTSDKName 32 | macosx10.10 33 | DTXcode 34 | 0610 35 | DTXcodeBuild 36 | 6A1052d 37 | NSHumanReadableCopyright 38 | Copyright © 2018 Unity Technologies. All rights reserved. 39 | 40 | 41 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 844f003f25d444aafad9fb1fcea17bbc 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/MacOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0620b207d80004fe595413acf79f2f66 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/MacOS/macblas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/MacOS/macblas -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/MacOS/macblas.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9ef2c9e25cad478aa1220d6cf68a2ed 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/_CodeSignature.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93038b433855548879a151644d2354c1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | files2 8 | 9 | rules 10 | 11 | ^Resources/ 12 | 13 | ^Resources/.*\.lproj/ 14 | 15 | optional 16 | 17 | weight 18 | 1000 19 | 20 | ^Resources/.*\.lproj/locversion.plist$ 21 | 22 | omit 23 | 24 | weight 25 | 1100 26 | 27 | ^version.plist$ 28 | 29 | 30 | rules2 31 | 32 | .*\.dSYM($|/) 33 | 34 | weight 35 | 11 36 | 37 | ^(.*/)?\.DS_Store$ 38 | 39 | omit 40 | 41 | weight 42 | 2000 43 | 44 | ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ 45 | 46 | nested 47 | 48 | weight 49 | 10 50 | 51 | ^.* 52 | 53 | ^Info\.plist$ 54 | 55 | omit 56 | 57 | weight 58 | 20 59 | 60 | ^PkgInfo$ 61 | 62 | omit 63 | 64 | weight 65 | 20 66 | 67 | ^Resources/ 68 | 69 | weight 70 | 20 71 | 72 | ^Resources/.*\.lproj/ 73 | 74 | optional 75 | 76 | weight 77 | 1000 78 | 79 | ^Resources/.*\.lproj/locversion.plist$ 80 | 81 | omit 82 | 83 | weight 84 | 1100 85 | 86 | ^[^/]+$ 87 | 88 | nested 89 | 90 | weight 91 | 10 92 | 93 | ^embedded\.provisionprofile$ 94 | 95 | weight 96 | 20 97 | 98 | ^version\.plist$ 99 | 100 | weight 101 | 20 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/OSX/macblas.bundle/Contents/_CodeSignature/CodeResources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 523ab7e7760c743a9977ecfedabe1691 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/iOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 256085e1b062345239f3d7d88741f96c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/iOS/iOSBLAS.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "iOSBLAS", 3 | "references": [], 4 | "optionalUnityReferences": [], 5 | "includePlatforms": [ 6 | "Editor", 7 | "iOS" 8 | ], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": true 11 | } -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/iOS/iOSBLAS.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 005937e819cd540429ad05eabcfb642f 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/iOS/iOSBLAS.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_IOS 2 | using System.Runtime.InteropServices; 3 | using Barracuda; 4 | using UnityEngine; 5 | using UnityEngine.Scripting; 6 | 7 | [Preserve] 8 | public class iOSBLAS : BLASPlugin 9 | { 10 | [DllImport("__Internal")] 11 | static extern unsafe void iossgemm(float* Ap, int AN, int AM, 12 | float* Bp, int BN, int BM, 13 | float* Cp, int CN, int CM, 14 | int bs, bool transposeA, bool transposeB); 15 | 16 | public bool IsCurrentPlatformSupported() 17 | { 18 | return Application.platform == RuntimePlatform.IPhonePlayer; 19 | } 20 | 21 | public unsafe void SGEMM(float* Ap, int AN, int AM, float* Bp, int BN, int BM, float* Cp, int CN, int CM, int bs, 22 | bool transposeA = false, bool transposeB = false) 23 | { 24 | iossgemm(Ap, AN, AM, Bp, BN, BM, Cp, CN, CM, bs, transposeA, transposeB); 25 | } 26 | } 27 | #endif // UNITY_IOS 28 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/iOS/iOSBLAS.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75424b0c6afc14ea7a1debef68240d9e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/iOS/iOSBLAS.mm: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | extern "C" 4 | { 5 | void iossgemm(float* Ap, int AN, int AM, 6 | float* Bp, int BN, int BM, 7 | float* Cp, int CN, int CM, 8 | int bs, bool transposeA, bool transposeB) 9 | { 10 | cblas_sgemm(CblasRowMajor, transposeA ? CblasTrans : CblasNoTrans, 11 | transposeB ? CblasTrans : CblasNoTrans, 12 | AN, BM, BN, 1.0f, Ap, AM, Bp, BM, 1.0f, Cp, CM); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Plugins/iOS/iOSBLAS.mm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 100b08f95d9f349118f287b0170140d4 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 1 18 | Exclude Linux: 1 19 | Exclude Linux64: 1 20 | Exclude LinuxUniversal: 1 21 | Exclude OSXUniversal: 1 22 | Exclude WebGL: 1 23 | Exclude Win: 1 24 | Exclude Win64: 1 25 | Exclude iOS: 0 26 | - first: 27 | Android: Android 28 | second: 29 | enabled: 0 30 | settings: 31 | CPU: ARMv7 32 | - first: 33 | Any: 34 | second: 35 | enabled: 0 36 | settings: {} 37 | - first: 38 | Editor: Editor 39 | second: 40 | enabled: 0 41 | settings: 42 | CPU: AnyCPU 43 | DefaultValueInitialized: true 44 | OS: AnyOS 45 | - first: 46 | Facebook: Win 47 | second: 48 | enabled: 0 49 | settings: 50 | CPU: AnyCPU 51 | - first: 52 | Facebook: Win64 53 | second: 54 | enabled: 0 55 | settings: 56 | CPU: AnyCPU 57 | - first: 58 | Standalone: Linux 59 | second: 60 | enabled: 0 61 | settings: 62 | CPU: x86 63 | - first: 64 | Standalone: Linux64 65 | second: 66 | enabled: 0 67 | settings: 68 | CPU: x86_64 69 | - first: 70 | Standalone: OSXUniversal 71 | second: 72 | enabled: 0 73 | settings: 74 | CPU: AnyCPU 75 | - first: 76 | Standalone: Win 77 | second: 78 | enabled: 0 79 | settings: 80 | CPU: AnyCPU 81 | - first: 82 | Standalone: Win64 83 | second: 84 | enabled: 0 85 | settings: 86 | CPU: AnyCPU 87 | - first: 88 | iPhone: iOS 89 | second: 90 | enabled: 1 91 | settings: 92 | AddToEmbeddedBinaries: false 93 | CompileFlags: 94 | FrameworkDependencies: Accelerate; 95 | - first: 96 | tvOS: tvOS 97 | second: 98 | enabled: 1 99 | settings: {} 100 | userData: 101 | assetBundleName: 102 | assetBundleVariant: 103 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 264a957219ea041c58af860601fe1881 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Activation.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fdc94044b2f234c0fa80ada3771a2ae7 3 | timeCreated: 1495527718 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/BarracudaReferenceImpl.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4b1b304aae6c404cb0cdab46b8fa084 3 | timeCreated: 1495527718 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Broadcast.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72dd00e416ab94bd79e7264a1fadef9d 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | currentAPIMask: 65536 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Conv.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f508b82f984146e8bf0ad8520c316c7 3 | timeCreated: 1507457340 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/ConvOld.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a89bb2d7cde74429c8475f7cd8bcdb01 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | currentAPIMask: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Dense.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b08c0ac202ad41deb8881132b21894c 3 | timeCreated: 1507457322 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/DenseFP16.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel DenseFP16Div2 2 | 3 | #include "Tensor.cginc" 4 | 5 | TENSOR_DECL(X) 6 | TENSOR_DECL(W) 7 | TENSOR_DECL(B) 8 | TENSOR_DECL(WBK) 9 | TENSOR_DECL_RW(O) 10 | 11 | float f16tof32_(uint src) 12 | { 13 | // Based on Fabian Giesen's public domain half_to_float_fast3 14 | const uint magic = 113 << 23; 15 | const uint shiftedExp = 0x7c00 << 13; // exponent mask after shift 16 | 17 | // Mask out sign bit 18 | uint o = src & 0x7fff; 19 | if (o) 20 | { 21 | // Move exponent + mantissa to correct bits 22 | o <<= 13; 23 | uint exponent = o & shiftedExp; 24 | if (exponent == 0) 25 | { 26 | // Handle denormal 27 | o = asuint(asfloat(o + magic) - asfloat(magic)); 28 | } 29 | else if (exponent == shiftedExp) // Inf/NaN 30 | o += (255 - 31) << 23; 31 | else 32 | o += (127 - 15) << 23; 33 | } 34 | 35 | // Copy sign bit 36 | o |= (src & 0x8000) << 16; 37 | 38 | return asfloat(o); 39 | } 40 | 41 | float2 Unpack(SharedTensor t, uint y, uint x) 42 | { 43 | uint v = asuint(t.data[t.Index(y, x) >> 1]); 44 | // TEMPORARY: f16tof32 is broken in GLSL/Metal compiler 45 | // using custom conversion function for now 46 | //return float2(f16tof32(v), f16tof32(v>>16)); 47 | return float2(f16tof32_(v), f16tof32_(v>>16)); 48 | } 49 | 50 | // NOTE: usually this path is used for <16 batches 51 | NUMTHREADS((256,1,1), (128,1,1), (64,1,1)) 52 | void DenseFP16Div2(uint3 dispatchThreadID : SV_DispatchThreadID) 53 | { 54 | DISPATCH_ARGS(O.flatWidth/2, O.flatHeight, 1); 55 | TENSOR_SHARED2_ARGS4(X, W, B, WBK, O); 56 | 57 | uint x = dispatchThreadID.x; 58 | uint y = dispatchThreadID.y; 59 | 60 | if (x*2 >= O.GetFlatWidth()) return; 61 | if (y >= O.GetFlatHeight()) return; 62 | 63 | float2 acc = Unpack(B, 0, x*2); 64 | for (uint i = 0; i < X.width; ++i) 65 | { 66 | float2 w = Unpack(W, i, x*2); 67 | acc += X.Get(y, i) * w; 68 | } 69 | 70 | O.Set(y, x*2+0, acc[0]); 71 | O.Set(y, x*2+1, acc[1]); 72 | } 73 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/DenseFP16.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cff3cb66e54744fa4888ef91a11ec90c 3 | timeCreated: 1508334838 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Experimental.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 299ca130202014274b506123e830c52d 3 | timeCreated: 1506672486 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/FastNV.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7c673db45e6845d5abaed4ed5ef42e1 3 | timeCreated: 1507294253 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Generic.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62f5efacd43b24dd38ead3ce0d80cc34 3 | timeCreated: 1495527718 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Random.cginc: -------------------------------------------------------------------------------- 1 |  2 | // Based on: https://stackoverflow.com/questions/5149544/can-i-generate-a-random-number-inside-a-pixel-shader 3 | // Output: Random number: [0,1), that is between 0.0 and 0.999999... inclusive. 4 | // Author: Michael Pohoreski 5 | // Copyright: Copyleft 2012 :-) 6 | float RandomUsingCos(float4 seed) 7 | { 8 | float4 K1 = float4( // Transcendental numbers: 9 | 0.64341054629, // (Cahen's constant) 10 | 23.14069263277926, // e^pi (Gelfond's constant) 11 | 2.665144142690225, // 2^sqrt(2) (Gelfond-Schneider constant) 12 | 3.14159265359 // pi 13 | ); 14 | return frac(cos(dot(seed, K1)) * 12345.6789); 15 | } 16 | 17 | // Based on: https://stackoverflow.com/questions/4200224/random-noise-functions-for-glsl 18 | // Author: Spatial 19 | // 05 July 2013 20 | 21 | // A single iteration of Bob Jenkins' One-At-A-Time hashing algorithm. 22 | uint hash(uint x) 23 | { 24 | x += ( x << 10u ); 25 | x ^= ( x >> 6u ); 26 | x += ( x << 3u ); 27 | x ^= ( x >> 11u ); 28 | x += ( x << 15u ); 29 | return x; 30 | } 31 | uint hash( uint2 v ) { return hash( v.x ^ hash(v.y) ); } 32 | uint hash( uint3 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ); } 33 | uint hash( uint4 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ^ hash(v.w) ); } 34 | 35 | // Construct a float with half-open range [0:1] using low 23 bits. 36 | // All zeroes yields 0.0, all ones yields the next smallest representable value below 1.0. 37 | float floatConstruct(uint m) 38 | { 39 | const uint ieeeMantissa = 0x007FFFFFu; // binary32 mantissa bitmask 40 | const uint ieeeOne = 0x3F800000u; // 1.0 in IEEE binary32 41 | 42 | m &= ieeeMantissa; // Keep only mantissa bits (fractional part) 43 | m |= ieeeOne; // Add fractional part to 1.0 44 | 45 | float f = asfloat(m); // Range [1:2] 46 | return f - 1.0; // Range [0:1] 47 | } 48 | 49 | // Pseudo-random value in half-open range [0:1]. 50 | float RandomUsingHash(float4 seed) 51 | { 52 | return floatConstruct(hash(asuint(seed))); 53 | } 54 | 55 | 56 | // More alternatives: 57 | // https://github.com/ashima/webgl-noise 58 | // https://www.shadertoy.com/view/4djSRW 59 | 60 | // ------------------------------------------------------------------------------------------ 61 | 62 | float Random(float4 seed) 63 | { 64 | return RandomUsingCos(seed); 65 | } 66 | 67 | float Bernoulli(float4 seed, float p) 68 | { 69 | return Random(seed) <= p ? 1: 0; 70 | } 71 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Random.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a17e0b3943a74564a02a8ed0a41228b 3 | timeCreated: 1520855309 4 | licenseType: Pro 5 | ShaderImporter: 6 | externalObjects: {} 7 | defaultTextures: [] 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/Tensor.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5761abd87a16940b2a81aaa755787fc9 3 | timeCreated: 1506540305 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/TexConv.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel TexConv2D 2 | 3 | #include "Tensor.cginc" 4 | 5 | TENSOR_DECL(X) 6 | TENSOR_DECL(K) 7 | TENSOR_DECL(B) 8 | TENSOR_DECL(WBK) 9 | TENSOR_DECL_RW(O) 10 | 11 | uint4 _Pad; 12 | uint4 _Stride; 13 | 14 | struct TextureAsTensor : Tensor 15 | { 16 | Texture2D tex; 17 | SamplerState smp; 18 | 19 | Texture2DArray texArray; 20 | SamplerState smpArray; 21 | 22 | void Init(uint4 nhwc, Texture2D tex_, SamplerState sampler_, Texture2DArray texArray_, SamplerState samplerArray_) 23 | { 24 | Tensor::Init(nhwc); 25 | tex = tex_; 26 | smp = sampler_; 27 | texArray = texArray_; 28 | smpArray = samplerArray_; 29 | } 30 | 31 | float4 Get(uint b, uint y, uint x) 32 | { 33 | float3 loc = float3((float)x / (float)width, (float)y / (float)height, b); 34 | if (batch > 1) 35 | return texArray.SampleLevel(smpArray, loc, 0); 36 | else 37 | return tex.SampleLevel(smp, loc.xy, 0); 38 | } 39 | }; 40 | 41 | #define TENSOR_SHARED2_ARGS3(A, B, S, O) TENSOR_SHARED_ARG(A, S); TENSOR_SHARED_ARG(B, S); TENSOR_ARG_RW(O); 42 | Texture2DArray Xtex2DArray; 43 | Texture2D Xtex2D; 44 | SamplerState samplerXtex2D { Filter = MIN_MAG_LINEAR_MIP_POINT; AddressU = Clamp; AddressV = Clamp; }; 45 | SamplerState samplerXtex2DArray { Filter = MIN_MAG_LINEAR_MIP_POINT; AddressU = Clamp; AddressV = Clamp; }; 46 | 47 | #define MAX_CHANNELS 4 48 | 49 | NUMTHREADS((16,4,4), (16,4,2), (16,2,2)) 50 | void TexConv2D(uint3 dispatchThreadID : SV_DispatchThreadID) 51 | { 52 | // @TODO: currently it fails to compile, needs to be investigated 53 | #if 0 54 | DISPATCH_ARGS(K.kernelCount, O.width, O.height); 55 | TextureAsTensor X; X.Init(Xdecl[0], Xtex2D, samplerXtex2D, Xtex2DArray, samplerXtex2DArray); 56 | 57 | TENSOR_SHARED_ARG(K, WBK); 58 | TENSOR_SHARED_ARG(B, WBK); 59 | TENSOR_ARG_RW(O); 60 | 61 | // ASSERT(X.channels <= MAX_CHANNELS) 62 | 63 | uint k = dispatchThreadID.x; 64 | uint x = dispatchThreadID.y; 65 | uint y = dispatchThreadID.z; 66 | 67 | if (k >= K.channels) return; 68 | if (x >= O.width) return; 69 | if (y >= O.height) return; 70 | 71 | for (uint n = 0; n < O.batch; ++n) 72 | { 73 | float acc = B.Get(k); 74 | for (uint dy = 0; dy < K.GetKernelHeight(); ++dy) 75 | { 76 | for (uint dx = 0; dx < K.GetKernelWidth(); ++dx) 77 | { 78 | uint oy = y * _Stride.y + dy; 79 | uint ox = x * _Stride.x + dx; 80 | 81 | // @TODO: investigate 82 | // WARNING: had to move both y check into the loop (as opposed to checking y in parent loop) - due to potential bug in Metal compiler 83 | if (oy < _Pad.y) continue; 84 | if (oy - _Pad.w >= X.height) continue; 85 | if (ox < _Pad.x) continue; 86 | if (ox - _Pad.z >= X.width) continue; 87 | 88 | float4 in4channels = X.Get(n, oy - _Pad.y, ox - _Pad.x); 89 | for (uint c = 0; c < X.channels && c < MAX_CHANNELS; ++c) 90 | { 91 | acc += in4channels[c] * K.Get(dy, dx, c, k); 92 | } 93 | } 94 | } 95 | 96 | O.Set(n, y, x, k, acc); 97 | } 98 | #endif 99 | } 100 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda/Resources/TexConv.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85d38d76f835143f797bca1481285596 3 | timeCreated: 1507637303 4 | licenseType: Pro 5 | ComputeShaderImporter: 6 | currentAPIMask: 196608 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/LICENSE.md: -------------------------------------------------------------------------------- 1 | Barracuda cross-platform Neural Net engine copyright © 2018 Unity Technologies ApS 2 | 3 | Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). 4 | 5 | Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. 6 | 7 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dcc5ce8caa7664f8090ef0103a208c6e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/ReleaseNotes.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a129912fffc9d4ab3b5ae110be67a669 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.unity.barracuda", 3 | "displayName": "Barracuda", 4 | "version": "0.2.4-preview", 5 | "unity": "2017.4", 6 | "description": "Barracuda is lightweight and cross-platform Neural Net inference library. Barracuda supports inference both on GPU and CPU.", 7 | "dependencies": {} 8 | } -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/Barracuda.Core/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 73ae2d877fd444b04b5b6ef591d3fa0e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e44343d7e31b04d47bd5f7329c918ffe 3 | folderAsset: yes 4 | timeCreated: 1521839636 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/Google.Protobuf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/ProtoBuffer/Google.Protobuf.dll -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/Google.Protobuf.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0836ffd04a4924861a2d58aa4b111937 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | Any: 13 | second: 14 | enabled: 1 15 | settings: {} 16 | - first: 17 | Editor: Editor 18 | second: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | - first: 23 | Windows Store Apps: WindowsStoreApps 24 | second: 25 | enabled: 0 26 | settings: 27 | CPU: AnyCPU 28 | userData: 29 | assetBundleName: 30 | assetBundleVariant: 31 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/Grpc.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/ProtoBuffer/Grpc.Core.dll -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/Grpc.Core.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbf24ddeec4054edc9ad4c8295556878 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 0 18 | Exclude Linux: 0 19 | Exclude Linux64: 0 20 | Exclude LinuxUniversal: 0 21 | Exclude OSXUniversal: 0 22 | Exclude Win: 0 23 | Exclude Win64: 0 24 | Exclude iOS: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: ARMv7 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 1 40 | settings: 41 | CPU: AnyCPU 42 | DefaultValueInitialized: true 43 | OS: AnyOS 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux 58 | second: 59 | enabled: 1 60 | settings: 61 | CPU: x86 62 | - first: 63 | Standalone: Linux64 64 | second: 65 | enabled: 1 66 | settings: 67 | CPU: x86_64 68 | - first: 69 | Standalone: LinuxUniversal 70 | second: 71 | enabled: 1 72 | settings: {} 73 | - first: 74 | Standalone: OSXUniversal 75 | second: 76 | enabled: 1 77 | settings: 78 | CPU: AnyCPU 79 | - first: 80 | Standalone: Win 81 | second: 82 | enabled: 1 83 | settings: 84 | CPU: AnyCPU 85 | - first: 86 | Standalone: Win64 87 | second: 88 | enabled: 1 89 | settings: 90 | CPU: AnyCPU 91 | - first: 92 | Windows Store Apps: WindowsStoreApps 93 | second: 94 | enabled: 0 95 | settings: 96 | CPU: AnyCPU 97 | - first: 98 | iPhone: iOS 99 | second: 100 | enabled: 0 101 | settings: 102 | CompileFlags: 103 | FrameworkDependencies: 104 | userData: 105 | assetBundleName: 106 | assetBundleVariant: 107 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/System.Interactive.Async.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/ProtoBuffer/System.Interactive.Async.dll -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/System.Interactive.Async.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9502ce7e38c5947dba996570732b6e9f 3 | timeCreated: 1521661784 4 | licenseType: Free 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | Any: 15 | second: 16 | enabled: 1 17 | settings: {} 18 | - first: 19 | Editor: Editor 20 | second: 21 | enabled: 0 22 | settings: 23 | DefaultValueInitialized: true 24 | - first: 25 | Windows Store Apps: WindowsStoreApps 26 | second: 27 | enabled: 0 28 | settings: 29 | CPU: AnyCPU 30 | userData: 31 | assetBundleName: 32 | assetBundleVariant: 33 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8022add2e5264884a117894eeaf9809 3 | folderAsset: yes 4 | timeCreated: 1521595360 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/linux.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50c3602c6f6244621861928757e31463 3 | folderAsset: yes 4 | timeCreated: 1521595360 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/linux/native.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba192b1e561564e1583e0a87334f8682 3 | folderAsset: yes 4 | timeCreated: 1521595360 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/linux/native/libgrpc_csharp_ext.x64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/linux/native/libgrpc_csharp_ext.x64.so -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/linux/native/libgrpc_csharp_ext.x64.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9d901caf522f4dc5815786fa764a5da 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 0 18 | Exclude Linux: 1 19 | Exclude Linux64: 0 20 | Exclude LinuxUniversal: 0 21 | Exclude OSXUniversal: 1 22 | Exclude Win: 0 23 | Exclude Win64: 0 24 | Exclude iOS: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: ARMv7 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 1 40 | settings: 41 | CPU: x86_64 42 | DefaultValueInitialized: true 43 | OS: Linux 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux 58 | second: 59 | enabled: 0 60 | settings: 61 | CPU: None 62 | - first: 63 | Standalone: Linux64 64 | second: 65 | enabled: 1 66 | settings: 67 | CPU: x86_64 68 | - first: 69 | Standalone: LinuxUniversal 70 | second: 71 | enabled: 1 72 | settings: 73 | CPU: x86_64 74 | - first: 75 | Standalone: OSXUniversal 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: None 80 | - first: 81 | Standalone: Win 82 | second: 83 | enabled: 1 84 | settings: 85 | CPU: AnyCPU 86 | - first: 87 | Standalone: Win64 88 | second: 89 | enabled: 1 90 | settings: 91 | CPU: AnyCPU 92 | - first: 93 | iPhone: iOS 94 | second: 95 | enabled: 0 96 | settings: 97 | AddToEmbeddedBinaries: false 98 | CompileFlags: 99 | FrameworkDependencies: 100 | userData: 101 | assetBundleName: 102 | assetBundleVariant: 103 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/linux/native/libgrpc_csharp_ext.x86.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/linux/native/libgrpc_csharp_ext.x86.so -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/linux/native/libgrpc_csharp_ext.x86.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7dfb52431a6d941c89758cf0a217e3ab 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 0 18 | Exclude Linux: 0 19 | Exclude Linux64: 1 20 | Exclude LinuxUniversal: 0 21 | Exclude OSXUniversal: 1 22 | Exclude Win: 0 23 | Exclude Win64: 0 24 | Exclude iOS: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: ARMv7 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 1 40 | settings: 41 | CPU: x86 42 | DefaultValueInitialized: true 43 | OS: Linux 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux 58 | second: 59 | enabled: 1 60 | settings: 61 | CPU: x86 62 | - first: 63 | Standalone: Linux64 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: None 68 | - first: 69 | Standalone: LinuxUniversal 70 | second: 71 | enabled: 1 72 | settings: 73 | CPU: x86 74 | - first: 75 | Standalone: OSXUniversal 76 | second: 77 | enabled: 0 78 | settings: 79 | CPU: None 80 | - first: 81 | Standalone: Win 82 | second: 83 | enabled: 1 84 | settings: 85 | CPU: AnyCPU 86 | - first: 87 | Standalone: Win64 88 | second: 89 | enabled: 1 90 | settings: 91 | CPU: AnyCPU 92 | - first: 93 | iPhone: iOS 94 | second: 95 | enabled: 0 96 | settings: 97 | AddToEmbeddedBinaries: false 98 | CompileFlags: 99 | FrameworkDependencies: 100 | userData: 101 | assetBundleName: 102 | assetBundleVariant: 103 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/osx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f43fa6e62fb4c4105b270be1ae7bbbfd 3 | folderAsset: yes 4 | timeCreated: 1521595360 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/osx/native.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55aee008fb6a3411aa96f2f9911f9207 3 | folderAsset: yes 4 | timeCreated: 1521595360 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/osx/native/libgrpc_csharp_ext.x64.bundle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/osx/native/libgrpc_csharp_ext.x64.bundle -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/osx/native/libgrpc_csharp_ext.x64.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7eeb863bd08ba4388829c23da03a714f 3 | PluginImporter: 4 | serializedVersion: 2 5 | iconMap: {} 6 | executionOrder: {} 7 | isPreloaded: 0 8 | isOverridable: 0 9 | platformData: 10 | data: 11 | first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 0 18 | Exclude Linux: 1 19 | Exclude Linux64: 1 20 | Exclude LinuxUniversal: 1 21 | Exclude OSXIntel: 0 22 | Exclude OSXIntel64: 0 23 | Exclude OSXUniversal: 0 24 | Exclude Win: 1 25 | Exclude Win64: 1 26 | Exclude iOS: 1 27 | data: 28 | first: 29 | '': OSXIntel 30 | second: 31 | enabled: 1 32 | settings: {} 33 | data: 34 | first: 35 | '': OSXIntel64 36 | second: 37 | enabled: 1 38 | settings: {} 39 | data: 40 | first: 41 | Android: Android 42 | second: 43 | enabled: 0 44 | settings: 45 | CPU: ARMv7 46 | data: 47 | first: 48 | Any: 49 | second: 50 | enabled: 0 51 | settings: {} 52 | data: 53 | first: 54 | Editor: Editor 55 | second: 56 | enabled: 1 57 | settings: 58 | CPU: x86_64 59 | DefaultValueInitialized: true 60 | OS: OSX 61 | data: 62 | first: 63 | Facebook: Win 64 | second: 65 | enabled: 0 66 | settings: 67 | CPU: AnyCPU 68 | data: 69 | first: 70 | Facebook: Win64 71 | second: 72 | enabled: 0 73 | settings: 74 | CPU: AnyCPU 75 | data: 76 | first: 77 | Standalone: Linux 78 | second: 79 | enabled: 0 80 | settings: 81 | CPU: x86 82 | data: 83 | first: 84 | Standalone: Linux64 85 | second: 86 | enabled: 0 87 | settings: 88 | CPU: x86_64 89 | data: 90 | first: 91 | Standalone: LinuxUniversal 92 | second: 93 | enabled: 0 94 | settings: 95 | CPU: None 96 | data: 97 | first: 98 | Standalone: OSXIntel 99 | second: 100 | enabled: 1 101 | settings: 102 | CPU: AnyCPU 103 | data: 104 | first: 105 | Standalone: OSXIntel64 106 | second: 107 | enabled: 1 108 | settings: 109 | CPU: AnyCPU 110 | data: 111 | first: 112 | Standalone: OSXUniversal 113 | second: 114 | enabled: 1 115 | settings: 116 | CPU: AnyCPU 117 | data: 118 | first: 119 | Standalone: Win 120 | second: 121 | enabled: 0 122 | settings: 123 | CPU: AnyCPU 124 | data: 125 | first: 126 | Standalone: Win64 127 | second: 128 | enabled: 0 129 | settings: 130 | CPU: AnyCPU 131 | data: 132 | first: 133 | iPhone: iOS 134 | second: 135 | enabled: 0 136 | settings: 137 | AddToEmbeddedBinaries: false 138 | CompileFlags: 139 | FrameworkDependencies: 140 | userData: 141 | assetBundleName: 142 | assetBundleVariant: 143 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/win.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a961485c3484a4002ac4961a8481f6cc 3 | folderAsset: yes 4 | timeCreated: 1521595360 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/win/native.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af9f9f367bbc543b8ba41e58dcdd6e66 3 | folderAsset: yes 4 | timeCreated: 1521595360 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/win/native/grpc_csharp_ext.x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/win/native/grpc_csharp_ext.x64.dll -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/win/native/grpc_csharp_ext.x64.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4d9429fe43154fbd9d158c129e0ff33 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 0 18 | Exclude Linux: 0 19 | Exclude Linux64: 0 20 | Exclude LinuxUniversal: 0 21 | Exclude OSXUniversal: 0 22 | Exclude Win: 1 23 | Exclude Win64: 0 24 | Exclude iOS: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: ARMv7 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 1 40 | settings: 41 | CPU: x86_64 42 | DefaultValueInitialized: true 43 | OS: Windows 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: None 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: AnyCPU 56 | - first: 57 | Standalone: Linux 58 | second: 59 | enabled: 1 60 | settings: 61 | CPU: x86 62 | - first: 63 | Standalone: Linux64 64 | second: 65 | enabled: 1 66 | settings: 67 | CPU: x86_64 68 | - first: 69 | Standalone: LinuxUniversal 70 | second: 71 | enabled: 1 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: OSXUniversal 76 | second: 77 | enabled: 1 78 | settings: 79 | CPU: AnyCPU 80 | - first: 81 | Standalone: Win 82 | second: 83 | enabled: 0 84 | settings: 85 | CPU: None 86 | - first: 87 | Standalone: Win64 88 | second: 89 | enabled: 1 90 | settings: 91 | CPU: AnyCPU 92 | - first: 93 | iPhone: iOS 94 | second: 95 | enabled: 0 96 | settings: 97 | AddToEmbeddedBinaries: false 98 | CompileFlags: 99 | FrameworkDependencies: 100 | userData: 101 | assetBundleName: 102 | assetBundleVariant: 103 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/win/native/grpc_csharp_ext.x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/win/native/grpc_csharp_ext.x86.dll -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/ProtoBuffer/runtimes/win/native/grpc_csharp_ext.x86.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d74134114def74fb4ae781c015deaa95 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | '': Any 13 | second: 14 | enabled: 0 15 | settings: 16 | Exclude Android: 1 17 | Exclude Editor: 0 18 | Exclude Linux: 0 19 | Exclude Linux64: 0 20 | Exclude LinuxUniversal: 0 21 | Exclude OSXUniversal: 0 22 | Exclude Win: 0 23 | Exclude Win64: 1 24 | Exclude iOS: 1 25 | - first: 26 | Android: Android 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: ARMv7 31 | - first: 32 | Any: 33 | second: 34 | enabled: 0 35 | settings: {} 36 | - first: 37 | Editor: Editor 38 | second: 39 | enabled: 1 40 | settings: 41 | CPU: x86 42 | DefaultValueInitialized: true 43 | OS: Windows 44 | - first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Facebook: Win64 52 | second: 53 | enabled: 0 54 | settings: 55 | CPU: None 56 | - first: 57 | Standalone: Linux 58 | second: 59 | enabled: 1 60 | settings: 61 | CPU: x86 62 | - first: 63 | Standalone: Linux64 64 | second: 65 | enabled: 1 66 | settings: 67 | CPU: x86_64 68 | - first: 69 | Standalone: LinuxUniversal 70 | second: 71 | enabled: 1 72 | settings: 73 | CPU: AnyCPU 74 | - first: 75 | Standalone: OSXUniversal 76 | second: 77 | enabled: 1 78 | settings: 79 | CPU: AnyCPU 80 | - first: 81 | Standalone: Win 82 | second: 83 | enabled: 1 84 | settings: 85 | CPU: AnyCPU 86 | - first: 87 | Standalone: Win64 88 | second: 89 | enabled: 0 90 | settings: 91 | CPU: None 92 | - first: 93 | iPhone: iOS 94 | second: 95 | enabled: 0 96 | settings: 97 | AddToEmbeddedBinaries: false 98 | CompileFlags: 99 | FrameworkDependencies: 100 | userData: 101 | assetBundleName: 102 | assetBundleVariant: 103 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/System.IO.Abstractions.TestingHelpers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/System.IO.Abstractions.TestingHelpers.dll -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/System.IO.Abstractions.TestingHelpers.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d7ba4e1037b64de5b860bcbe15755b3 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | Any: 13 | second: 14 | enabled: 1 15 | settings: {} 16 | - first: 17 | Editor: Editor 18 | second: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | - first: 23 | Windows Store Apps: WindowsStoreApps 24 | second: 25 | enabled: 0 26 | settings: 27 | CPU: AnyCPU 28 | userData: 29 | assetBundleName: 30 | assetBundleVariant: 31 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/System.IO.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Plugins/System.IO.Abstractions.dll -------------------------------------------------------------------------------- /Assets/ML-Agents/Plugins/System.IO.Abstractions.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b01205587773841ad95e8ceda347e8bd 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | isOverridable: 0 10 | platformData: 11 | - first: 12 | Any: 13 | second: 14 | enabled: 1 15 | settings: {} 16 | - first: 17 | Editor: Editor 18 | second: 19 | enabled: 0 20 | settings: 21 | DefaultValueInitialized: true 22 | - first: 23 | Windows Store Apps: WindowsStoreApps 24 | second: 25 | enabled: 0 26 | settings: 27 | CPU: AnyCPU 28 | userData: 29 | assetBundleName: 30 | assetBundleVariant: 31 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b3ab22264a5447df9e52684598ac3b0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Resources/DemoIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/ML-Agents/Resources/DemoIcon.png -------------------------------------------------------------------------------- /Assets/ML-Agents/Resources/DemoIcon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3352a0e8d253b4a4ea3782a6d7e09d9b 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 4 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | seamlessCubemap: 0 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | serializedVersion: 2 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapU: -1 36 | wrapV: -1 37 | wrapW: -1 38 | nPOTScale: 1 39 | lightmap: 0 40 | compressionQuality: 50 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spritePixelsToUnits: 100 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spriteGenerateFallbackPhysicsShape: 1 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 | resizeAlgorithm: 0 61 | textureFormat: -1 62 | textureCompression: 1 63 | compressionQuality: 50 64 | crunchedCompression: 0 65 | allowsAlphaSplitting: 0 66 | overridden: 0 67 | androidETC2FallbackOverride: 0 68 | - buildTarget: Standalone 69 | maxTextureSize: 2048 70 | resizeAlgorithm: 0 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | androidETC2FallbackOverride: 0 78 | spriteSheet: 79 | serializedVersion: 2 80 | sprites: [] 81 | outline: [] 82 | physicsShape: [] 83 | spritePackingTag: 84 | userData: 85 | assetBundleName: 86 | assetBundleVariant: 87 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/ActionMasker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a0ec4ccf4ee450da7766f65228d5460 3 | timeCreated: 1534530911 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/BCTeacherHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace MLAgents 4 | { 5 | /// 6 | /// Behavioral Cloning Helper script. Attach to teacher agent to enable 7 | /// resetting the experience buffer, as well as toggling session recording. 8 | /// 9 | public class BcTeacherHelper : MonoBehaviour 10 | { 11 | bool m_RecordExperiences; 12 | bool m_ResetBuffer; 13 | Agent m_MyAgent; 14 | float m_BufferResetTime; 15 | 16 | public KeyCode recordKey = KeyCode.R; 17 | public KeyCode resetKey = KeyCode.C; 18 | 19 | // Use this for initialization 20 | void Start() 21 | { 22 | m_RecordExperiences = true; 23 | m_ResetBuffer = false; 24 | m_MyAgent = GetComponent(); 25 | m_BufferResetTime = Time.time; 26 | } 27 | 28 | // Update is called once per frame 29 | void Update() 30 | { 31 | if (Input.GetKeyDown(recordKey)) 32 | { 33 | m_RecordExperiences = !m_RecordExperiences; 34 | } 35 | 36 | if (Input.GetKeyDown(resetKey)) 37 | { 38 | m_ResetBuffer = true; 39 | m_BufferResetTime = Time.time; 40 | } 41 | else 42 | { 43 | m_ResetBuffer = false; 44 | } 45 | 46 | Monitor.Log("Recording experiences " + recordKey, m_RecordExperiences.ToString()); 47 | var timeSinceBufferReset = Time.time - m_BufferResetTime; 48 | Monitor.Log("Seconds since buffer reset " + resetKey, 49 | Mathf.FloorToInt(timeSinceBufferReset).ToString()); 50 | } 51 | 52 | void FixedUpdate() 53 | { 54 | // Convert both bools into single comma separated string. Python makes 55 | // assumption that this structure is preserved. 56 | m_MyAgent.SetTextObs(m_RecordExperiences + "," + m_ResetBuffer); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/BCTeacherHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1cf16abc39fb4d6ca81222fc73d1bb5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Batcher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4243d5dc0ad5746cba578575182f8c17 3 | timeCreated: 1523045876 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Brain.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace MLAgents 5 | { 6 | /// 7 | /// Brain receive data from Agents through calls to SendState. The brain then updates the 8 | /// actions of the agents at each FixedUpdate. 9 | /// The Brain encapsulates the decision making process. Every Agent must be assigned a Brain, 10 | /// but you can use the same Brain with more than one Agent. You can also create several 11 | /// Brains, attach each of the Brain to one or more than one Agent. 12 | /// Brain assets has several important properties that you can set using the Inspector window. 13 | /// These properties must be appropriate for the Agents using the Brain. For example, the 14 | /// Vector Observation Space Size property must match the length of the feature 15 | /// vector created by an Agent exactly. 16 | /// 17 | public abstract class Brain : ScriptableObject 18 | { 19 | [SerializeField] public BrainParameters brainParameters; 20 | 21 | protected Dictionary m_AgentInfos = 22 | new Dictionary(1024); 23 | 24 | protected Batcher m_BrainBatcher; 25 | 26 | [System.NonSerialized] 27 | private bool m_IsInitialized; 28 | 29 | /// 30 | /// Sets the Batcher of the Brain. The brain will call the batcher at every step and give 31 | /// it the agent's data using SendBrainInfo at each DecideAction call. 32 | /// 33 | /// The Batcher the brain will use for the current session 34 | public void SetBatcher(Batcher batcher) 35 | { 36 | if (batcher == null) 37 | { 38 | m_BrainBatcher = null; 39 | } 40 | else 41 | { 42 | m_BrainBatcher = batcher; 43 | m_BrainBatcher.SubscribeBrain(name); 44 | } 45 | LazyInitialize(); 46 | } 47 | 48 | /// 49 | /// Adds the data of an agent to the current batch so it will be processed in DecideAction. 50 | /// 51 | /// 52 | /// 53 | public void SendState(Agent agent, AgentInfo info) 54 | { 55 | LazyInitialize(); 56 | m_AgentInfos.Add(agent, info); 57 | } 58 | 59 | /// 60 | /// If the Brain is not initialized, it subscribes to the Academy's DecideAction Event and 61 | /// calls the Initialize method to be implemented by child classes. 62 | /// 63 | private void LazyInitialize() 64 | { 65 | if (!m_IsInitialized) 66 | { 67 | var academy = FindObjectOfType(); 68 | if (academy) 69 | { 70 | academy.BrainDecideAction += BrainDecideAction; 71 | academy.DestroyAction += Shutdown; 72 | Initialize(); 73 | m_IsInitialized = true; 74 | } 75 | } 76 | } 77 | 78 | /// 79 | /// Called by the Academy when it shuts down. This ensures that the Brain cleans up properly 80 | /// after scene changes. 81 | /// 82 | private void Shutdown() 83 | { 84 | if (m_IsInitialized) 85 | { 86 | m_AgentInfos.Clear(); 87 | 88 | m_IsInitialized = false; 89 | } 90 | } 91 | 92 | /// 93 | /// Calls the DecideAction method that the concrete brain implements. 94 | /// 95 | private void BrainDecideAction() 96 | { 97 | m_BrainBatcher?.SendBrainInfo(name, m_AgentInfos); 98 | DecideAction(); 99 | } 100 | 101 | /// 102 | /// Is called only once at the begening of the training or inference session. 103 | /// 104 | protected abstract void Initialize(); 105 | 106 | /// 107 | /// Is called once per Environment Step after the Brain has been initialized. 108 | /// 109 | protected abstract void DecideAction(); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/BrainParameters.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6108a41e9be04c238d7babaed4476134 3 | timeCreated: 1538758934 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/BroadcastHub.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.Serialization; 4 | 5 | namespace MLAgents 6 | { 7 | /// 8 | /// BroadcastHub holds reference to brains and keeps track wether or not the brain be 9 | /// remotely controlled. 10 | /// 11 | [System.Serializable] 12 | public class BroadcastHub 13 | { 14 | [SerializeField] 15 | public List broadcastingBrains = new List(); 16 | [FormerlySerializedAs("_brainsToControl")] 17 | [SerializeField] 18 | private List m_BrainsToControl = new List(); 19 | 20 | /// 21 | /// The number of Brains inside the BroadcastingHub. 22 | /// 23 | public int Count 24 | { 25 | get { return broadcastingBrains.Count; } 26 | } 27 | 28 | /// 29 | /// Checks that a given Brain is set to be remote controlled. 30 | /// 31 | /// The Brain that is beeing checked 32 | /// true if the Brain is set to Controlled and false otherwise. Will return 33 | /// false if the Brain is not present in the Hub. 34 | public bool IsControlled(Brain brain) 35 | { 36 | return m_BrainsToControl.Contains(brain); 37 | } 38 | 39 | /// 40 | /// Sets a brain to controlled. 41 | /// 42 | /// The Brain that is being set to controlled 43 | /// if true, the Brain will be set to remote controlled. Otherwise 44 | /// the brain will be set to broadcast only. 45 | public void SetControlled(Brain brain, bool controlled) 46 | { 47 | if (broadcastingBrains.Contains(brain)) 48 | { 49 | if (controlled && !m_BrainsToControl.Contains(brain)) 50 | { 51 | m_BrainsToControl.Add(brain); 52 | } 53 | 54 | if (!controlled && m_BrainsToControl.Contains(brain)) 55 | { 56 | m_BrainsToControl.Remove(brain); 57 | } 58 | } 59 | } 60 | 61 | /// 62 | /// Removes all the Brains of the BroadcastHub 63 | /// 64 | public void Clear() 65 | { 66 | broadcastingBrains.Clear(); 67 | m_BrainsToControl.Clear(); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/BroadcastHub.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e43fd511c9f147e487d80e0bab3f6c6b 3 | timeCreated: 1536851538 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ebeef5df83b74a048b7f99681672f3b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/AgentActionProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4482f127d4a874cf8a11da2b2cc27dc9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/AgentInfoProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 791522439b8324bff85f84309db90ecc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/BrainParametersProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b41acc4d406e4a3c94df3399b2a6471 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/CommandProto.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by the protocol buffer compiler. DO NOT EDIT! 3 | // source: mlagents/envs/communicator_objects/command_proto.proto 4 | // 5 | #pragma warning disable 1591, 0612, 3021 6 | #region Designer generated code 7 | 8 | using pb = global::Google.Protobuf; 9 | using pbc = global::Google.Protobuf.Collections; 10 | using pbr = global::Google.Protobuf.Reflection; 11 | using scg = global::System.Collections.Generic; 12 | namespace MLAgents.CommunicatorObjects { 13 | 14 | /// Holder for reflection information generated from mlagents/envs/communicator_objects/command_proto.proto 15 | public static partial class CommandProtoReflection { 16 | 17 | #region Descriptor 18 | /// File descriptor for mlagents/envs/communicator_objects/command_proto.proto 19 | public static pbr::FileDescriptor Descriptor { 20 | get { return descriptor; } 21 | } 22 | private static pbr::FileDescriptor descriptor; 23 | 24 | static CommandProtoReflection() { 25 | byte[] descriptorData = global::System.Convert.FromBase64String( 26 | string.Concat( 27 | "CjZtbGFnZW50cy9lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL2NvbW1hbmRf", 28 | "cHJvdG8ucHJvdG8SFGNvbW11bmljYXRvcl9vYmplY3RzKi0KDENvbW1hbmRQ", 29 | "cm90bxIICgRTVEVQEAASCQoFUkVTRVQQARIICgRRVUlUEAJCH6oCHE1MQWdl", 30 | "bnRzLkNvbW11bmljYXRvck9iamVjdHNiBnByb3RvMw==")); 31 | descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, 32 | new pbr::FileDescriptor[] { }, 33 | new pbr::GeneratedClrTypeInfo(new[] {typeof(global::MLAgents.CommunicatorObjects.CommandProto), }, null)); 34 | } 35 | #endregion 36 | 37 | } 38 | #region Enums 39 | public enum CommandProto { 40 | [pbr::OriginalName("STEP")] Step = 0, 41 | [pbr::OriginalName("RESET")] Reset = 1, 42 | [pbr::OriginalName("QUIT")] Quit = 2, 43 | } 44 | 45 | #endregion 46 | 47 | } 48 | 49 | #endregion Designer generated code 50 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/CommandProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b2ff9fe2c38b4e79aba78908cc5492c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/CustomAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8d11b50ed9ce45f7827f5117b65db06 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/CustomObservation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 896847c1364a7475d9094058ff93b7f0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/CustomResetParameters.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a071e48ae56b2424e8b59aad01646f59 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/DemonstrationMetaProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7abfeda342414e059423ef90ede4c30 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/EngineConfigurationProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cebeb1263d7846b4b3c7c6e5d5e193f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/EnvironmentParametersProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be8c5f75bdcff41488a8e85748541100 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/Header.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8bb8aabfab48b408381733bccccd5af9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/ResolutionProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eae234f817240444a9d18b3d7366f260 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/SpaceTypeProto.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by the protocol buffer compiler. DO NOT EDIT! 3 | // source: mlagents/envs/communicator_objects/space_type_proto.proto 4 | // 5 | #pragma warning disable 1591, 0612, 3021 6 | #region Designer generated code 7 | 8 | using pb = global::Google.Protobuf; 9 | using pbc = global::Google.Protobuf.Collections; 10 | using pbr = global::Google.Protobuf.Reflection; 11 | using scg = global::System.Collections.Generic; 12 | namespace MLAgents.CommunicatorObjects { 13 | 14 | /// Holder for reflection information generated from mlagents/envs/communicator_objects/space_type_proto.proto 15 | public static partial class SpaceTypeProtoReflection { 16 | 17 | #region Descriptor 18 | /// File descriptor for mlagents/envs/communicator_objects/space_type_proto.proto 19 | public static pbr::FileDescriptor Descriptor { 20 | get { return descriptor; } 21 | } 22 | private static pbr::FileDescriptor descriptor; 23 | 24 | static SpaceTypeProtoReflection() { 25 | byte[] descriptorData = global::System.Convert.FromBase64String( 26 | string.Concat( 27 | "CjltbGFnZW50cy9lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL3NwYWNlX3R5", 28 | "cGVfcHJvdG8ucHJvdG8SFGNvbW11bmljYXRvcl9vYmplY3RzGjltbGFnZW50", 29 | "cy9lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL3Jlc29sdXRpb25fcHJvdG8u", 30 | "cHJvdG8qLgoOU3BhY2VUeXBlUHJvdG8SDAoIZGlzY3JldGUQABIOCgpjb250", 31 | "aW51b3VzEAFCH6oCHE1MQWdlbnRzLkNvbW11bmljYXRvck9iamVjdHNiBnBy", 32 | "b3RvMw==")); 33 | descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, 34 | new pbr::FileDescriptor[] { global::MLAgents.CommunicatorObjects.ResolutionProtoReflection.Descriptor, }, 35 | new pbr::GeneratedClrTypeInfo(new[] {typeof(global::MLAgents.CommunicatorObjects.SpaceTypeProto), }, null)); 36 | } 37 | #endregion 38 | 39 | } 40 | #region Enums 41 | public enum SpaceTypeProto { 42 | [pbr::OriginalName("discrete")] Discrete = 0, 43 | [pbr::OriginalName("continuous")] Continuous = 1, 44 | } 45 | 46 | #endregion 47 | 48 | } 49 | 50 | #endregion Designer generated code 51 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/SpaceTypeProto.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e61637749b07412284363ff304da763 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityInput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25e46cd9eca204e19a08fa938802ef9d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityMessage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d270bf9ce3d564bb48b2095802c15ff9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityOutput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b7166f97831f45ef86df5eed0042240 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityRlInitializationInput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c81750abd5a9432babe1834534122c0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityRlInitializationOutput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7ac9dd525a2246688054b2442eda28a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityRlInput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 24680ffa432734c09b4660d82303cbd2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityRlOutput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af13b8fefefa74a948934dd273f94c4a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityToExternal.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Generated by the protocol buffer compiler. DO NOT EDIT! 3 | // source: mlagents/envs/communicator_objects/unity_to_external.proto 4 | // 5 | #pragma warning disable 1591, 0612, 3021 6 | #region Designer generated code 7 | 8 | using pb = global::Google.Protobuf; 9 | using pbc = global::Google.Protobuf.Collections; 10 | using pbr = global::Google.Protobuf.Reflection; 11 | using scg = global::System.Collections.Generic; 12 | namespace MLAgents.CommunicatorObjects { 13 | 14 | /// Holder for reflection information generated from mlagents/envs/communicator_objects/unity_to_external.proto 15 | public static partial class UnityToExternalReflection { 16 | 17 | #region Descriptor 18 | /// File descriptor for mlagents/envs/communicator_objects/unity_to_external.proto 19 | public static pbr::FileDescriptor Descriptor { 20 | get { return descriptor; } 21 | } 22 | private static pbr::FileDescriptor descriptor; 23 | 24 | static UnityToExternalReflection() { 25 | byte[] descriptorData = global::System.Convert.FromBase64String( 26 | string.Concat( 27 | "CjptbGFnZW50cy9lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL3VuaXR5X3Rv", 28 | "X2V4dGVybmFsLnByb3RvEhRjb21tdW5pY2F0b3Jfb2JqZWN0cxo2bWxhZ2Vu", 29 | "dHMvZW52cy9jb21tdW5pY2F0b3Jfb2JqZWN0cy91bml0eV9tZXNzYWdlLnBy", 30 | "b3RvMmcKD1VuaXR5VG9FeHRlcm5hbBJUCghFeGNoYW5nZRIiLmNvbW11bmlj", 31 | "YXRvcl9vYmplY3RzLlVuaXR5TWVzc2FnZRoiLmNvbW11bmljYXRvcl9vYmpl", 32 | "Y3RzLlVuaXR5TWVzc2FnZSIAQh+qAhxNTEFnZW50cy5Db21tdW5pY2F0b3JP", 33 | "YmplY3RzYgZwcm90bzM=")); 34 | descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, 35 | new pbr::FileDescriptor[] { global::MLAgents.CommunicatorObjects.UnityMessageReflection.Descriptor, }, 36 | new pbr::GeneratedClrTypeInfo(null, null)); 37 | } 38 | #endregion 39 | 40 | } 41 | } 42 | 43 | #endregion Designer generated code 44 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityToExternal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 199e76fc828bc4561abad51402438e07 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/CommunicatorObjects/UnityToExternalGrpc.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0378b2871a6c649f69c2f32d5c0fb045 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Decision.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace MLAgents 5 | { 6 | /// 7 | /// Interface for implementing the behavior of an Agent that uses a Heuristic 8 | /// Brain. The behavior of an Agent in this case is fully decided using the 9 | /// implementation of these methods and no training or inference takes place. 10 | /// Currently, the Heuristic Brain does not support text observations and actions. 11 | /// 12 | public abstract class Decision : ScriptableObject 13 | { 14 | public BrainParameters brainParameters; 15 | 16 | /// 17 | /// Defines the decision-making logic of the agent. Given the information 18 | /// about the agent, returns a vector of actions. 19 | /// 20 | /// Vector action vector. 21 | /// The vector observations of the agent. 22 | /// The cameras the agent uses for visual observations. 23 | /// The reward the agent received at the previous step. 24 | /// Whether or not the agent is done. 25 | /// 26 | /// The memories stored from the previous step with 27 | /// 28 | /// 29 | public abstract float[] Decide( 30 | List 31 | vectorObs, 32 | List visualObs, 33 | float reward, 34 | bool done, 35 | List memory); 36 | 37 | /// 38 | /// Defines the logic for creating the memory vector for the Agent. 39 | /// 40 | /// The vector of memories the agent will use at the next step. 41 | /// The vector observations of the agent. 42 | /// The cameras the agent uses for visual observations. 43 | /// The reward the agent received at the previous step. 44 | /// Whether or not the agent is done. 45 | /// 46 | /// The memories stored from the previous call to this method. 47 | /// 48 | public abstract List MakeMemory( 49 | List vectorObs, 50 | List visualObs, 51 | float reward, 52 | bool done, 53 | List memory); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Demonstration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MLAgents.CommunicatorObjects; 3 | using UnityEngine; 4 | 5 | namespace MLAgents 6 | { 7 | /// 8 | /// Demonstration Object. Contains meta-data regarding demonstration. 9 | /// Used for imitation learning, or other forms of learning from data. 10 | /// 11 | [Serializable] 12 | public class Demonstration : ScriptableObject 13 | { 14 | public DemonstrationMetaData metaData; 15 | public BrainParameters brainParameters; 16 | 17 | public void Initialize(BrainParameters brainParams, 18 | DemonstrationMetaData demonstrationMetaData) 19 | { 20 | brainParameters = brainParams; 21 | metaData = demonstrationMetaData; 22 | } 23 | } 24 | 25 | /// 26 | /// Demonstration meta-data. 27 | /// Kept in a struct for easy serialization and deserialization. 28 | /// 29 | [Serializable] 30 | public class DemonstrationMetaData 31 | { 32 | public int numberExperiences; 33 | public int numberEpisodes; 34 | public float meanReward; 35 | public string demonstrationName; 36 | public const int ApiVersion = 1; 37 | 38 | /// 39 | /// Constructor for initializing metadata to default values. 40 | /// 41 | public DemonstrationMetaData() 42 | { 43 | } 44 | 45 | /// 46 | /// Initialize metadata values based on proto object. 47 | /// 48 | public DemonstrationMetaData(DemonstrationMetaProto demoProto) 49 | { 50 | numberEpisodes = demoProto.NumberEpisodes; 51 | numberExperiences = demoProto.NumberSteps; 52 | meanReward = demoProto.MeanReward; 53 | demonstrationName = demoProto.DemonstrationName; 54 | if (demoProto.ApiVersion != ApiVersion) 55 | { 56 | throw new Exception("API versions of demonstration are incompatible."); 57 | } 58 | } 59 | 60 | /// 61 | /// Convert metadata object to proto object. 62 | /// 63 | public DemonstrationMetaProto ToProto() 64 | { 65 | var demoProto = new DemonstrationMetaProto 66 | { 67 | ApiVersion = ApiVersion, 68 | MeanReward = meanReward, 69 | NumberSteps = numberExperiences, 70 | NumberEpisodes = numberEpisodes, 71 | DemonstrationName = demonstrationName 72 | }; 73 | return demoProto; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Demonstration.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b651f66c75a1646c6ab48de06d0e13ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/DemonstrationRecorder.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Text.RegularExpressions; 3 | 4 | namespace MLAgents 5 | { 6 | /// 7 | /// Demonstration Recorder Component. 8 | /// 9 | [RequireComponent(typeof(Agent))] 10 | public class DemonstrationRecorder : MonoBehaviour 11 | { 12 | public bool record; 13 | public string demonstrationName; 14 | private Agent m_RecordingAgent; 15 | private string m_FilePath; 16 | private DemonstrationStore m_DemoStore; 17 | public const int MaxNameLength = 16; 18 | 19 | private void Start() 20 | { 21 | if (Application.isEditor && record) 22 | { 23 | InitializeDemoStore(); 24 | } 25 | } 26 | 27 | private void Update() 28 | { 29 | if (Application.isEditor && record && m_DemoStore == null) 30 | { 31 | InitializeDemoStore(); 32 | } 33 | } 34 | 35 | /// 36 | /// Creates demonstration store for use in recording. 37 | /// 38 | private void InitializeDemoStore() 39 | { 40 | m_RecordingAgent = GetComponent(); 41 | m_DemoStore = new DemonstrationStore(); 42 | demonstrationName = SanitizeName(demonstrationName, MaxNameLength); 43 | m_DemoStore.Initialize( 44 | demonstrationName, 45 | m_RecordingAgent.brain.brainParameters, 46 | m_RecordingAgent.brain.name); 47 | Monitor.Log("Recording Demonstration of Agent: ", m_RecordingAgent.name); 48 | } 49 | 50 | /// 51 | /// Removes all characters except alphanumerics from demonstration name. 52 | /// Shorten name if it is longer than the maxNameLength. 53 | /// 54 | public static string SanitizeName(string demoName, int maxNameLength) 55 | { 56 | var rgx = new Regex("[^a-zA-Z0-9 -]"); 57 | demoName = rgx.Replace(demoName, ""); 58 | // If the string is too long, it will overflow the metadata. 59 | if (demoName.Length > maxNameLength) 60 | { 61 | demoName = demoName.Substring(0, maxNameLength); 62 | } 63 | return demoName; 64 | } 65 | 66 | /// 67 | /// Forwards AgentInfo to Demonstration Store. 68 | /// 69 | public void WriteExperience(AgentInfo info) 70 | { 71 | m_DemoStore.Record(info); 72 | } 73 | 74 | /// 75 | /// Closes Demonstration store. 76 | /// 77 | private void OnApplicationQuit() 78 | { 79 | if (Application.isEditor && record && m_DemoStore != null) 80 | { 81 | m_DemoStore.Close(); 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/DemonstrationRecorder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50f710d360a49461cad67ff5e6bcefe1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/DemonstrationStore.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a79c7ccb2cd042b5b1e710b9588d921b 3 | timeCreated: 1537388072 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/HeuristicBrain.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Serialization; 3 | #if UNITY_EDITOR 4 | using UnityEditor; 5 | #endif 6 | 7 | namespace MLAgents 8 | { 9 | /// 10 | /// The Heuristic Brain type allows you to hand code an Agent's decision making process. 11 | /// A Heuristic Brain requires an implementation of the Decision interface to which it 12 | /// delegates the decision making process. 13 | /// When yusing a Heuristic Brain, you must give it a Monoscript of a Decision implementation. 14 | /// 15 | [CreateAssetMenu(fileName = "NewHeuristicBrain", menuName = "ML-Agents/Heuristic Brain")] 16 | public class HeuristicBrain : Brain 17 | { 18 | [SerializeField] 19 | [HideInInspector] 20 | public Decision decision; 21 | #if UNITY_EDITOR 22 | [HideInInspector] 23 | public MonoScript decisionScript; 24 | #endif 25 | [FormerlySerializedAs("c_decision")] 26 | [SerializeField] 27 | [HideInInspector] 28 | public string cDecision; 29 | 30 | public void OnValidate() 31 | { 32 | #if UNITY_EDITOR 33 | if (decisionScript != null) 34 | { 35 | cDecision = decisionScript.GetClass().Name; 36 | } 37 | else 38 | { 39 | cDecision = ""; 40 | } 41 | #endif 42 | } 43 | 44 | /// 45 | protected override void Initialize() 46 | { 47 | if ((cDecision != null) && decision == null) 48 | { 49 | decision = CreateInstance(cDecision) as Decision; 50 | decision.brainParameters = brainParameters; 51 | } 52 | } 53 | 54 | ///Uses the Decision Component to decide that action to take 55 | protected override void DecideAction() 56 | { 57 | if (decision == null) 58 | { 59 | throw new UnityAgentsException( 60 | "The Brain is set to Heuristic, but no decision script attached to it"); 61 | } 62 | foreach (var agent in m_AgentInfos.Keys) 63 | { 64 | agent.UpdateVectorAction(decision.Decide( 65 | m_AgentInfos[agent].stackedVectorObservation, 66 | m_AgentInfos[agent].visualObservations, 67 | m_AgentInfos[agent].reward, 68 | m_AgentInfos[agent].done, 69 | m_AgentInfos[agent].memories)); 70 | } 71 | foreach (var agent in m_AgentInfos.Keys) 72 | { 73 | agent.UpdateMemoriesAction(decision.MakeMemory( 74 | m_AgentInfos[agent].stackedVectorObservation, 75 | m_AgentInfos[agent].visualObservations, 76 | m_AgentInfos[agent].reward, 77 | m_AgentInfos[agent].done, 78 | m_AgentInfos[agent].memories)); 79 | } 80 | m_AgentInfos.Clear(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/HeuristicBrain.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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/ICommunicator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using MLAgents.CommunicatorObjects; 3 | 4 | namespace MLAgents 5 | { 6 | public struct CommunicatorParameters 7 | { 8 | public int port; 9 | } 10 | 11 | /** 12 | This is the interface of the Communicators. 13 | This does not need to be modified nor implemented to create a Unity environment. 14 | 15 | When the Unity Communicator is initialized, it will wait for the External Communicator 16 | to be initialized as well. The two communicators will then exchange their first messages 17 | that will usually contain information for initialization (information that does not need 18 | to be resent at each new exchange). 19 | 20 | By convention a Unity input is from External to Unity and a Unity output is from Unity to 21 | External. Inputs and outputs are relative to Unity. 22 | 23 | By convention, when the Unity Communicator and External Communicator call exchange, the 24 | exchange is NOT simultaneous but sequential. This means that when a side of the 25 | communication calls exchange, the other will receive the result of its previous 26 | exchange call. 27 | This is what happens when A calls exchange a single time: 28 | A sends data_1 to B -> B receives data_1 -> B generates and sends data_2 -> A receives data_2 29 | When A calls exchange, it sends data_1 and receives data_2 30 | 31 | Since the messages are sent back and forth with exchange and simultaneously when calling 32 | initialize, External sends two messages at initialization. 33 | 34 | The structure of the messages is as follows: 35 | UnityMessage 36 | ...Header 37 | ...UnityOutput 38 | ......UnityRLOutput 39 | ......UnityRLInitializationOutput 40 | ...UnityInput 41 | ......UnityRLIntput 42 | ......UnityRLInitializationIntput 43 | 44 | UnityOutput and UnityInput can be extended to provide functionalities beyond RL 45 | UnityRLOutput and UnityRLInput can be extended to provide new RL functionalities 46 | */ 47 | public interface ICommunicator 48 | { 49 | /// 50 | /// Initialize the communicator by sending the first UnityOutput and receiving the 51 | /// first UnityInput. The second UnityInput is stored in the unityInput argument. 52 | /// 53 | /// The first Unity Input. 54 | /// The first Unity Output. 55 | /// The second Unity input. 56 | UnityInput Initialize(UnityOutput unityOutput, 57 | out UnityInput unityInput); 58 | 59 | /// 60 | /// Send a UnityOutput and receives a UnityInput. 61 | /// 62 | /// The next UnityInput. 63 | /// The UnityOutput to be sent. 64 | UnityInput Exchange(UnityOutput unityOutput); 65 | 66 | /// 67 | /// Close the communicator gracefully on both sides of the communication. 68 | /// 69 | void Close(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/ICommunicator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53977f05e5684d4a9e2ef86f225934a2 3 | timeCreated: 1568395551 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79c170c0af66140e68d7eca827f0d788 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/ApplierImpl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99d5dc2d52e442d1a1f466a246cfb28d 3 | timeCreated: 1539118675 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/BarracudaModelParamLoader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 399c5e92395a1484cb2808ac397745e1 3 | timeCreated: 1539197357 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/GeneratorImpl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c57a4989c7e54b93ab56293698d7d237 3 | timeCreated: 1539109542 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/TensorApplier.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1bef4f4ae72645108f16614355473e8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/TensorGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a24e86bc77c4a5088a5fd04d6d30e81 3 | timeCreated: 1537484304 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/TensorNames.cs: -------------------------------------------------------------------------------- 1 | namespace MLAgents.InferenceBrain 2 | { 3 | /// 4 | /// Contains the names of the input and output tensors for the Inference Brain. 5 | /// 6 | public static class TensorNames 7 | { 8 | public const string BatchSizePlaceholder = "batch_size"; 9 | public const string SequenceLengthPlaceholder = "sequence_length"; 10 | public const string VectorObservationPlacholder = "vector_observation"; 11 | public const string RecurrentInPlaceholder = "recurrent_in"; 12 | public const string recurrentInPlaceholderH = "recurrent_in_h"; 13 | public const string recurrentInPlaceholderC = "recurrent_in_c"; 14 | public const string VisualObservationPlaceholderPrefix = "visual_observation_"; 15 | public const string PreviousActionPlaceholder = "prev_action"; 16 | public const string ActionMaskPlaceholder = "action_masks"; 17 | public const string RandomNormalEpsilonPlaceholder = "epsilon"; 18 | 19 | public const string ValueEstimateOutput = "value_estimate"; 20 | public const string RecurrentOutput = "recurrent_out"; 21 | public const string recurrentOutputH = "recurrent_out_h"; 22 | public const string recurrentOutputC = "recurrent_out_c"; 23 | public const string MemorySize = "memory_size"; 24 | public const string VersionNumber = "version_number"; 25 | public const string IsContinuousControl = "is_continuous_control"; 26 | public const string ActionOutputShape = "action_output_shape"; 27 | public const string ActionOutput = "action"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/TensorNames.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b28a46ea97c2445794d29d5a8a718a4a 3 | timeCreated: 1538158527 -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/TensorProxy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 926149e757bc849689e00e12d8c6fbdb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7872e22895343467b9fe96d336a7edba 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/Utils/Multinomial.cs: -------------------------------------------------------------------------------- 1 | namespace MLAgents.InferenceBrain.Utils 2 | { 3 | /// 4 | /// Multinomial - Draws samples from a multinomial distribution given a (potentially unscaled) 5 | /// cumulative mass function (CMF). This means that the CMF need not "end" with probability 6 | /// mass of 1.0. For instance: [0.1, 0.2, 0.5] is a valid (unscaled). What is important is 7 | /// that it is a cumulative function, not a probability function. In other words, 8 | /// entry[i] = P(x \le i), NOT P(i - 1 \le x \lt i). 9 | /// (\le stands for less than or equal to while \lt is strictly less than). 10 | /// 11 | public class Multinomial 12 | { 13 | private readonly System.Random m_Random; 14 | 15 | /// 16 | /// Constructor. 17 | /// 18 | /// 19 | /// Seed for the random number generator used in the sampling process. 20 | /// 21 | public Multinomial(int seed) 22 | { 23 | m_Random = new System.Random(seed); 24 | } 25 | 26 | /// 27 | /// Samples from the Multinomial distribution defined by the provided cumulative 28 | /// mass function. 29 | /// 30 | /// 31 | /// Cumulative mass function, which may be unscaled. The entries in this array need 32 | /// to be monotonic (always increasing). If the CMF is scaled, then the last entry in 33 | /// the array will be 1.0. 34 | /// 35 | /// A sampled index from the CMF ranging from 0 to cmf.Length-1. 36 | public int Sample(float[] cmf) 37 | { 38 | var p = (float)m_Random.NextDouble() * cmf[cmf.Length - 1]; 39 | var cls = 0; 40 | while (cmf[cls] < p) 41 | { 42 | ++cls; 43 | } 44 | 45 | return cls; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/Utils/Multinomial.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c9e297dad748408db9e5ce26b940fe3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/Utils/RandomNormal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MLAgents.InferenceBrain.Utils 4 | { 5 | /// 6 | /// RandomNormal - A random number generator that produces normally distributed random 7 | /// numbers using the Marsaglia polar method: 8 | /// https://en.wikipedia.org/wiki/Marsaglia_polar_method 9 | /// TODO: worth overriding System.Random instead of aggregating? 10 | /// 11 | public class RandomNormal 12 | { 13 | private readonly double m_Mean; 14 | private readonly double m_Stddev; 15 | private readonly Random m_Random; 16 | 17 | public RandomNormal(int seed, float mean = 0.0f, float stddev = 1.0f) 18 | { 19 | m_Mean = mean; 20 | m_Stddev = stddev; 21 | m_Random = new Random(seed); 22 | } 23 | 24 | // Each iteration produces two numbers. Hold one here for next call 25 | private bool m_HasSpare; 26 | private double m_SpareUnscaled; 27 | 28 | /// 29 | /// Return the next random double number 30 | /// 31 | /// Next random double number 32 | public double NextDouble() 33 | { 34 | if (m_HasSpare) 35 | { 36 | m_HasSpare = false; 37 | return m_SpareUnscaled * m_Stddev + m_Mean; 38 | } 39 | 40 | double u, v, s; 41 | do 42 | { 43 | u = m_Random.NextDouble() * 2.0 - 1.0; 44 | v = m_Random.NextDouble() * 2.0 - 1.0; 45 | s = u * u + v * v; 46 | } 47 | while (s >= 1.0 || Math.Abs(s) < double.Epsilon); 48 | 49 | s = Math.Sqrt(-2.0 * Math.Log(s) / s); 50 | m_SpareUnscaled = u * s; 51 | m_HasSpare = true; 52 | 53 | return v * s * m_Stddev + m_Mean; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/InferenceBrain/Utils/RandomNormal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df8528cf20f0e4c64a4a7596eccc1631 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/LearningBrain.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b23992c8eb17439887f5e944bf04a40 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Monitor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e59a31a1cc2f5464d9a61bef0bc9a53b 3 | timeCreated: 1508031727 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/PlayerBrain.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Serialization; 3 | 4 | namespace MLAgents 5 | { 6 | /// 7 | /// Implemetation of the Player Brain. Inherits from the base class Brain. Allows the user to 8 | /// manually select decisions for linked agents by creating a mapping from keys presses to 9 | /// actions. 10 | /// You can use Player Brains to control a "teacher" Agent that trains other Agents during 11 | /// imitation learning. You can also use Player Brains to test your Agents and environment 12 | /// before training agents with reinforcement learning. 13 | /// 14 | [CreateAssetMenu(fileName = "NewPlayerBrain", menuName = "ML-Agents/Player Brain")] 15 | public class PlayerBrain : Brain 16 | { 17 | [System.Serializable] 18 | public struct DiscretePlayerAction 19 | { 20 | public KeyCode key; 21 | public int branchIndex; 22 | public int value; 23 | } 24 | 25 | [System.Serializable] 26 | public struct KeyContinuousPlayerAction 27 | { 28 | public KeyCode key; 29 | public int index; 30 | public float value; 31 | } 32 | 33 | [System.Serializable] 34 | public struct AxisContinuousPlayerAction 35 | { 36 | public string axis; 37 | public int index; 38 | public float scale; 39 | } 40 | 41 | /// Contains the mapping from input to continuous actions 42 | [SerializeField] 43 | [FormerlySerializedAs("continuousPlayerActions")] 44 | [Tooltip("The list of keys and the value they correspond to for continuous control.")] 45 | public KeyContinuousPlayerAction[] keyContinuousPlayerActions; 46 | 47 | /// Contains the mapping from input to continuous actions 48 | [SerializeField] 49 | [Tooltip("The list of axis actions.")] 50 | public AxisContinuousPlayerAction[] axisContinuousPlayerActions; 51 | 52 | /// Contains the mapping from input to discrete actions 53 | [SerializeField] 54 | [Tooltip("The list of keys and the value they correspond to for discrete control.")] 55 | public DiscretePlayerAction[] discretePlayerActions; 56 | 57 | protected override void Initialize() {} 58 | 59 | /// Uses the continuous inputs or dicrete inputs of the player to 60 | /// decide action 61 | protected override void DecideAction() 62 | { 63 | if (brainParameters.vectorActionSpaceType == SpaceType.Continuous) 64 | { 65 | foreach (var agent in m_AgentInfos.Keys) 66 | { 67 | var action = new float[brainParameters.vectorActionSize[0]]; 68 | foreach (var cha in keyContinuousPlayerActions) 69 | { 70 | if (Input.GetKey(cha.key)) 71 | { 72 | action[cha.index] = cha.value; 73 | } 74 | } 75 | foreach (var axisAction in axisContinuousPlayerActions) 76 | { 77 | var axisValue = Input.GetAxis(axisAction.axis); 78 | axisValue *= axisAction.scale; 79 | if (Mathf.Abs(axisValue) > 0.0001) 80 | { 81 | action[axisAction.index] = axisValue; 82 | } 83 | } 84 | agent.UpdateVectorAction(action); 85 | } 86 | } 87 | else 88 | { 89 | foreach (var agent in m_AgentInfos.Keys) 90 | { 91 | var action = new float[brainParameters.vectorActionSize.Length]; 92 | foreach (var dha in discretePlayerActions) 93 | { 94 | if (Input.GetKey(dha.key)) 95 | { 96 | action[dha.branchIndex] = dha.value; 97 | } 98 | } 99 | agent.UpdateVectorAction(action); 100 | } 101 | } 102 | m_AgentInfos.Clear(); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/PlayerBrain.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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/ResetParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Serialization; 5 | 6 | namespace MLAgents 7 | { 8 | [Serializable] 9 | public class ResetParameters : Dictionary, ISerializationCallbackReceiver 10 | { 11 | [Serializable] 12 | public struct ResetParameter 13 | { 14 | public string key; 15 | public float value; 16 | } 17 | 18 | [FormerlySerializedAs("resetParameters")] 19 | [SerializeField] private List m_ResetParameters = new List(); 20 | 21 | public void OnBeforeSerialize() 22 | { 23 | m_ResetParameters.Clear(); 24 | 25 | foreach (var pair in this) 26 | { 27 | var rp = new ResetParameter(); 28 | rp.key = pair.Key; 29 | 30 | rp.value = pair.Value; 31 | m_ResetParameters.Add(rp); 32 | } 33 | } 34 | 35 | public void OnAfterDeserialize() 36 | { 37 | Clear(); 38 | 39 | 40 | for (var i = 0; i < m_ResetParameters.Count; i++) 41 | { 42 | if (ContainsKey(m_ResetParameters[i].key)) 43 | { 44 | Debug.LogError("The ResetParameters contains the same key twice"); 45 | } 46 | else 47 | { 48 | Add(m_ResetParameters[i].key, m_ResetParameters[i].value); 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/ResetParameters.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af19281a4c1dd47518ac7501c45eca9f 3 | timeCreated: 1517261137 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/RpcCommunicator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57a3dc12d3b88408688bb490b65a838e 3 | timeCreated: 1523046536 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/SocketCommunicator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0901c57c84a54f25aa5955165072493 3 | timeCreated: 1523046536 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.SceneManagement; 4 | 5 | namespace MLAgents 6 | { 7 | public class Startup : MonoBehaviour 8 | { 9 | private const string k_SceneVariableName = "SCENE_NAME"; 10 | 11 | private void Awake() 12 | { 13 | var sceneName = Environment.GetEnvironmentVariable(k_SceneVariableName); 14 | SwitchScene(sceneName); 15 | } 16 | 17 | private static void SwitchScene(string sceneName) 18 | { 19 | if (sceneName == null) 20 | { 21 | throw new ArgumentException( 22 | $"You didn't specified the {k_SceneVariableName} environment variable"); 23 | } 24 | if (SceneUtility.GetBuildIndexByScenePath(sceneName) < 0) 25 | { 26 | throw new ArgumentException( 27 | $"The scene {sceneName} doesn't exist within your build. "); 28 | } 29 | SceneManager.LoadSceneAsync(sceneName); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Startup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23f416cde2a4347bebfbe2efe69d19b8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/UnityAgentsException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MLAgents 4 | { 5 | /// Contains exceptions specific to ML-Agents. 6 | [Serializable] 7 | public class UnityAgentsException : Exception 8 | { 9 | /// When a UnityAgentsException is called, the timeScale is set to 0. 10 | /// The simulation will end since no steps will be taken. 11 | public UnityAgentsException(string message) : base(message) 12 | { 13 | } 14 | 15 | /// A constructor is needed for serialization when an exception propagates 16 | /// from a remoting server to the client. 17 | protected UnityAgentsException( 18 | System.Runtime.Serialization.SerializationInfo info, 19 | System.Runtime.Serialization.StreamingContext context) 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/ML-Agents/Scripts/Utilities.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e664c25f496478c9c26df6688379f7e 3 | timeCreated: 1537468595 -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db2961499c9b99846817696458de32d7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Black.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Black 11 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 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: 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 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 0, g: 0, b: 0, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Materials/Black.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ea5dd380f00f1d4cae3dc8a945567d1 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Stroke.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Stroke 11 | m_Shader: {fileID: 10750, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 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: 368d195d5d6fa094982fcfd5f8e6dc8b, 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: 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 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Materials/Stroke.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff17a9d7f34f4524993c1724545a8b47 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/White.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: White 11 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 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: 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 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Materials/White.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9790f5c7e1c863419bf603bbf11ea15 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/NN Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a91e763a00a7bb449a633af73a907e9a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/NN Models/emnist_110317.nn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/NN Models/emnist_110317.nn -------------------------------------------------------------------------------- /Assets/NN Models/emnist_110317.nn.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2eccfd42b536e954e9ac0ec9d4ba9f4c 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 19ed1486aa27d4903b34839f37b8f69f, type: 3} 11 | -------------------------------------------------------------------------------- /Assets/NN Models/emnist_dense.nn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/Assets/NN Models/emnist_dense.nn -------------------------------------------------------------------------------- /Assets/NN Models/emnist_dense.nn.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7555b907fe4598f4fb8f02297890880d 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 19ed1486aa27d4903b34839f37b8f69f, type: 3} 11 | -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 514c1acbc03681b44af02cb7baa12045 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f99471e0b1620e04b94982d302770423 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82f221753a45e2d43bc034c35f02912f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Prefabs/Simple Black Line.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &1139013891536037174 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1139013891536037172} 12 | - component: {fileID: 1139013891536037175} 13 | m_Layer: 0 14 | m_Name: Simple Black Line 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!4 &1139013891536037172 21 | Transform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 1139013891536037174} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: [] 31 | m_Father: {fileID: 0} 32 | m_RootOrder: 0 33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 34 | --- !u!120 &1139013891536037175 35 | LineRenderer: 36 | m_ObjectHideFlags: 0 37 | m_CorrespondingSourceObject: {fileID: 0} 38 | m_PrefabInstance: {fileID: 0} 39 | m_PrefabAsset: {fileID: 0} 40 | m_GameObject: {fileID: 1139013891536037174} 41 | m_Enabled: 1 42 | m_CastShadows: 1 43 | m_ReceiveShadows: 1 44 | m_DynamicOccludee: 1 45 | m_MotionVectors: 0 46 | m_LightProbeUsage: 0 47 | m_ReflectionProbeUsage: 0 48 | m_RenderingLayerMask: 1 49 | m_RendererPriority: 0 50 | m_Materials: 51 | - {fileID: 2100000, guid: 6ea5dd380f00f1d4cae3dc8a945567d1, type: 2} 52 | m_StaticBatchInfo: 53 | firstSubMesh: 0 54 | subMeshCount: 0 55 | m_StaticBatchRoot: {fileID: 0} 56 | m_ProbeAnchor: {fileID: 0} 57 | m_LightProbeVolumeOverride: {fileID: 0} 58 | m_ScaleInLightmap: 1 59 | m_PreserveUVs: 0 60 | m_IgnoreNormalsForChartDetection: 0 61 | m_ImportantGI: 0 62 | m_StitchLightmapSeams: 1 63 | m_SelectedEditorRenderState: 3 64 | m_MinimumChartSize: 4 65 | m_AutoUVMaxDistance: 0.5 66 | m_AutoUVMaxAngle: 89 67 | m_LightmapParameters: {fileID: 0} 68 | m_SortingLayerID: 0 69 | m_SortingLayer: 0 70 | m_SortingOrder: 0 71 | m_Positions: [] 72 | m_Parameters: 73 | serializedVersion: 3 74 | widthMultiplier: 0.25 75 | widthCurve: 76 | serializedVersion: 2 77 | m_Curve: 78 | - serializedVersion: 3 79 | time: 0 80 | value: 1 81 | inSlope: 3.4023917 82 | outSlope: 3.4023917 83 | tangentMode: 0 84 | weightedMode: 0 85 | inWeight: 0.33333334 86 | outWeight: 0.24786325 87 | m_PreInfinity: 2 88 | m_PostInfinity: 2 89 | m_RotationOrder: 4 90 | colorGradient: 91 | serializedVersion: 2 92 | key0: {r: 0, g: 0, b: 0, a: 1} 93 | key1: {r: 0, g: 0, b: 0, a: 1} 94 | key2: {r: 0, g: 0, b: 0, a: 0} 95 | key3: {r: 0, g: 0, b: 0, a: 0} 96 | key4: {r: 0, g: 0, b: 0, a: 0} 97 | key5: {r: 0, g: 0, b: 0, a: 0} 98 | key6: {r: 0, g: 0, b: 0, a: 0} 99 | key7: {r: 0, g: 0, b: 0, a: 0} 100 | ctime0: 0 101 | ctime1: 65535 102 | ctime2: 0 103 | ctime3: 0 104 | ctime4: 0 105 | ctime5: 0 106 | ctime6: 0 107 | ctime7: 0 108 | atime0: 0 109 | atime1: 65535 110 | atime2: 0 111 | atime3: 0 112 | atime4: 0 113 | atime5: 0 114 | atime6: 0 115 | atime7: 0 116 | m_Mode: 0 117 | m_NumColorKeys: 2 118 | m_NumAlphaKeys: 2 119 | numCornerVertices: 0 120 | numCapVertices: 0 121 | alignment: 1 122 | textureMode: 1 123 | shadowBias: 0.5 124 | generateLightingData: 0 125 | m_UseWorldSpace: 0 126 | m_Loop: 0 127 | -------------------------------------------------------------------------------- /Assets/Prefabs/Simple Black Line.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f7a50b789da94f429bfdf0a2c209574 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Prefabs/Writing Surface (Mouse Raycast).prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 729f712e912dc574daa6d48e15a736d0 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Prefabs/Writing Surface (Pen Tip).prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f686b515914ba2144b92b99d607e623e 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cb485748731d6d4f957bd1b6e420e89 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50e5869a91aa3dc4fa2ac0674ddf9389 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/HandwritingAcademy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MLAgents; 4 | using UnityEngine; 5 | 6 | public class HandwritingAcademy : Academy 7 | { 8 | // Start is called before the first frame update 9 | void Start() 10 | { 11 | 12 | } 13 | 14 | // Update is called once per frame 15 | void Update() 16 | { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assets/Scripts/HandwritingAcademy.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0dbc33b65411e40468442de5c478d14c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/HandwritingAgent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a8f35ac52bd63f4e86e13eb1a86c7ec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Invert.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | /// 7 | /// Invert colors post-processing effect 8 | /// 9 | public class Invert : MonoBehaviour 10 | { 11 | /// 12 | /// Whether to invert the colors or not 13 | /// 14 | [Tooltip("Whether to invert the colors or not")] 15 | public bool invert = true; 16 | 17 | private Shader _invertShader; 18 | private Material _material; 19 | 20 | // Start is called before the first frame update 21 | void Start() 22 | { 23 | //create the material to use 24 | _invertShader = Shader.Find("Hidden/Invert"); 25 | _material = new Material(_invertShader); 26 | } 27 | 28 | // Update is called once per frame 29 | void Update() 30 | { 31 | 32 | } 33 | 34 | void OnRenderImage(RenderTexture src, RenderTexture dest) 35 | { 36 | if (invert) 37 | { 38 | // Copy the source Render Texture to the destination, 39 | // applying the material along the way. 40 | Graphics.Blit(src, dest, _material); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Assets/Scripts/Invert.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5560cf657e9cc1943a97f7f3aaf7c16d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/PenTipTriggerWriting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | /// 7 | /// Handwriting with a specified pen tip collider potentially manipulated by e.g. VR hand controllers 8 | /// 9 | [RequireComponent(typeof(Collider))] 10 | public class PenTipTriggerWriting : Writing 11 | { 12 | /// 13 | /// Index of layer which specifies that an object is a pen tip 14 | /// 15 | [Tooltip("Index of layer which specifies that an object is a pen tip")] 16 | public int penTipLayerIndex; 17 | 18 | /// 19 | /// Update current line based on collision event, called on both collision enter and stay 20 | /// 21 | /// collision data from event 22 | void UpdateOnCollision(Collision other) 23 | { 24 | if (other.collider.gameObject.layer == penTipLayerIndex) 25 | { 26 | ContactPoint cp = other.contacts[0]; 27 | Plane myPlane = new Plane(transform.up,transform.position); //plane representation of this surface 28 | //do a plane cast on contact point for more consistent results 29 | if (myPlane.Raycast(new Ray(cp.point, transform.up), out var planeProjectEnter)) 30 | { 31 | Vector3 contactPoint = cp.point + transform.up * planeProjectEnter; 32 | UpdateLine(contactPoint, 33 | -transform.up, 34 | transform.forward); 35 | } 36 | } 37 | } 38 | 39 | private void OnCollisionEnter(Collision other) 40 | { 41 | UpdateOnCollision(other); 42 | } 43 | 44 | private void OnCollisionStay(Collision other) 45 | { 46 | UpdateOnCollision(other); 47 | } 48 | 49 | private void OnCollisionExit(Collision other) 50 | { 51 | if (other.collider.gameObject.layer == penTipLayerIndex) 52 | { 53 | //end the current line 54 | EndLine(); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Assets/Scripts/PenTipTriggerWriting.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c58bac5382df7eb46a50f118ee7c2b0b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/ScreenRaycastWriting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | /// 7 | /// Handwriting with mouse input, raycasting from screen point to surface 8 | /// 9 | public class ScreenRaycastWriting : Writing 10 | { 11 | /// 12 | /// the main camera 13 | /// 14 | private Camera _mainCamera; 15 | 16 | // Start is called before the first frame update 17 | protected override void Start() 18 | { 19 | base.Start(); 20 | _mainCamera = Camera.main; 21 | } 22 | 23 | // Update is called once per frame 24 | protected override void Update() 25 | { 26 | //handle mouse inputs 27 | if (Input.GetMouseButton(0)) 28 | { 29 | //raycast from screen to surface 30 | Ray ray = _mainCamera.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 31 | 0)); 32 | 33 | if (Physics.Raycast(ray, out var hitInfo, 1000)) 34 | { 35 | if (hitInfo.collider.gameObject == gameObject) 36 | UpdateLine(hitInfo.point,-hitInfo.normal,hitInfo.collider.transform.forward); 37 | //hacky (uses writing surface as up reference) 38 | } 39 | 40 | } 41 | 42 | if (Input.GetMouseButtonUp(0)) 43 | { 44 | EndLine(); 45 | } 46 | 47 | base.Update(); 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Assets/Scripts/ScreenRaycastWriting.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02ee297225f7e9f43b70a77259133609 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79ae318d3ed562246a133bb61cfd1979 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Shaders/Invert.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/Invert" 2 | { 3 | Properties 4 | { 5 | _MainTex ("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | // No culling or depth 10 | Cull Off ZWrite Off ZTest Always 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | 18 | #include "UnityCG.cginc" 19 | 20 | struct appdata 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | }; 25 | 26 | struct v2f 27 | { 28 | float2 uv : TEXCOORD0; 29 | float4 vertex : SV_POSITION; 30 | }; 31 | 32 | v2f vert (appdata v) 33 | { 34 | v2f o; 35 | o.vertex = UnityObjectToClipPos(v.vertex); 36 | o.uv = v.uv; 37 | return o; 38 | } 39 | 40 | sampler2D _MainTex; 41 | 42 | fixed4 frag (v2f i) : SV_Target 43 | { 44 | fixed4 col = tex2D(_MainTex, i.uv); 45 | // just invert the colors 46 | col.rgb = 1 - col.rgb; 47 | return col; 48 | } 49 | ENDCG 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Assets/Scripts/Shaders/Invert.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 734a55c3800922b4a927e14ea33778d9 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/Writing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f540c12323c56e45aecfca2c823daba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Satrio Dewantono 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ads": "2.0.8", 4 | "com.unity.analytics": "3.3.2", 5 | "com.unity.collab-proxy": "1.2.16", 6 | "com.unity.package-manager-ui": "2.1.2", 7 | "com.unity.purchasing": "2.0.6", 8 | "com.unity.textmeshpro": "2.0.1", 9 | "com.unity.timeline": "1.0.0", 10 | "com.unity.modules.ai": "1.0.0", 11 | "com.unity.modules.animation": "1.0.0", 12 | "com.unity.modules.assetbundle": "1.0.0", 13 | "com.unity.modules.audio": "1.0.0", 14 | "com.unity.modules.cloth": "1.0.0", 15 | "com.unity.modules.director": "1.0.0", 16 | "com.unity.modules.imageconversion": "1.0.0", 17 | "com.unity.modules.imgui": "1.0.0", 18 | "com.unity.modules.jsonserialize": "1.0.0", 19 | "com.unity.modules.particlesystem": "1.0.0", 20 | "com.unity.modules.physics": "1.0.0", 21 | "com.unity.modules.physics2d": "1.0.0", 22 | "com.unity.modules.screencapture": "1.0.0", 23 | "com.unity.modules.terrain": "1.0.0", 24 | "com.unity.modules.terrainphysics": "1.0.0", 25 | "com.unity.modules.tilemap": "1.0.0", 26 | "com.unity.modules.ui": "1.0.0", 27 | "com.unity.modules.uielements": "1.0.0", 28 | "com.unity.modules.umbra": "1.0.0", 29 | "com.unity.modules.unityanalytics": "1.0.0", 30 | "com.unity.modules.unitywebrequest": "1.0.0", 31 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 32 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 33 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 34 | "com.unity.modules.unitywebrequestwww": "1.0.0", 35 | "com.unity.modules.vehicles": "1.0.0", 36 | "com.unity.modules.video": "1.0.0", 37 | "com.unity.modules.vr": "1.0.0", 38 | "com.unity.modules.wind": "1.0.0", 39 | "com.unity.modules.xr": "1.0.0" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /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 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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: 11 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_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /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 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /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: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | -------------------------------------------------------------------------------- /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 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /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 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /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: 4 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_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.1.10f1 2 | m_EditorVersionWithRevision: 2019.1.10f1 (f007ed779b7a) 3 | -------------------------------------------------------------------------------- /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 | - Prediction 17 | - PenTip 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # unity-handwriting 2 | ![](handwriting.gif) 3 | EMNIST handwriting recognition for Unity using ML-Agents (https://github.com/Unity-Technologies/ml-agents) and CNN model from https://github.com/Coopss/EMNIST. Might be useful for VR. 4 | 5 | ## Instructions 6 | - Clone the repo. It's a Unity project with a sample scene. 7 | - The repo includes a version of ML-Agents without examples. If you already have this installed in your own project, you might only want to copy the models, brain, scripts (and optionally prefabs) over. 8 | 9 | ## About the model 10 | Credits go to https://github.com/Coopss. The models are from https://github.com/Coopss/EMNIST/releases, converted to a format that is compatible with ML-Agents. 11 | -------------------------------------------------------------------------------- /handwriting.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remingtonspaz/unity-handwriting/401994559e6c436b710478750f7e7642fb8e018a/handwriting.gif --------------------------------------------------------------------------------