Add Gun State, fix PPO GAIL class bug

Add Gun state
fix PPO GAIL class errors
This commit is contained in:
2022-10-23 23:38:07 +09:00
parent 6ab56880d8
commit 818928a5aa
128 changed files with 1571 additions and 1394 deletions
@@ -1 +1 @@
{"count":1,"self":42.3855296,"total":42.4020608,"children":{"InitializeActuators":{"count":2,"self":0.0015155,"total":0.0015155,"children":null},"InitializeSensors":{"count":2,"self":0.0015017,"total":0.0015017,"children":null},"AgentSendState":{"count":1898,"self":0.0025031999999999997,"total":0.0025031999999999997,"children":null},"DecideAction":{"count":1898,"self":0.0070091999999999993,"total":0.0070091999999999993,"children":null},"AgentAct":{"count":1898,"self":0.0030023,"total":0.0030023,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1665414279","unity_version":"2020.3.19f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2020.3.19f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-PPO\\Aimbot-PPO-MultiScene -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-UCUNI -hubSessionId 39022900-48a5-11ed-b848-09be5949a456 -accessToken _47qt9I_MF3bhL7JS735Xdmfj8A4dGBOdRNKR0X2L_w00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.0","scene_name":"InGame","end_time_seconds":"1665414322"}}
{"count":1,"self":14.364236799999999,"total":14.7678687,"children":{"InitializeActuators":{"count":2,"self":0.0009999,"total":0.0009999,"children":null},"InitializeSensors":{"count":2,"self":0.0010008,"total":0.0010008,"children":null},"AgentSendState":{"count":504,"self":0.0060111,"total":0.0636617,"children":{"CollectObservations":{"count":504,"self":0.0546419,"total":0.0546419,"children":null},"WriteActionMask":{"count":503,"self":0.001006,"total":0.001006,"children":null},"RequestDecision":{"count":503,"self":0.0020027,"total":0.0020027,"children":null}}},"DecideAction":{"count":503,"self":0.0035023,"total":0.0035023,"children":null},"AgentAct":{"count":503,"self":0.3304658,"total":0.3304658,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1665764651","unity_version":"2020.3.19f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2020.3.19f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-PPO\\Aimbot-PPO-MultiScene -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-mO9W_RqJkSeNPEPgTMbRK -hubSessionId b189fbf0-4bd9-11ed-af18-5796c8a9db6e -accessToken 0gt45CYC6M5EI-dlFucvkHWtcpKMAExHCZ5Lm71p-7E00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.0","scene_name":"InGame","end_time_seconds":"1665764666"}}
File diff suppressed because it is too large Load Diff
@@ -79,6 +79,7 @@ public class AgentWithGun : Agent
private float LoadDirDateF;
private float loadDirTimeF;
public bool defaultTPCamera = true;
private bool gunReadyToggle = true;
private StartSeneData DataTransfer;
private UIController UICon;
private HistoryRecorder HistoryRec;
@@ -357,10 +358,9 @@ public class AgentWithGun : Agent
Ray ray = thisCam.ScreenPointToRay(point);
RaycastHit hit;
Debug.DrawRay(ray.origin, ray.direction * 100, Color.blue);
bool isGunReady = gunReady();
UICon.updateShootKeyViewer(shoot, isGunReady);
UICon.updateShootKeyViewer(shoot, gunReadyToggle);
//按下鼠标左键
if (shoot != 0 && isGunReady == true)
if (shoot != 0 && gunReadyToggle == true)
{
lastShootTime = Time.time;
@@ -377,7 +377,7 @@ public class AgentWithGun : Agent
shoot = 0;
return shootReward;
}
else if (shoot != 0 && isGunReady == false)
else if (shoot != 0 && gunReadyToggle == false)
{
shoot = 0;
return shootWithoutReadyReward;
@@ -536,6 +536,8 @@ public class AgentWithGun : Agent
sensor.AddObservation(rayDisResult); // 探测用RayDis结果 float[](raySensorNum,1)
//sensor.AddObservation(focusEnemyObserve); // 最近的Enemy情报 float[](3,1) MinEnemyIndex,x,z
//sensor.AddObservation(raySensorNum); // raySensor数量 int
gunReadyToggle = gunReady();
sensor.AddObservation(gunReadyToggle); // save gun is ready?
sensor.AddObservation(LoadDirDateF); // 用于loadModel的第一级dir
sensor.AddObservation(loadDirTimeF); // 用于loadModel的第二级dir
sensor.AddObservation(saveNow); // sent saveNow Toggle to python let agent save weights