Merge branch 'master' of git@ooftooft.net:Racesm
# Conflicts: # Assets/Imported Assets/PolygonCity/Prefabs/Characters/Character_BusinessMan_Shirt_01.prefab # Assets/ML-Agents/Timers/Racetrack mini_timers.json # Assets/Scenes/Racetrack.unity # Assets/Scenes/mini_racetrack3.unity
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,6 +12,7 @@
|
||||
|
||||
venv
|
||||
.venv
|
||||
/MLAgents/Timers/
|
||||
|
||||
# MemoryCaptures can get excessive in size.
|
||||
# They also could contain extremely sensitive data
|
||||
|
||||
BIN
Assets/Brains/BensonV7.onnx
Normal file
BIN
Assets/Brains/BensonV7.onnx
Normal file
Binary file not shown.
16
Assets/Brains/BensonV7.onnx.meta
Normal file
16
Assets/Brains/BensonV7.onnx.meta
Normal file
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32480f119eb42a149a893e96102e1fed
|
||||
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
|
||||
@@ -1 +1 @@
|
||||
{"count":1,"self":107.2838656,"total":107.4925277,"children":{"InitializeActuators":{"count":3,"self":0.0009975,"total":0.0009975,"children":null},"InitializeSensors":{"count":3,"self":0.0025054,"total":0.0025054,"children":null},"AgentSendState":{"count":456,"self":0.011536999999999999,"total":0.026688,"children":{"CollectObservations":{"count":276,"self":0.0020269,"total":0.0020269,"children":null},"WriteActionMask":{"count":276,"self":0,"total":0,"children":null},"RequestDecision":{"count":276,"self":0.0131241,"total":0.0131241,"children":null}}},"DecideAction":{"count":456,"self":0.1577449,"total":0.1597336,"children":{"RayPerceptionSensor.Perceive":{"count":552,"self":0.0019887,"total":0.0019887,"children":null}}},"AgentAct":{"count":456,"self":0.018735099999999998,"total":0.018735099999999998,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713938404","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\Magnus\\Desktop\\UnityStuf\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-Magnus -hubSessionId 8870a2b5-eb85-482c-9f97-a69682ef9b2b -accessToken U1Q6bPAeMgVc12tgfRzGzGVn7bYVzdxATeIOIKVjt3o005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Car Customization","end_time_seconds":"1713938511"}}
|
||||
{"count":1,"self":86.7022016,"total":87.2017959,"children":{"InitializeActuators":{"count":2,"self":0.0020012999999999997,"total":0.0020012999999999997,"children":null},"InitializeSensors":{"count":2,"self":0.0025069999999999997,"total":0.0025069999999999997,"children":null},"AgentSendState":{"count":2392,"self":0.0591224,"total":0.07723809999999999,"children":{"CollectObservations":{"count":958,"self":0.0045191,"total":0.0045191,"children":null},"WriteActionMask":{"count":958,"self":0.0005076,"total":0.0005076,"children":null},"RequestDecision":{"count":958,"self":0.0095655,"total":0.013089,"children":{"RayPerceptionSensor.Perceive":{"count":958,"self":0.0035234999999999997,"total":0.0035234999999999997,"children":null}}}}},"DecideAction":{"count":2392,"self":0.35492989999999996,"total":0.3589999,"children":{"RayPerceptionSensor.Perceive":{"count":1916,"self":0.00407,"total":0.00407,"children":null}}},"AgentAct":{"count":2392,"self":0.0588493,"total":0.0588493,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713942564","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 985081e8-b814-4bc7-8736-608aea67ce7e -accessToken fMKSu_LeJtSMMwbIluJ0HvaiatLXHDxWic8X4MA6BEQ005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Car Customization","end_time_seconds":"1713942651"}}
|
||||
1
Assets/ML-Agents/Timers/DragRace_timers.json
Normal file
1
Assets/ML-Agents/Timers/DragRace_timers.json
Normal file
@@ -0,0 +1 @@
|
||||
{"count":1,"self":15.7605056,"total":15.933164699999999,"children":{"InitializeActuators":{"count":2,"self":0.001001,"total":0.001001,"children":null},"InitializeSensors":{"count":2,"self":0.0020005,"total":0.0020005,"children":null},"AgentSendState":{"count":539,"self":0.0088979,"total":0.0224277,"children":{"CollectObservations":{"count":108,"self":0.0030174999999999998,"total":0.0030174999999999998,"children":null},"WriteActionMask":{"count":108,"self":0.0010050999999999999,"total":0.0010050999999999999,"children":null},"RequestDecision":{"count":108,"self":0.0095072,"total":0.0095072,"children":null}}},"DecideAction":{"count":539,"self":0.1313798,"total":0.13538809999999998,"children":{"RayPerceptionSensor.Perceive":{"count":432,"self":0.0040083,"total":0.0040083,"children":null}}},"AgentAct":{"count":539,"self":0.0108407,"total":0.0108407,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713948159","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 985081e8-b814-4bc7-8736-608aea67ce7e -accessToken fMKSu_LeJtSMMwbIluJ0HvaiatLXHDxWic8X4MA6BEQ005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DragRace","end_time_seconds":"1713948175"}}
|
||||
7
Assets/ML-Agents/Timers/DragRace_timers.json.meta
Normal file
7
Assets/ML-Agents/Timers/DragRace_timers.json.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e87f39bb3d8bf804ca57595d97cd3614
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1 +1,5 @@
|
||||
{"count":1,"self":16.238459199999998,"total":16.4519137,"children":{"InitializeActuators":{"count":3,"self":0.0015067,"total":0.0015067,"children":null},"InitializeSensors":{"count":3,"self":0.0014154999999999999,"total":0.0014154999999999999,"children":null},"AgentSendState":{"count":515,"self":0.015192299999999999,"total":0.03709,"children":{"CollectObservations":{"count":309,"self":0.0078677,"total":0.0078677,"children":null},"WriteActionMask":{"count":309,"self":0,"total":0,"children":null},"RequestDecision":{"count":309,"self":0.014029999999999999,"total":0.014029999999999999,"children":null}}},"DecideAction":{"count":515,"self":0.1521744,"total":0.1547357,"children":{"RayPerceptionSensor.Perceive":{"count":618,"self":0.0025613,"total":0.0025613,"children":null}}},"AgentAct":{"count":515,"self":0.0176591,"total":0.0176591,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713946661","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\Magnus\\Desktop\\UnityStuf\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-Magnus -hubSessionId 8870a2b5-eb85-482c-9f97-a69682ef9b2b -accessToken U1Q6bPAeMgVc12tgfRzGzGVn7bYVzdxATeIOIKVjt3o005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1713946677"}}
|
||||
<<<<<<< HEAD
|
||||
{"count":1,"self":16.238459199999998,"total":16.4519137,"children":{"InitializeActuators":{"count":3,"self":0.0015067,"total":0.0015067,"children":null},"InitializeSensors":{"count":3,"self":0.0014154999999999999,"total":0.0014154999999999999,"children":null},"AgentSendState":{"count":515,"self":0.015192299999999999,"total":0.03709,"children":{"CollectObservations":{"count":309,"self":0.0078677,"total":0.0078677,"children":null},"WriteActionMask":{"count":309,"self":0,"total":0,"children":null},"RequestDecision":{"count":309,"self":0.014029999999999999,"total":0.014029999999999999,"children":null}}},"DecideAction":{"count":515,"self":0.1521744,"total":0.1547357,"children":{"RayPerceptionSensor.Perceive":{"count":618,"self":0.0025613,"total":0.0025613,"children":null}}},"AgentAct":{"count":515,"self":0.0176591,"total":0.0176591,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713946661","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\Magnus\\Desktop\\UnityStuf\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-Magnus -hubSessionId 8870a2b5-eb85-482c-9f97-a69682ef9b2b -accessToken U1Q6bPAeMgVc12tgfRzGzGVn7bYVzdxATeIOIKVjt3o005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1713946677"}}
|
||||
=======
|
||||
{"count":1,"self":260.8801792,"total":263.71180169999997,"children":{"InitializeActuators":{"count":2,"self":0.0012793,"total":0.0012793,"children":null},"InitializeSensors":{"count":2,"self":0.0020053,"total":0.0020053,"children":null},"AgentSendState":{"count":12917,"self":0.3768938,"total":0.4890713,"children":{"CollectObservations":{"count":5168,"self":0.058553799999999996,"total":0.058553799999999996,"children":null},"WriteActionMask":{"count":5168,"self":0.0059936999999999994,"total":0.0059936999999999994,"children":null},"RequestDecision":{"count":5168,"self":0.0429868,"total":0.04763,"children":{"RayPerceptionSensor.Perceive":{"count":5168,"self":0.0046432,"total":0.0046432,"children":null}}}}},"DecideAction":{"count":12917,"self":2.0233914,"total":2.0547198,"children":{"RayPerceptionSensor.Perceive":{"count":10336,"self":0.0313284,"total":0.0313284,"children":null}}},"AgentAct":{"count":12917,"self":0.2830542,"total":0.2830542,"children":null}},"gauges":{"BensonV7.CumulativeReward":{"count":1,"max":25.1733932,"min":25.1733932,"runningAverage":25.1733932,"value":25.1733932,"weightedAverage":25.1733932}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713945905","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 985081e8-b814-4bc7-8736-608aea67ce7e -accessToken fMKSu_LeJtSMMwbIluJ0HvaiatLXHDxWic8X4MA6BEQ005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1713946168"}}
|
||||
>>>>>>> 5d9eab1801256febfab096297604d8577dd44a9f
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"count":1,"self":52.4120576,"total":52.5793021,"children":{"InitializeActuators":{"count":2,"self":0.00099739999999999985,"total":0.00099739999999999985,"children":null},"InitializeSensors":{"count":2,"self":0.0015034,"total":0.0015034,"children":null},"AgentSendState":{"count":394,"self":0.0077031999999999995,"total":0.0247832,"children":{"CollectObservations":{"count":158,"self":0.004493,"total":0.004493,"children":null},"WriteActionMask":{"count":158,"self":0,"total":0,"children":null},"RequestDecision":{"count":158,"self":0.012587,"total":0.012587,"children":null}}},"DecideAction":{"count":394,"self":0.1281029,"total":0.1290791,"children":{"RayPerceptionSensor.Perceive":{"count":316,"self":0.0009762,"total":0.0009762,"children":null}}},"AgentAct":{"count":394,"self":0.0108823,"total":0.0108823,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713938654","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\Magnus\\Desktop\\UnityStuf\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-Magnus -hubSessionId 8870a2b5-eb85-482c-9f97-a69682ef9b2b -accessToken U1Q6bPAeMgVc12tgfRzGzGVn7bYVzdxATeIOIKVjt3o005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"mini_racetrack3","end_time_seconds":"1713938706"}}
|
||||
{"count":1,"self":52.4120576,"total":52.5793021,"children":{"InitializeActuators":{"count":2,"self":0.00099739999999999985,"total":0.00099739999999999985,"children":null},"InitializeSensors":{"count":2,"self":0.0015034,"total":0.0015034,"children":null},"AgentSendState":{"count":394,"self":0.0077031999999999995,"total":0.0247832,"children":{"CollectObservations":{"count":158,"self":0.004493,"total":0.004493,"children":null},"WriteActionMask":{"count":158,"self":0,"total":0,"children":null},"RequestDecision":{"count":158,"self":0.012587,"total":0.012587,"children":null}}},"DecideAction":{"count":394,"self":0.1281029,"total":0.1290791,"children":{"RayPerceptionSensor.Perceive":{"count":316,"self":0.0009762,"total":0.0009762,"children":null}}},"AgentAct":{"count":394,"self":0.0108823,"total":0.0108823,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713938654","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\Magnus\\Desktop\\UnityStuf\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-Magnus -hubSessionId 8870a2b5-eb85-482c-9f97-a69682ef9b2b -accessToken U1Q6bPAeMgVc12tgfRzGzGVn7bYVzdxATeIOIKVjt3o005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"mini_racetrack3","end_time_seconds":"1713938706"}}
|
||||
|
||||
@@ -252,9 +252,21 @@ PrefabInstance:
|
||||
propertyPath: m_CenterOfMass.y
|
||||
value: 0.05
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 0.25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 60
|
||||
value: 61.4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
@@ -262,7 +274,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 15.4
|
||||
value: 14.93
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
@@ -270,7 +282,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
@@ -278,7 +290,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@@ -286,7 +298,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
value: 90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
@@ -296,6 +308,18 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Hotrod (Benson) Variant
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7953198523918571078, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7953198523918571078, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7953198523918571078, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents:
|
||||
- {fileID: 5418785709807611868, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
m_RemovedGameObjects:
|
||||
@@ -324,6 +348,12 @@ PrefabInstance:
|
||||
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 4221989274307883857}
|
||||
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 3410949865351305375}
|
||||
- targetCorrespondingSourceObject: {fileID: 5711380006811689493, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 5400182112440573950}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
--- !u!1 &6461281435351799366 stripped
|
||||
GameObject:
|
||||
@@ -352,9 +382,9 @@ MonoBehaviour:
|
||||
VectorActionDescriptions: []
|
||||
VectorActionSpaceType: 0
|
||||
hasUpgradedBrainParametersWithActionSpec: 1
|
||||
m_Model: {fileID: 0}
|
||||
m_Model: {fileID: 5022602860645237092, guid: 32480f119eb42a149a893e96102e1fed, type: 3}
|
||||
m_InferenceDevice: 0
|
||||
m_BehaviorType: 0
|
||||
m_BehaviorType: 2
|
||||
m_BehaviorName: BensonV7
|
||||
TeamId: 0
|
||||
m_UseChildSensors: 1
|
||||
@@ -399,9 +429,12 @@ MonoBehaviour:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
maxStepsPerCheckpoint: 400
|
||||
checkpointsCollected: 0
|
||||
maxStepsPerCheckpoint: 2000
|
||||
distanceBetweenCheckpoints: 20
|
||||
ignoreMentalPain: 1
|
||||
isPlaying: 1
|
||||
isFinished: 0
|
||||
--- !u!114 &4221989274307883857
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -416,6 +449,68 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
DecisionPeriod: 5
|
||||
TakeActionsBetweenDecisions: 1
|
||||
--- !u!114 &3410949865351305375
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6461281435351799366}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0ee5992a8d68a894cba0612b0c18c3db, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
materialParts:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
defaultColors:
|
||||
- {fileID: 2100000, guid: 860d6251349fddd48b946fcba9793104, type: 2}
|
||||
- {fileID: 2100000, guid: 975703bb1a02ae64d9964e703202734f, type: 2}
|
||||
- {fileID: 2100000, guid: 975703bb1a02ae64d9964e703202734f, type: 2}
|
||||
- {fileID: 2100000, guid: 975703bb1a02ae64d9964e703202734f, type: 2}
|
||||
- {fileID: 2100000, guid: 975703bb1a02ae64d9964e703202734f, type: 2}
|
||||
--- !u!114 &5400182112440573950
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6461281435351799366}
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 58d3a2623a4164b4bb25683edc176b03, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
motorTorque: 300
|
||||
brakeTorque: 500
|
||||
maxSpeed: 400
|
||||
steeringRange: 9
|
||||
steeringRangeAtMaxSpeed: 7
|
||||
autoBrake: 100
|
||||
audio: {fileID: 0}
|
||||
rigidBody: {fileID: 0}
|
||||
checkpointsCollected: 0
|
||||
checkpoints:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
--- !u!4 &6760919851603153930 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 5420764024659664985, guid: 5851f609a58dc884a99030da0105c6db, type: 3}
|
||||
|
||||
@@ -13,6 +13,7 @@ GameObject:
|
||||
- component: {fileID: 1915818325675539370}
|
||||
- component: {fileID: 3466260334280045808}
|
||||
- component: {fileID: 5655726606384773670}
|
||||
- component: {fileID: 7221852830714037971}
|
||||
m_Layer: 2
|
||||
m_Name: CheckPoint
|
||||
m_TagString: Checkpoint
|
||||
@@ -120,3 +121,30 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
isCollected: 0
|
||||
isVisible: 1
|
||||
--- !u!54 &7221852830714037971
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7234834637752836426}
|
||||
serializedVersion: 4
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ImplicitCom: 1
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1857
Assets/Prefabs/Tracks/racetrack_4.prefab
Normal file
1857
Assets/Prefabs/Tracks/racetrack_4.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/Tracks/racetrack_4.prefab.meta
Normal file
7
Assets/Prefabs/Tracks/racetrack_4.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8358fa575ee4f2e44946d6172e10c6d5
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1607
Assets/Scenes/DragRace.unity
Normal file
1607
Assets/Scenes/DragRace.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/DragRace.unity.meta
Normal file
7
Assets/Scenes/DragRace.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d4d9734dddfeff48a82e1a52b057f35
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1567,6 +1567,63 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: a5cc261231f5a6a4c88239b1dab368cb, type: 3}
|
||||
--- !u!1001 &4833200516469304011
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 473786254074528415, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: racetrack_4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -120
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2992483127055826181, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 8358fa575ee4f2e44946d6172e10c6d5, type: 3}
|
||||
--- !u!1001 &7921848799276681536
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -38,7 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.29684302, g: 0.6337671, b: 0.9937157, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.29684305, g: 0.63376737, b: 0.9937157, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@@ -338,6 +338,46 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Camera
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1742803291406415280, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: Loader
|
||||
value:
|
||||
objectReference: {fileID: 776505354}
|
||||
- target: {fileID: 1742803291406415280, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: TargetCar
|
||||
value:
|
||||
objectReference: {fileID: 1852564513}
|
||||
- target: {fileID: 5259896103893455903, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.8158076
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5259896103893455903, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -1.1205094
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5259896103893455903, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 63.561188
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5259896103893455903, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5259896103893455903, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5259896103893455903, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.97014254
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5259896103893455903, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0.24253564
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5442577508303945574, guid: 4d2790a368af4c4458fc4dc8130f8b19, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Camera
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -15575,6 +15615,89 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: d5caff8338f793c4eb4490cc52546faf, type: 3}
|
||||
--- !u!1 &1852564513
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1852564514}
|
||||
- component: {fileID: 1852564516}
|
||||
- component: {fileID: 1852564515}
|
||||
m_Layer: 0
|
||||
m_Name: Bulldozer
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1852564514
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1852564513}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.561, y: 0.1, z: 1.304}
|
||||
m_LocalScale: {x: 0.25, y: 0.25, z: 0.25}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1691573825}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1852564515
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1852564513}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 58d3a2623a4164b4bb25683edc176b03, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
motorTorque: 600
|
||||
brakeTorque: 700
|
||||
maxSpeed: 85
|
||||
steeringRange: 30
|
||||
steeringRangeAtMaxSpeed: 25
|
||||
autoBrake: 500
|
||||
audio: {fileID: 0}
|
||||
rigidBody: {fileID: 0}
|
||||
checkpointsCollected: 0
|
||||
checkpoints: []
|
||||
--- !u!54 &1852564516
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1852564513}
|
||||
serializedVersion: 4
|
||||
m_Mass: 4000
|
||||
m_Drag: 0.01
|
||||
m_AngularDrag: 0
|
||||
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ImplicitCom: 0
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 0
|
||||
--- !u!1001 &1903297572
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -11,7 +11,7 @@ using Unity.VisualScripting;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
|
||||
public class AgentControllerV7 : Agent
|
||||
public class AgentController: Agent
|
||||
{
|
||||
public float motorTorque = 300;
|
||||
public float brakeTorque = 500;
|
||||
@@ -32,8 +32,15 @@ public class AgentControllerV7 : Agent
|
||||
public int maxStepsPerCheckpoint = 300;
|
||||
public int distanceBetweenCheckpoints = 5;
|
||||
public bool ignoreMentalPain = true;
|
||||
bool isEnabled = true;
|
||||
public bool isPlaying = false;
|
||||
[HideInInspector] public bool isFinished = false; // needed for gamemanager
|
||||
|
||||
// Start is called before the first frame update
|
||||
protected override void OnDisable()
|
||||
{
|
||||
isEnabled = false;
|
||||
return;
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody>();
|
||||
@@ -47,10 +54,17 @@ public class AgentControllerV7 : Agent
|
||||
|
||||
public override void OnEpisodeBegin()
|
||||
{
|
||||
if (!isEnabled)
|
||||
return;
|
||||
|
||||
stepsSinceCheckpoint = 0;
|
||||
checkpointsCollected = 0;
|
||||
totalReward = 0;
|
||||
totalMentalPain = 0;
|
||||
checkpointsCollected = 0;
|
||||
|
||||
// don't reset car unless in training
|
||||
if (isPlaying)
|
||||
return;
|
||||
|
||||
// reset wheels
|
||||
foreach (var wheel in wheels)
|
||||
@@ -84,6 +98,13 @@ public class AgentControllerV7 : Agent
|
||||
|
||||
public override void CollectObservations(VectorSensor sensor)
|
||||
{
|
||||
if (!isEnabled)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
sensor.AddObservation(0);
|
||||
return;
|
||||
}
|
||||
|
||||
Transform currentCheckpoint = checkpoints[checkpointsCollected].transform;
|
||||
|
||||
// distance to next checkpoint
|
||||
@@ -124,7 +145,9 @@ public class AgentControllerV7 : Agent
|
||||
}
|
||||
|
||||
public override void OnActionReceived(ActionBuffers actions)
|
||||
{
|
||||
{
|
||||
if (!isEnabled)
|
||||
return;
|
||||
// Actions size = 2 [vertical speed, horizontal speed] = [-1..1, -1..1] // discrete = [{0, 1, 2}, {0, 1, 2}] = [{-1, 0, 1}...]
|
||||
float vInput = 0;
|
||||
float hInput = 0;
|
||||
@@ -238,7 +261,16 @@ public class AgentControllerV7 : Agent
|
||||
if (checkpointsCollected == checkpoints.Count - 1)
|
||||
{
|
||||
AddReward(10f);
|
||||
EndEpisode();
|
||||
|
||||
if (isPlaying)
|
||||
{
|
||||
isFinished = true;
|
||||
}
|
||||
|
||||
EndEpisode();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
checkpointsCollected += 1;
|
||||
@@ -257,7 +289,34 @@ public class AgentControllerV7 : Agent
|
||||
if (stepsSinceCheckpoint >= maxStepsPerCheckpoint)
|
||||
{
|
||||
stepsSinceCheckpoint = 0;
|
||||
EndEpisode();
|
||||
|
||||
if (isPlaying) // send back to previous checkpoint if stuck
|
||||
{
|
||||
|
||||
if (checkpointsCollected == 0)
|
||||
{
|
||||
transform.position = startPosition;
|
||||
transform.rotation = startRotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.position = new Vector3(
|
||||
checkpoints[checkpointsCollected - 1].transform.position.x,
|
||||
transform.position.y + 3,
|
||||
checkpoints[checkpointsCollected - 1].transform.position.z
|
||||
);
|
||||
|
||||
transform.eulerAngles = new Vector3(
|
||||
transform.eulerAngles.x,
|
||||
checkpoints[checkpointsCollected - 1].transform.eulerAngles.y,
|
||||
transform.eulerAngles.z
|
||||
);
|
||||
}
|
||||
|
||||
rb.velocity = Vector3.zero;
|
||||
}
|
||||
else
|
||||
EndEpisode();
|
||||
}
|
||||
|
||||
// print(GetCumulativeReward());
|
||||
@@ -265,6 +324,9 @@ public class AgentControllerV7 : Agent
|
||||
|
||||
public override void Heuristic(in ActionBuffers actionsOut)
|
||||
{
|
||||
if (!isEnabled)
|
||||
return;
|
||||
|
||||
var discreteActionsOut = actionsOut.DiscreteActions;
|
||||
|
||||
discreteActionsOut[0] = 2;
|
||||
@@ -298,6 +360,9 @@ public class AgentControllerV7 : Agent
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision other) {
|
||||
if (!isEnabled)
|
||||
return;
|
||||
|
||||
// if (other.gameObject.tag == "NPC")
|
||||
// {
|
||||
// AddReward(0.1f);
|
||||
|
||||
@@ -15,8 +15,17 @@ public class CarLoader : MonoBehaviour
|
||||
public GameObject targetcar;
|
||||
void Start()
|
||||
{
|
||||
carType = GameObject.Find("Car Data").GetComponent<CarData>().carType;
|
||||
carColor = GameObject.Find("Car Data").GetComponent<CarData>().carColor;
|
||||
try
|
||||
{
|
||||
carType = GameObject.Find("Car Data").GetComponent<CarData>().carType;
|
||||
carColor = GameObject.Find("Car Data").GetComponent<CarData>().carColor;
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
carType = "Racecar";
|
||||
carColor = "Default";
|
||||
print("no loading");
|
||||
}
|
||||
|
||||
foreach (GameObject car in Cars)
|
||||
{
|
||||
@@ -30,7 +39,7 @@ public class CarLoader : MonoBehaviour
|
||||
void replaceCar(GameObject car, string color)
|
||||
{
|
||||
car.GetComponent<PlayerController>().enabled = true;
|
||||
car.GetComponent<AgentControllerV6>().enabled = false;
|
||||
car.GetComponent<AgentController>().enabled = false;
|
||||
|
||||
cam.GetComponent<CameraControl>().getCar(car);
|
||||
//LookAt = car.transform;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
@@ -8,18 +9,55 @@ public class GameManager : MonoBehaviour
|
||||
public GameObject[] checkpoints;
|
||||
public GameObject[] players;
|
||||
|
||||
int currentLap = 1;
|
||||
int[] playerLaps;
|
||||
void Start()
|
||||
{
|
||||
|
||||
// reset laps
|
||||
playerLaps = new int[players.Count()];
|
||||
|
||||
for (int i = 0; i < playerLaps.Count(); i++)
|
||||
{
|
||||
playerLaps[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
foreach (GameObject player in players)
|
||||
for (int i = 0; i < players.Count(); i++)
|
||||
{
|
||||
|
||||
GameObject player = players[i];
|
||||
|
||||
bool isAI = true;
|
||||
if (player.GetComponent<PlayerController>().enabled)
|
||||
isAI = false;
|
||||
|
||||
if (isAI)
|
||||
{
|
||||
bool isFinished = player.GetComponent<AgentController>().isFinished;
|
||||
|
||||
if (isFinished)
|
||||
{
|
||||
player.GetComponent<AgentController>().isFinished = false;
|
||||
playerLaps[i] += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int checkpointsCollected = player.GetComponent<PlayerController>().checkpointsCollected;
|
||||
|
||||
if (checkpointsCollected == checkpoints.Count())
|
||||
{
|
||||
player.GetComponent<PlayerController>().checkpointsCollected = 0;
|
||||
playerLaps[i] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (playerLaps[i] > lapAmount)
|
||||
{
|
||||
player.GetComponent<Rigidbody>().isKinematic = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,21 +121,27 @@ public class PlayerController : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
Transform currentCheckpoint = checkpoints[checkpointsCollected].transform;
|
||||
float checkpintDistance = distanceToCheckpoint(currentCheckpoint);
|
||||
|
||||
if (checkpintDistance < 0.1f)
|
||||
{
|
||||
checkpointsCollected += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision other) {
|
||||
|
||||
if (other.gameObject.tag == "Wall")
|
||||
{
|
||||
// audio.Play();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
print(checkpointsCollected);
|
||||
Transform currentCheckpoint = checkpoints[checkpointsCollected].transform;
|
||||
if (other.gameObject == currentCheckpoint)
|
||||
{
|
||||
checkpointsCollected += 1;
|
||||
print(checkpointsCollected);
|
||||
}
|
||||
float distanceToCheckpoint(Transform checkpoint)
|
||||
{
|
||||
var closestPoint = checkpoint.GetComponent<Collider>().ClosestPointOnBounds(transform.position);
|
||||
var distanceToCheckpoint = Vector3.Distance(transform.position, closestPoint);
|
||||
return distanceToCheckpoint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ using Unity.VisualScripting;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
|
||||
public class AgentController : Agent
|
||||
public class AgentControllerOld : Agent
|
||||
{
|
||||
public float motorTorque = 300;
|
||||
public float brakeTorque = 500;
|
||||
|
||||
@@ -32,6 +32,7 @@ public class AgentControllerV6 : Agent
|
||||
public int maxStepsPerCheckpoint = 300;
|
||||
public int distanceBetweenCheckpoints = 5;
|
||||
public bool ignoreMentalPain = false;
|
||||
bool isEnabled = true;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -45,11 +46,15 @@ public class AgentControllerV6 : Agent
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
isEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
public override void OnEpisodeBegin()
|
||||
{
|
||||
if (!isEnabled)
|
||||
return;
|
||||
|
||||
stepsSinceCheckpoint = 0;
|
||||
checkpointsReached = 0;
|
||||
totalReward = 0;
|
||||
@@ -130,6 +135,9 @@ public class AgentControllerV6 : Agent
|
||||
|
||||
public override void OnActionReceived(ActionBuffers actions)
|
||||
{
|
||||
if (!isEnabled)
|
||||
return;
|
||||
|
||||
// Actions size = 2 [vertical speed, horizontal speed] = [-1..1, -1..1] // discrete = [{0, 1, 2}, {0, 1, 2}] = [{-1, 0, 1}...]
|
||||
float vInput = 0;
|
||||
float hInput = 0;
|
||||
@@ -285,6 +293,9 @@ public class AgentControllerV6 : Agent
|
||||
|
||||
public override void Heuristic(in ActionBuffers actionsOut)
|
||||
{
|
||||
if (!isEnabled)
|
||||
return;
|
||||
|
||||
var discreteActionsOut = actionsOut.DiscreteActions;
|
||||
|
||||
discreteActionsOut[0] = 2;
|
||||
|
||||
Reference in New Issue
Block a user