Game Manager WIP

This commit is contained in:
2024-04-24 08:53:46 +02:00
parent ccd2ea506b
commit 7b313fe2d4
14 changed files with 373 additions and 473 deletions

View File

@@ -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;

View File

@@ -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;