diff --git a/Assets/ML-Agents/Timers/Car Customization_timers.json b/Assets/ML-Agents/Timers/Car Customization_timers.json index 8055199..4fa2471 100644 --- a/Assets/ML-Agents/Timers/Car Customization_timers.json +++ b/Assets/ML-Agents/Timers/Car Customization_timers.json @@ -1 +1 @@ -{"count":1,"self":53.3242304,"total":53.3307461,"children":{"InitializeActuators":{"count":1,"self":0,"total":0,"children":null},"InitializeSensors":{"count":1,"self":0.0020066999999999997,"total":0.0020066999999999997,"children":null},"AgentSendState":{"count":1,"self":0.0035031,"total":0.0045081,"children":{"CollectObservations":{"count":1,"self":0.001005,"total":0.001005,"children":null}}}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714051487","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 b034e26d-02c7-41ad-9a20-c198a628a35a -accessToken Dt6gMuGhvx1BDLlNSM4Gg2t5w5_py5VVtuHcl5oYJQk005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Car Customization","end_time_seconds":"1714051541"}} \ No newline at end of file +{"count":1,"self":13.476543999999999,"total":13.645305599999999,"children":{"InitializeActuators":{"count":8,"self":0.0005032,"total":0.0005032,"children":null},"InitializeSensors":{"count":8,"self":0.0025123,"total":0.0025123,"children":null},"AgentSendState":{"count":391,"self":0.0242956,"total":0.0414863,"children":{"CollectObservations":{"count":632,"self":0.0075606,"total":0.0075606,"children":null},"WriteActionMask":{"count":632,"self":0.0010004,"total":0.0010004,"children":null},"RequestDecision":{"count":632,"self":0.0086296999999999988,"total":0.0086296999999999988,"children":null}}},"DecideAction":{"count":391,"self":0.10208819999999999,"total":0.105127,"children":{"RayPerceptionSensor.Perceive":{"count":1264,"self":0.0030388,"total":0.0030388,"children":null}}},"AgentAct":{"count":391,"self":0.0191332,"total":0.0191332,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714114459","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 a6f45e0e-41b6-4c96-a70e-ec8e10ca5aa9 -accessToken LhF-MiZYoHmiI2p1_6JvQZvJ6QUPd4VyLbrTbhNHTT8005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Car Customization","end_time_seconds":"1714114473"}} \ No newline at end of file diff --git a/Assets/ML-Agents/Timers/Racetrack mini_timers.json b/Assets/ML-Agents/Timers/Racetrack mini_timers.json index 37e78cd..f839f52 100644 --- a/Assets/ML-Agents/Timers/Racetrack mini_timers.json +++ b/Assets/ML-Agents/Timers/Racetrack mini_timers.json @@ -1 +1 @@ -{"count":1,"self":138.9299456,"total":140.8284301,"children":{"InitializeActuators":{"count":8,"self":0.0010004999999999999,"total":0.0010004999999999999,"children":null},"InitializeSensors":{"count":8,"self":0.0025084,"total":0.0025084,"children":null},"AgentSendState":{"count":6805,"self":0.39578209999999997,"total":0.50476579999999993,"children":{"CollectObservations":{"count":10888,"self":0.062793,"total":0.062793,"children":null},"WriteActionMask":{"count":10888,"self":0.014744499999999999,"total":0.014744499999999999,"children":null},"RequestDecision":{"count":10888,"self":0.0314462,"total":0.0314462,"children":null}}},"DecideAction":{"count":6805,"self":0.94154549999999992,"total":0.97379739999999992,"children":{"RayPerceptionSensor.Perceive":{"count":21776,"self":0.0322519,"total":0.0322519,"children":null}}},"AgentAct":{"count":6805,"self":0.4153926,"total":0.4153926,"children":null}},"gauges":{"Benson Track2.CumulativeReward":{"count":37,"max":25.5315037,"min":-1.48766124,"runningAverage":6.426719,"value":4.999134,"weightedAverage":8.814682}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714051562","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 b034e26d-02c7-41ad-9a20-c198a628a35a -accessToken Dt6gMuGhvx1BDLlNSM4Gg2t5w5_py5VVtuHcl5oYJQk005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1714051702"}} \ No newline at end of file +{"count":1,"self":52.366592,"total":53.0602252,"children":{"InitializeActuators":{"count":8,"self":0.001,"total":0.001,"children":null},"InitializeSensors":{"count":8,"self":0.0030047999999999997,"total":0.0030047999999999997,"children":null},"AgentSendState":{"count":2421,"self":0.1186515,"total":0.1531092,"children":{"CollectObservations":{"count":3880,"self":0.020620199999999998,"total":0.020620199999999998,"children":null},"WriteActionMask":{"count":3880,"self":0.0038607,"total":0.0038607,"children":null},"RequestDecision":{"count":3880,"self":0.0099768,"total":0.0099768,"children":null}}},"DecideAction":{"count":2421,"self":0.3727546,"total":0.38228779999999996,"children":{"RayPerceptionSensor.Perceive":{"count":7760,"self":0.0095332,"total":0.0095332,"children":null}}},"AgentAct":{"count":2421,"self":0.15323209999999998,"total":0.15323209999999998,"children":null}},"gauges":{"Benson Track2.CumulativeReward":{"count":1,"max":24.2250633,"min":24.2250633,"runningAverage":24.2250633,"value":24.2250633,"weightedAverage":24.2250633}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714115875","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 a6f45e0e-41b6-4c96-a70e-ec8e10ca5aa9 -accessToken LhF-MiZYoHmiI2p1_6JvQZvJ6QUPd4VyLbrTbhNHTT8005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1714115928"}} \ No newline at end of file diff --git a/Assets/Scenes/Racetrack mini.unity b/Assets/Scenes/Racetrack mini.unity index 6bbf92e..bb086f3 100644 --- a/Assets/Scenes/Racetrack mini.unity +++ b/Assets/Scenes/Racetrack mini.unity @@ -16958,6 +16958,10 @@ PrefabInstance: propertyPath: m_Model value: objectReference: {fileID: 5022602860645237092, guid: 0a7181c8b969e1346b8a4323695aea4d, type: 3} + - target: {fileID: 714326685143289106, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} + propertyPath: isPlaying + value: 1 + objectReference: {fileID: 0} - target: {fileID: 714326685143289106, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} propertyPath: checkpoints.Array.data[0] value: @@ -17026,6 +17030,10 @@ PrefabInstance: propertyPath: m_Model value: objectReference: {fileID: 5022602860645237092, guid: 0a7181c8b969e1346b8a4323695aea4d, type: 3} + - target: {fileID: 1738365250199652202, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} + propertyPath: isPlaying + value: 1 + objectReference: {fileID: 0} - target: {fileID: 1738365250199652202, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} propertyPath: checkpoints.Array.data[0] value: @@ -17166,6 +17174,10 @@ PrefabInstance: propertyPath: checkpoints.Array.data[15] value: objectReference: {fileID: 802517270703114806} + - target: {fileID: 3317544572197634774, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} + propertyPath: isPlaying + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3317544572197634774, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} propertyPath: checkpoints.Array.data[0] value: @@ -17306,6 +17318,10 @@ PrefabInstance: propertyPath: checkpoints.Array.data[15] value: objectReference: {fileID: 802517270703114806} + - target: {fileID: 3804978923256916348, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} + propertyPath: isPlaying + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3804978923256916348, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} propertyPath: checkpoints.Array.data[0] value: @@ -17370,6 +17386,10 @@ PrefabInstance: propertyPath: checkpoints.Array.data[15] value: objectReference: {fileID: 802517270703114806} + - target: {fileID: 4525420008190256607, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} + propertyPath: isPlaying + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4525420008190256607, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} propertyPath: checkpoints.Array.data[0] value: @@ -17578,6 +17598,10 @@ PrefabInstance: propertyPath: m_Model value: objectReference: {fileID: 5022602860645237092, guid: 0a7181c8b969e1346b8a4323695aea4d, type: 3} + - target: {fileID: 5733087808321881938, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} + propertyPath: isPlaying + value: 1 + objectReference: {fileID: 0} - target: {fileID: 5733087808321881938, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} propertyPath: checkpoints.Array.data[0] value: @@ -17962,6 +17986,10 @@ PrefabInstance: propertyPath: m_Name value: Cars objectReference: {fileID: 0} + - target: {fileID: 8903063341209168209, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} + propertyPath: isPlaying + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8903063341209168209, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} propertyPath: checkpoints.Array.data[0] value: @@ -18026,6 +18054,10 @@ PrefabInstance: propertyPath: checkpoints.Array.data[15] value: objectReference: {fileID: 802517270703114806} + - target: {fileID: 9215282754755187610, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} + propertyPath: isPlaying + value: 1 + objectReference: {fileID: 0} - target: {fileID: 9215282754755187610, guid: 7a3d78e18ac1cd7458d86f15c7aedc7a, type: 3} propertyPath: checkpoints.Array.data[0] value: diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 85a39b6..a4738f8 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -8,6 +8,7 @@ public class GameManager : MonoBehaviour public int lapAmount; public GameObject[] checkpoints; public GameObject[] players; + [HideInInspector] public string[] playersFinished; int[] playerLaps; void Start() @@ -28,6 +29,9 @@ public class GameManager : MonoBehaviour { GameObject player = players[i]; + if (playersFinished.Contains(player.name)) + continue; + bool isAI = true; if (player.GetComponent().enabled) isAI = false; @@ -56,8 +60,12 @@ public class GameManager : MonoBehaviour if (playerLaps[i] > lapAmount) { player.GetComponent().isKinematic = true; - } + playersFinished.Append(player.name); + print("\nPlayers finished:"); + foreach (string pp in playersFinished) + print(pp); + } } } } diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 8bbf084..26b41dc 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -122,13 +122,13 @@ public class PlayerController : MonoBehaviour } private void Update() { - // Transform currentCheckpoint = checkpoints[checkpointsCollected].transform; - // float checkpintDistance = distanceToCheckpoint(currentCheckpoint); + Transform currentCheckpoint = checkpoints[checkpointsCollected].transform; + float checkpintDistance = distanceToCheckpoint(currentCheckpoint); - // if (checkpintDistance < 0.1f) - // { - // checkpointsCollected += 1; - // } + if (checkpintDistance < 0.1f) + { + checkpointsCollected += 1; + } } private void OnCollisionEnter(Collision other) {