浏览代码

V5

/develop/soccer-groupman/mod
Andrew Cohen 4 年前
当前提交
38705503
共有 5 个文件被更改,包括 282 次插入202 次删除
  1. 244
      Project/Assets/ML-Agents/Examples/Soccer/Prefabs/BlueStriker.prefab
  2. 152
      Project/Assets/ML-Agents/Examples/Soccer/Prefabs/PurpleStriker.prefab
  3. 33
      Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab
  4. 51
      Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs
  5. 4
      Project/ProjectSettings/TagManager.asset

244
Project/Assets/ML-Agents/Examples/Soccer/Prefabs/BlueStriker.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5323282419282712526
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1667118361155461463}
- component: {fileID: 6392954439193329649}
m_Layer: 9
m_Name: BlueReverseRays
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1667118361155461463
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5323282419282712526}
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_Children: []
m_Father: {fileID: 6033637986218926083}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!114 &6392954439193329649
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5323282419282712526}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SensorName: BlueRayPerceptionSensorReverse
m_DetectableTags:
- ball
- blueGoal
- purpleGoal
- wall
- blueAgent
- purpleAgent
m_RaysPerDirection: 2
m_MaxRayDegrees: 45
m_SphereCastRadius: 0.5
m_RayLength: 60
m_RayLayerMask:
serializedVersion: 2
m_Bits: 4294967291
m_ObservationStacks: 3
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 &6030327595305340077
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 5932463474991089723}
- component: {fileID: 5918399385278882223}
- component: {fileID: 5921112085002027199}
- component: {fileID: 5918526098337498759}
- component: {fileID: 5918526098337498759}
m_Layer: 9
- component: {fileID: 5154235608112411214}
- component: {fileID: 4580724097406181005}
m_Layer: 10
m_Name: BlueStriker
m_TagString: blueAgent
m_Icon: {fileID: 0}

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 6027426712508094869}
- {fileID: 1667118361155461463}
- {fileID: 4544914441785437329}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}

VectorObservationSize: 0
NumStackedVectorObservations: 1
m_ActionSpec:
m_NumContinuousActions: 0
BranchSizes: 030000000300000003000000
VectorActionSize: 030000000300000003000000
m_NumContinuousActions: 3
BranchSizes:
VectorActionSize: 03000000
VectorActionSpaceType: 0
VectorActionSpaceType: 1
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 5022602860645237092, guid: 564bcbe7c3d62405da7bc6d3b6942309, type: 3}
m_InferenceDevice: 2

agentRb: {fileID: 0}
initialPos: {x: 0, y: 0, z: 0}
rotSign: 0
--- !u!114 &6208698791010987259
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6030327595305340077}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a5c9d521e5ef4759a8246a07d52221e, type: 3}
m_Name:
m_EditorClassIdentifier:
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1
--- !u!114 &2699369445970917263
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6030327595305340077}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a6da8f78a394c6ab027688eab81e04d, type: 3}
m_Name:
m_EditorClassIdentifier:
debugCommandLineOverride:
--- !u!114 &5918526098337498759
MonoBehaviour:
m_ObjectHideFlags: 0

m_SensorName: BallBlueRayPerceptionSensor
m_DetectableTags:
- ball
- blueGoal
- purpleGoal
- wall
m_RaysPerDirection: 12
m_MaxRayDegrees: 75
m_SphereCastRadius: 0.5
m_RaysPerDirection: 20
m_MaxRayDegrees: 160
m_SphereCastRadius: 1
m_Bits: 1331
m_Bits: 819
--- !u!114 &6208698791010987259
--- !u!114 &6166895040598452978
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a5c9d521e5ef4759a8246a07d52221e, type: 3}
m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3}
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1
--- !u!114 &2699369445970917263
m_SensorName: TeammateBlueRayPerceptionSensor
m_DetectableTags:
- blueAgent
m_RaysPerDirection: 12
m_MaxRayDegrees: 160
m_SphereCastRadius: 1
m_RayLength: 60
m_RayLayerMask:
serializedVersion: 2
m_Bits: 1331
m_ObservationStacks: 3
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!114 &5154235608112411214
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a6da8f78a394c6ab027688eab81e04d, type: 3}
m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3}
debugCommandLineOverride:
--- !u!114 &6166895040598452978
m_SensorName: OpponentBlueRayPerceptionSensor
m_DetectableTags:
- purpleAgent
m_RaysPerDirection: 12
m_MaxRayDegrees: 160
m_SphereCastRadius: 1
m_RayLength: 60
m_RayLayerMask:
serializedVersion: 2
m_Bits: 2355
m_ObservationStacks: 3
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!114 &4580724097406181005
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SensorName: AgentBlueRayPerceptionSensor
m_SensorName: WallBlueRayPerceptionSensor
- wall
- wall
- blueAgent
- purpleAgent
m_RaysPerDirection: 12
m_MaxRayDegrees: 160
m_RaysPerDirection: 5
m_MaxRayDegrees: 90
m_Bits: 819
m_Bits: 307
m_ObservationStacks: 3
rayHitColor: {r: 1, g: 0, b: 0, a: 1}
rayMissColor: {r: 1, g: 1, b: 1, a: 1}

- component: {fileID: 6033233183606366077}
- component: {fileID: 6035635177096029035}
- component: {fileID: 6045733493795046915}
m_Layer: 9
m_Layer: 10
m_Name: eye
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 6033411887465631805}
- component: {fileID: 6035252438780786863}
- component: {fileID: 6045480896910362567}
m_Layer: 9
m_Layer: 10
m_Name: mouth
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 6027113181451225691}
- component: {fileID: 6035574394446183967}
- component: {fileID: 6044060293733854483}
m_Layer: 9
m_Layer: 10
m_Name: Headband
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 6027118128478398759}
- component: {fileID: 6035595611599232351}
- component: {fileID: 6044185886974322897}
m_Layer: 9
m_Layer: 10
m_Name: eye
m_TagString: Untagged
m_Icon: {fileID: 0}

m_Component:
- component: {fileID: 6027294420111308789}
- component: {fileID: 6052064014238379799}
m_Layer: 9
m_Layer: 10
m_Name: AgentCamera
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 6027426712508094869}
- component: {fileID: 6035473685663500207}
- component: {fileID: 6045987226277367067}
m_Layer: 9
m_Layer: 10
m_Name: AgentCube_Blue
m_TagString: Untagged
m_Icon: {fileID: 0}

m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &7803096889037966710
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4544914441785437329}
- component: {fileID: 7531414272779648763}
m_Layer: 10
m_Name: BlueReverseRays
m_TagString: blueAgent
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4544914441785437329
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7803096889037966710}
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_Children: []
m_Father: {fileID: 6033637986218926083}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!114 &7531414272779648763
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7803096889037966710}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SensorName: BackBlueRayPerceptionSensor
m_DetectableTags:
- wall
- blueGoal
- purpleGoal
m_RaysPerDirection: 1
m_MaxRayDegrees: 20
m_SphereCastRadius: 0.5
m_RayLength: 60
m_RayLayerMask:
serializedVersion: 2
m_Bits: 307
m_ObservationStacks: 3
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

152
Project/Assets/ML-Agents/Examples/Soccer/Prefabs/PurpleStriker.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &870745635885946275
--- !u!1 &393196613380590445
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Component:
- component: {fileID: 8002379972027386189}
- component: {fileID: 3634001036900456413}
m_Layer: 9
- component: {fileID: 3012430755271482569}
- component: {fileID: 8715403559456655484}
m_Layer: 11
m_TagString: Untagged
m_TagString: purpleAgent
--- !u!4 &8002379972027386189
--- !u!4 &3012430755271482569
m_GameObject: {fileID: 870745635885946275}
m_GameObject: {fileID: 393196613380590445}
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_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!114 &3634001036900456413
--- !u!114 &8715403559456655484
m_GameObject: {fileID: 870745635885946275}
m_GameObject: {fileID: 393196613380590445}
m_SensorName: PurpleRayPerceptionSensorReverse
m_SensorName: BackPurpleRayPerceptionSensor
- ball
- wall
- wall
- purpleAgent
- blueAgent
m_RaysPerDirection: 2
m_MaxRayDegrees: 45
m_RaysPerDirection: 1
m_MaxRayDegrees: 20
m_Bits: 4294967291
m_Bits: 307
m_ObservationStacks: 3
rayHitColor: {r: 1, g: 0, b: 0, a: 1}
rayMissColor: {r: 1, g: 1, b: 1, a: 1}

- component: {fileID: 8274089369872465524}
- component: {fileID: 8262316339047102392}
- component: {fileID: 8255026012314912624}
m_Layer: 9
m_Layer: 11
m_Name: Headband
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 8272268828723110618}
- component: {fileID: 8262600791238029904}
- component: {fileID: 8254545225651916204}
m_Layer: 9
m_Layer: 11
m_Name: mouth
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 8272287767057202704}
- component: {fileID: 8262944367852513330}
- component: {fileID: 8254399400540653710}
m_Layer: 9
m_Layer: 11
m_Name: eye
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 8272111360709471126}
- component: {fileID: 8262288428532764636}
- component: {fileID: 8254746230599396730}
m_Layer: 9
m_Layer: 11
m_Name: AgentCube_Purple
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 8273740251038337464}
- component: {fileID: 8262514225167325024}
- component: {fileID: 8253127364903272116}
m_Layer: 9
m_Layer: 11
m_Name: eye
m_TagString: Untagged
m_Icon: {fileID: 0}

- component: {fileID: 8303549175822251130}
- component: {fileID: 8307960943556301180}
- component: {fileID: 8307613324337731416}
- component: {fileID: 8307581884824213156}
- component: {fileID: 8307581884824213156}
m_Layer: 9
- component: {fileID: 4520953910130910384}
- component: {fileID: 8862605692950166824}
m_Layer: 11
m_Name: PurpleStriker
m_TagString: purpleAgent
m_Icon: {fileID: 0}

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 8272111360709471126}
- {fileID: 8002379972027386189}
- {fileID: 3012430755271482569}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}

VectorObservationSize: 0
NumStackedVectorObservations: 1
m_ActionSpec:
m_NumContinuousActions: 0
BranchSizes: 030000000300000003000000
VectorActionSize: 030000000300000003000000
m_NumContinuousActions: 3
BranchSizes:
VectorActionSize: 03000000
VectorActionSpaceType: 0
VectorActionSpaceType: 1
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 11400000, guid: b0a629580a0ab48a5a774f90ff1fb48b, type: 3}
m_InferenceDevice: 2

agentRb: {fileID: 0}
initialPos: {x: 0, y: 0, z: 0}
rotSign: 0
--- !u!114 &997902657987214240
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8277532713597140832}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a5c9d521e5ef4759a8246a07d52221e, type: 3}
m_Name:
m_EditorClassIdentifier:
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1
--- !u!114 &8775384753860522886
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8277532713597140832}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a6da8f78a394c6ab027688eab81e04d, type: 3}
m_Name:
m_EditorClassIdentifier:
debugCommandLineOverride:
--- !u!114 &8307581884824213156
MonoBehaviour:
m_ObjectHideFlags: 0

m_SensorName: BallPurpleRayPerceptionSensor
m_DetectableTags:
- ball
- purpleGoal
- blueGoal
- wall
m_RaysPerDirection: 12
m_MaxRayDegrees: 75
m_SphereCastRadius: 0.5
m_RaysPerDirection: 20
m_MaxRayDegrees: 160
m_SphereCastRadius: 1
m_Bits: 1331
m_Bits: 819
--- !u!114 &997902657987214240
--- !u!114 &613782037252311925
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a5c9d521e5ef4759a8246a07d52221e, type: 3}
m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3}
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1
--- !u!114 &8775384753860522886
m_SensorName: TeammatePurpleRayPerceptionSensor
m_DetectableTags:
- purpleAgent
m_RaysPerDirection: 12
m_MaxRayDegrees: 160
m_SphereCastRadius: 1
m_RayLength: 60
m_RayLayerMask:
serializedVersion: 2
m_Bits: 2355
m_ObservationStacks: 3
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!114 &4520953910130910384
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a6da8f78a394c6ab027688eab81e04d, type: 3}
m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3}
debugCommandLineOverride:
--- !u!114 &613782037252311925
m_SensorName: OpponentPurpleRayPerceptionSensor
m_DetectableTags:
- blueAgent
m_RaysPerDirection: 12
m_MaxRayDegrees: 160
m_SphereCastRadius: 1
m_RayLength: 60
m_RayLayerMask:
serializedVersion: 2
m_Bits: 1331
m_ObservationStacks: 3
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!114 &8862605692950166824
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Script: {fileID: 11500000, guid: 6bb6b867a41448888c1cd4f99643ad71, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SensorName: AgentPurpleRayPerceptionSensor
m_SensorName: WallPurpleRayPerceptionSensor
- wall
- wall
- purpleAgent
- blueAgent
m_RaysPerDirection: 12
m_MaxRayDegrees: 160
m_RaysPerDirection: 5
m_MaxRayDegrees: 90
m_Bits: 819
m_Bits: 307
m_ObservationStacks: 3
rayHitColor: {r: 1, g: 0, b: 0, a: 1}
rayMissColor: {r: 1, g: 1, b: 1, a: 1}

m_Component:
- component: {fileID: 8272334313488723784}
- component: {fileID: 8258400870889435078}
m_Layer: 9
m_Layer: 11
m_Name: AgentCamera
m_TagString: Untagged
m_Icon: {fileID: 0}

33
Project/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab


- component: {fileID: 135993924486820224}
- component: {fileID: 114273807544954564}
- component: {fileID: 54100138833592438}
m_Layer: 10
m_Layer: 9
m_Name: Soccer Ball
m_TagString: ball
m_Icon: {fileID: 0}

m_Modification:
m_TransformParent: {fileID: 4558743310993102}
m_Modifications:
- target: {fileID: 870745635885946275, guid: 57db73bb516494aa6ab66ac13e987d44,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8274065550969517594, guid: 57db73bb516494aa6ab66ac13e987d44,
type: 3}
propertyPath: m_RootOrder

m_Modification:
m_TransformParent: {fileID: 4558743310993102}
m_Modifications:
- target: {fileID: 5918526098337498759, guid: 772fee460e5734c5aac30b4e2a9f6b3c,
- target: {fileID: 5918399385278882223, guid: 772fee460e5734c5aac30b4e2a9f6b3c,
propertyPath: m_MaxRayDegrees
value: 75
objectReference: {fileID: 0}
- target: {fileID: 5918526098337498759, guid: 772fee460e5734c5aac30b4e2a9f6b3c,
type: 3}
propertyPath: m_RaysPerDirection
value: 12
propertyPath: m_UseChildSensors
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6030327595305340077, guid: 772fee460e5734c5aac30b4e2a9f6b3c,
type: 3}

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6166895040598452978, guid: 772fee460e5734c5aac30b4e2a9f6b3c,
type: 3}
propertyPath: m_SensorName
value: AgentBlueRayPerceptionSensor
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 772fee460e5734c5aac30b4e2a9f6b3c, type: 3}
--- !u!114 &114850431417842684 stripped

propertyPath: m_Name
value: BlueStriker (3)
objectReference: {fileID: 0}
- target: {fileID: 6030327595305340077, guid: 772fee460e5734c5aac30b4e2a9f6b3c,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6033637986218926083, guid: 772fee460e5734c5aac30b4e2a9f6b3c,
type: 3}
propertyPath: m_RootOrder

m_Modification:
m_TransformParent: {fileID: 4558743310993102}
m_Modifications:
- target: {fileID: 4520953910130910384, guid: 57db73bb516494aa6ab66ac13e987d44,
type: 3}
propertyPath: m_SensorName
value: OpponentAgentPurpleRayPerceptionSensor
objectReference: {fileID: 0}
- target: {fileID: 8274065550969517594, guid: 57db73bb516494aa6ab66ac13e987d44,
type: 3}
propertyPath: m_RootOrder

51
Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs


float m_BallTouch;
public Position position;
const float k_Power = 2000f;
const float k_Power = 3000f;
float m_RotateSpeed = 1.5f;
[HideInInspector]

}
else
{
m_LateralSpeed = 0.3f;
m_ForwardSpeed = 1.0f;
m_LateralSpeed = 1.0f;
m_ForwardSpeed = 1.5f;
}
m_SoccerSettings = FindObjectOfType<SoccerSettings>();
agentRb = GetComponent<Rigidbody>();

}
public void MoveAgent(ActionSegment<int> act)
public void MoveAgent(ActionSegment<float> act)
var forward = Mathf.Clamp(act[0], -1f, 1f);
var right = Mathf.Clamp(act[1], -1f, 1f);
var rotate = Mathf.Clamp(act[2], -1f, 1f);
var forwardAxis = act[0];
var rightAxis = act[1];
var rotateAxis = act[2];
switch (forwardAxis)
if (forward > 0)
case 1:
dirToGo = transform.forward * m_ForwardSpeed;
m_KickPower = 1f;
break;
case 2:
dirToGo = transform.forward * -m_ForwardSpeed;
break;
m_KickPower = forward;
switch (rightAxis)
{
case 1:
dirToGo = transform.right * m_LateralSpeed;
break;
case 2:
dirToGo = transform.right * -m_LateralSpeed;
break;
}
dirToGo = transform.forward * forward * m_ForwardSpeed;
dirToGo += transform.right * right * m_LateralSpeed;
rotateDir = -transform.up * rotate * m_RotateSpeed;
switch (rotateAxis)
{
case 1:
rotateDir = transform.up * -1f;
break;
case 2:
rotateDir = transform.up * 1f;
break;
}
transform.Rotate(rotateDir, Time.deltaTime * 100f);
agentRb.AddForce(dirToGo * m_SoccerSettings.agentRunSpeed,
ForceMode.VelocityChange);

// Existential penalty for Strikers
AddReward(-m_Existential);
}
MoveAgent(actionBuffers.DiscreteActions);
MoveAgent(actionBuffers.ContinuousActions);
}
public override void Heuristic(in ActionBuffers actionsOut)

4
Project/ProjectSettings/TagManager.asset


-
-
- invisible
- soccerAgents
-
- blueSoccerAgent
- purpleSoccerAgent
-
-
-

正在加载...
取消
保存