浏览代码

remove tank, make movements of heal/dps equal

/develop/teammanager/cubewars
Andrew Cohen 4 年前
当前提交
722befc2
共有 3 个文件被更改,包括 96 次插入87 次删除
  1. 155
      Project/Assets/ML-Agents/Examples/CubeWars/Prefabs/CubeWarArea.prefab
  2. 2
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs
  3. 26
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs

155
Project/Assets/ML-Agents/Examples/CubeWars/Prefabs/CubeWarArea.prefab


m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

- {fileID: 4430881949022472}
- {fileID: 4534035899647546}
m_Father: {fileID: 4688212428263696}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1457179540742082
GameObject:

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_LocalPosition: {x: 0, y: 12.3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3015436747103054322}
- {fileID: 3015436747103054322}
- {fileID: 4419274671784554}
- {fileID: 5634558950757305706}
- {fileID: 6276286609035264789}

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

- {fileID: 3256731534312223688}
- {fileID: 3331463254605917318}
m_Father: {fileID: 4688212428263696}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!65 &8758597709486190942
BoxCollider:

VectorActionDescriptions: []
VectorActionSpaceType: 0
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 11400000, guid: 94b4c8f1d024049fe9cb0b180fe00229, type: 3}
m_Model: {fileID: 5022602860645237092, guid: a19f9fb52da154fe686c5bda62235111, type: 3}
m_InferenceDevice: 0
m_BehaviorType: 0
m_BehaviorName: Dragon

m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0

m_Modification:
m_TransformParent: {fileID: 4688212428263696}
m_Modifications:
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: area
value:
objectReference: {fileID: 1819751139121548}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: largeAgent
value:
objectReference: {fileID: 5707177387575911509}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: role
value: 2
objectReference: {fileID: 0}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: MaxStep
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8081094897351109481, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: area
value:
objectReference: {fileID: 1819751139121548}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: largeAgent
value:
objectReference: {fileID: 5707177387575911509}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: role
value: 2
objectReference: {fileID: 0}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: MaxStep
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8083776131842293165, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: m_Name

type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 11400000, guid: 551d0363b1f054571bf47ab1fadceb56,
objectReference: {fileID: 5022602860645237092, guid: e8d60562c08744715ab1244699344707,
type: 3}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4dd35c7381e7445c99133a34a83e21db, type: 3}

m_Modification:
m_TransformParent: {fileID: 4688212428263696}
m_Modifications:
- target: {fileID: 100000, guid: 8c40fb8b2e877464087ee4920444a812, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 8c40fb8b2e877464087ee4920444a812,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 8c40fb8b2e877464087ee4920444a812, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 8c40fb8b2e877464087ee4920444a812, type: 3}
propertyPath: m_LocalPosition.x
value: 0

value: 2
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 8c40fb8b2e877464087ee4920444a812, type: 3}
propertyPath: m_LocalPosition.y

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8c40fb8b2e877464087ee4920444a812, type: 3}
--- !u!1 &3015436747102959058 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100000, guid: 8c40fb8b2e877464087ee4920444a812,
type: 3}
m_PrefabInstance: {fileID: 3015436747102925682}
m_PrefabAsset: {fileID: 0}
type: 3}
m_PrefabInstance: {fileID: 3015436747102925682}
m_PrefabAsset: {fileID: 0}
--- !u!1 &3015436747102959058 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100000, guid: 8c40fb8b2e877464087ee4920444a812,
type: 3}
m_PrefabInstance: {fileID: 3015436747102925682}
m_PrefabAsset: {fileID: 0}

m_Modification:
m_TransformParent: {fileID: 4688212428263696}
m_Modifications:
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: largeAgent
value:
objectReference: {fileID: 5707177387575911509}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: area
value:
objectReference: {fileID: 1819751139121548}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: role
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: MaxStep
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8081094897351109481, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: largeAgent
value:
objectReference: {fileID: 5707177387575911509}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: area
value:
objectReference: {fileID: 1819751139121548}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: role
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: MaxStep
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8083776131842293165, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8136121708948342693, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: m_Constraints

type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 11400000, guid: 551d0363b1f054571bf47ab1fadceb56,
objectReference: {fileID: 5022602860645237092, guid: e8d60562c08744715ab1244699344707,
type: 3}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4dd35c7381e7445c99133a34a83e21db, type: 3}

m_Modification:
m_TransformParent: {fileID: 4688212428263696}
m_Modifications:
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: area
value:
objectReference: {fileID: 1819751139121548}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: largeAgent
value:
objectReference: {fileID: 5707177387575911509}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: MaxStep
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8081094897351109481, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: area
value:
objectReference: {fileID: 1819751139121548}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: largeAgent
value:
objectReference: {fileID: 5707177387575911509}
- target: {fileID: 5940168890073970201, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: MaxStep
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8083776131842293165, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}
propertyPath: m_Name

type: 3}
propertyPath: m_Model
value:
objectReference: {fileID: 11400000, guid: 551d0363b1f054571bf47ab1fadceb56,
objectReference: {fileID: 5022602860645237092, guid: e8d60562c08744715ab1244699344707,
type: 3}
- target: {fileID: 8705827100738960883, guid: 4dd35c7381e7445c99133a34a83e21db,
type: 3}

2
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs


var rayDir = 120.0f * myTransform.forward;
Debug.DrawRay(myTransform.position, rayDir, Color.red, 0f, true);
RaycastHit hit;
if (Physics.SphereCast(transform.position, 10f, rayDir, out hit, 120f))
if (Physics.SphereCast(transform.position, 4f, rayDir, out hit, 120f))
{
if (hit.collider.gameObject.CompareTag("StrongSmallAgent") || hit.collider.gameObject.CompareTag("WeakSmallAgent"))
{

26
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs


m_Damage = .05f;
m_Heal = 0f;
m_MoveSpeed = 10f;
m_TurnSpeed = 200f;
m_TurnSpeed = 150f;
m_Cooldown = .25f;
m_Splash = 2f;
m_Range = 25f;

m_RoleObs[2] = 1f;
m_HitPointsTotal = 1f;
m_Damage = .02f;
m_Heal = .1f;
m_MoveSpeed = 6f;
m_TurnSpeed = 100f;
m_Heal = 0f;
m_MoveSpeed = 10f;
m_TurnSpeed = 150f;
m_Cooldown = .4f;
m_Splash = 2f;
m_Range = 25f;

if (hit.collider.gameObject.CompareTag("StrongSmallAgent") || hit.collider.gameObject.CompareTag("WeakSmallAgent"))
{
hit.collider.gameObject.GetComponent<SmallCubeAgent>().HealAgent(m_Heal);
if (role == Role.Healer)
{
AddReward(.05f);
}
//if (role == Role.Healer)
//{
// AddReward(.05f);
//}
}
else if (hit.collider.gameObject.CompareTag("StrongLargeAgent") || hit.collider.gameObject.CompareTag("WeakLargeAgent"))

if (role == Role.DPS)
{
AddReward(.05f);
AddReward(.2f);
}
}
}

{
if (!m_Dead)
{
if (role == Role.Tank)
{
AddReward(.05f);
}
//if (role == Role.Tank)
//{
// AddReward(.05f);
//}
m_HitPoints -= damage;
HealthStatus();
return m_HitPoints <= 0;

正在加载...
取消
保存