diff --git a/Assets/Brains/BensonImitationV2.onnx b/Assets/Brains/BensonImitationV2.onnx new file mode 100644 index 0000000..30ffacd Binary files /dev/null and b/Assets/Brains/BensonImitationV2.onnx differ diff --git a/Assets/Brains/BensonImitationV2.onnx.meta b/Assets/Brains/BensonImitationV2.onnx.meta new file mode 100644 index 0000000..cf5bd16 --- /dev/null +++ b/Assets/Brains/BensonImitationV2.onnx.meta @@ -0,0 +1,16 @@ +fileFormatVersion: 2 +guid: d73d9507da69449499dd93eff3d8134a +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3} + optimizeModel: 1 + forceArbitraryBatchSize: 1 + treatErrorsAsWarnings: 0 + importMode: 1 + weightsTypeMode: 0 + activationTypeMode: 0 diff --git a/Assets/ML-Agents/Timers/AI training_timers.json b/Assets/ML-Agents/Timers/AI training_timers.json index 4c5f4ce..f1e5c6b 100644 --- a/Assets/ML-Agents/Timers/AI training_timers.json +++ b/Assets/ML-Agents/Timers/AI training_timers.json @@ -1 +1 @@ -{"count":1,"self":54.6100928,"total":437.0681204,"children":{"InitializeActuators":{"count":1,"self":0.0015050999999999999,"total":0.0015050999999999999,"children":null},"InitializeSensors":{"count":1,"self":0.0010000999999999999,"total":0.0010000999999999999,"children":null},"AgentSendState":{"count":106517,"self":2.4229472,"total":4.9875248,"children":{"CollectObservations":{"count":106517,"self":0.5592851,"total":0.5592851,"children":null},"WriteActionMask":{"count":106517,"self":0.10856139999999999,"total":0.10856139999999999,"children":null},"RequestDecision":{"count":106517,"self":0.3979184,"total":1.8967311,"children":{"AgentInfo.ToProto":{"count":106517,"self":0.41538549999999996,"total":1.4988127,"children":{"GenerateSensorData":{"count":106517,"self":0.93811329999999993,"total":1.0834272,"children":{"RayPerceptionSensor.Perceive":{"count":106517,"self":0.1453139,"total":0.1453139,"children":null}}}}}}}}},"DecideAction":{"count":106517,"self":375.577856,"total":375.5778655,"children":null},"AgentAct":{"count":106517,"self":1.8830943999999998,"total":1.8901329,"children":{"AgentInfo.ToProto":{"count":282,"self":0.0035242999999999997,"total":0.0070383999999999993,"children":{"GenerateSensorData":{"count":282,"self":0.0020112,"total":0.0035141,"children":{"RayPerceptionSensor.Perceive":{"count":282,"self":0.0015029,"total":0.0015029,"children":null}}}}}}}},"gauges":{"BensonImitationV2.CumulativeReward":{"count":282,"max":3.594984,"min":0.06999996,"runningAverage":0.676435947,"value":2.39199162,"weightedAverage":2.00654221}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1712838172","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\noahk\\Documents\\Unity projects\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-noahk -hubSessionId 6a5e8087-82e2-4dd3-a01c-49b3c989d73e -accessToken rm0_kOgxM-hVgLTEQcJOmvx7-NTfQijYXSBtuUfKLQM005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"AI training","end_time_seconds":"1712838609"}} \ No newline at end of file +{"count":1,"self":23.780632,"total":24.4344005,"children":{"InitializeActuators":{"count":1,"self":0,"total":0,"children":null},"InitializeSensors":{"count":1,"self":0.0020087,"total":0.0020087,"children":null},"AgentSendState":{"count":985,"self":0.0431282,"total":0.0743809,"children":{"CollectObservations":{"count":985,"self":0.0124481,"total":0.0124481,"children":null},"WriteActionMask":{"count":985,"self":0,"total":0,"children":null},"RequestDecision":{"count":985,"self":0.018804599999999998,"total":0.018804599999999998,"children":null}}},"DecideAction":{"count":985,"self":0.53636909999999993,"total":0.5470193,"children":{"RayPerceptionSensor.Perceive":{"count":1970,"self":0.0106502,"total":0.0106502,"children":null}}},"AgentAct":{"count":985,"self":0.0293568,"total":0.0293568,"children":null}},"gauges":{"BensonImitationV2.CumulativeReward":{"count":1,"max":3.3979888,"min":3.3979888,"runningAverage":3.3979888,"value":3.3979888,"weightedAverage":3.3979888}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1712842214","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\noahk\\Documents\\Unity projects\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-noahk -hubSessionId 6a5e8087-82e2-4dd3-a01c-49b3c989d73e -accessToken chlU5dfKTeph6j6SihcCbOxnUfdwrGUUXMOo1OFcjIc005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"AI training","end_time_seconds":"1712842239"}} \ No newline at end of file diff --git a/Assets/Prefabs/Cooler_wall.prefab b/Assets/Prefabs/Cooler_wall.prefab index 26033d8..5dfc6b5 100644 --- a/Assets/Prefabs/Cooler_wall.prefab +++ b/Assets/Prefabs/Cooler_wall.prefab @@ -431,7 +431,7 @@ GameObject: - component: {fileID: 213472341337818363} m_Layer: 0 m_Name: Cooler_wall - m_TagString: Untagged + m_TagString: Wall m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Prefabs/Wall.prefab b/Assets/Prefabs/Wall.prefab index 1877bcb..94b22e4 100644 --- a/Assets/Prefabs/Wall.prefab +++ b/Assets/Prefabs/Wall.prefab @@ -14,7 +14,7 @@ GameObject: - component: {fileID: 1492058916582762072} m_Layer: 0 m_Name: Wall - m_TagString: Untagged + m_TagString: Wall m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Prefabs/small_wall.prefab b/Assets/Prefabs/small_wall.prefab index aa95c2e..d7068be 100644 --- a/Assets/Prefabs/small_wall.prefab +++ b/Assets/Prefabs/small_wall.prefab @@ -11,7 +11,7 @@ GameObject: - component: {fileID: 7240710829248522962} m_Layer: 0 m_Name: small_wall - m_TagString: Untagged + m_TagString: Wall m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Prefabs/turned_wall.prefab b/Assets/Prefabs/turned_wall.prefab index 1f9885c..49f2abe 100644 --- a/Assets/Prefabs/turned_wall.prefab +++ b/Assets/Prefabs/turned_wall.prefab @@ -536,7 +536,7 @@ GameObject: - component: {fileID: 6481487098311536527} m_Layer: 0 m_Name: turned_wall - m_TagString: Untagged + m_TagString: Wall m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Scenes/AI Training.unity b/Assets/Scenes/AI Training.unity index 320de17..6d1d211 100644 --- a/Assets/Scenes/AI Training.unity +++ b/Assets/Scenes/AI Training.unity @@ -439,6 +439,124 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1164269304 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1164269305} + - component: {fileID: 1164269306} + m_Layer: 0 + m_Name: RaysBackward + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1164269305 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1164269304} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1673238739} + m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!114 &1164269306 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1164269304} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SensorName: RaysBackward + m_DetectableTags: + - Wall + m_RaysPerDirection: 0 + m_MaxRayDegrees: 70 + m_SphereCastRadius: 0 + m_RayLength: 30 + m_RayLayerMask: + serializedVersion: 2 + m_Bits: 4294967291 + m_ObservationStacks: 1 + rayHitColor: {r: 1, g: 0, b: 0, a: 1} + rayMissColor: {r: 1, g: 1, b: 1, a: 1} + m_StartVerticalOffset: 0.5 + m_EndVerticalOffset: 0.5 +--- !u!1 &1329741932 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1329741933} + - component: {fileID: 1329741934} + m_Layer: 0 + m_Name: RaysForward + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1329741933 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329741932} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1673238739} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1329741934 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1329741932} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SensorName: RaysForward + m_DetectableTags: + - Wall + m_RaysPerDirection: 3 + m_MaxRayDegrees: 70 + m_SphereCastRadius: 0 + m_RayLength: 30 + m_RayLayerMask: + serializedVersion: 2 + m_Bits: 4294967291 + m_ObservationStacks: 1 + rayHitColor: {r: 1, g: 0, b: 0, a: 1} + rayMissColor: {r: 1, g: 1, b: 1, a: 1} + m_StartVerticalOffset: 0.5 + m_EndVerticalOffset: 0.5 --- !u!1001 &1574695326 PrefabInstance: m_ObjectHideFlags: 0 @@ -682,6 +800,26 @@ PrefabInstance: propertyPath: m_Name value: TrainingArea objectReference: {fileID: 0} + - target: {fileID: 6288636727627254098, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} + propertyPath: m_MaxRayDegrees + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 6288636727627254098, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} + propertyPath: m_RaysPerDirection + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 6288636727627254098, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} + propertyPath: m_DetectableTags.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6288636727627254098, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} + propertyPath: m_DetectableTags.Array.data[0] + value: Wall + objectReference: {fileID: 0} + - target: {fileID: 8242215082626919376, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} + propertyPath: m_Model + value: + objectReference: {fileID: 5022602860645237092, guid: d73d9507da69449499dd93eff3d8134a, type: 3} - target: {fileID: 8242215082626919376, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} propertyPath: m_BehaviorName value: BensonImitationV2 @@ -690,9 +828,17 @@ PrefabInstance: propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 6288636727627254098, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} + - {fileID: 4363665987596313906, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} m_RemovedGameObjects: [] - m_AddedGameObjects: [] + m_AddedGameObjects: + - targetCorrespondingSourceObject: {fileID: 4361687674892069559, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} + insertIndex: -1 + addedObject: {fileID: 1329741933} + - targetCorrespondingSourceObject: {fileID: 4361687674892069559, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} + insertIndex: -1 + addedObject: {fileID: 1164269305} m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 3664a8beed80ac848a9377d9ee14cb9b, type: 3} --- !u!1660057539 &9223372036854775807 diff --git a/Assets/Scripts/AgentController.cs b/Assets/Scripts/AgentController.cs index 50b5a25..3076460 100644 --- a/Assets/Scripts/AgentController.cs +++ b/Assets/Scripts/AgentController.cs @@ -268,4 +268,11 @@ public class AgentController : Agent var distanceToCheckpoint = Vector3.Distance(transform.position, closestPoint); return distanceToCheckpoint; } + + private void OnCollisionEnter(Collision other) { + if (other.gameObject.tag == "Wall") + { + AddReward(-0.03f); + } + } } \ No newline at end of file diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 1c92a78..89726ad 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -3,7 +3,8 @@ --- !u!78 &1 TagManager: serializedVersion: 2 - tags: [] + tags: + - Wall layers: - Default - TransparentFX