浏览代码

SideChannels replace FloatProp

/asymm-envs
Andrew Cohen 5 年前
当前提交
d8c7b60c
共有 3 个文件被更改,包括 9 次插入7 次删除
  1. 4
      Project/Assets/ML-Agents/Examples/CubeWars/Prefabs/CubeWarArea.prefab
  2. 4
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs
  3. 8
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/SmallCubeAgent.cs

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


m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3952752091333818756}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.1, z: 0}
m_LocalPosition: {x: 0, y: 0.05, z: 0}
m_LocalScale: {x: 4.7, y: 0.1, z: 4.7}
m_Children: []
m_Father: {fileID: 5682403052473880320}

hasUpgradedFromAgentParameters: 1
maxStep: 3000
area: {fileID: 1819751139121548}
turnSpeed: 100
turnSpeed: 150
moveSpeed: 1
normalMaterial: {fileID: 2100000, guid: 88b9ae7af2c1748a0a1f63407587a601, type: 2}
weakMaterial: {fileID: 2100000, guid: 52eab8ab5010f438fab93da85735ba1d, type: 2}

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


public void SetLaserLengths()
{
m_LaserLength = Academy.Instance.FloatProperties.GetPropertyWithDefault("laser_length", 1.0f);
m_LaserLength = 1f;
float agentScale = Academy.Instance.FloatProperties.GetPropertyWithDefault("agent_scale", 5.0f);
float agentScale = 5f;
gameObject.transform.localScale = new Vector3(agentScale, agentScale, agentScale);
}

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


using UnityEngine;
using MLAgents;
using MLAgents.Sensors;
using MLAgents.SideChannels;
public class SmallCubeAgent : Agent
{

m_Dead = false;
m_Shoot = false;
m_ShootTime = -.5f;
m_Bonus = Academy.Instance.FloatProperties.GetPropertyWithDefault("bonus", 0);
//m_Bonus = Academy.Instance.FloatProperties.GetPropertyWithDefault("bonus", 0);
m_Bonus = SideChannelUtils.GetSideChannel<FloatPropertiesChannel>().GetPropertyWithDefault("bonus", 0);
m_AgentRb.velocity = Vector3.zero;
myLaser.transform.localScale = new Vector3(0f, 0f, 0f);
float smallRange = 50f * m_MyArea.range;

public void SetLaserLengths()
{
m_LaserLength = Academy.Instance.FloatProperties.GetPropertyWithDefault("laser_length", 1.0f);
m_LaserLength = 1f;
float agentScale = Academy.Instance.FloatProperties.GetPropertyWithDefault("agent_scale", 1.0f);
float agentScale = 1f;
gameObject.transform.localScale = new Vector3(agentScale, agentScale, agentScale);
}

正在加载...
取消
保存