Is it possible to record demostrations from a NavMesh Agent?

I have a simple Finite State Machine AI with three states - patrol, idle, chase. The agent follows a set of checkpoints around the level and if the player is seen the agent starts to chase. I want to replicate this behavior as accurately as I can with ML-Agents. I have attempted to add a demonstration recorder script to the agent and let it run for a while but the demonstration file comes out empty.
Theoretically, is it possible to record the demonstrations from a NavMesh Agent or is it only possible to record demonstrations when a human is controlling the agent?

Hi @MrpHDanny -
Just to clarify, NavMeshAgent and Unity.MLAgents.Agent are separate classes and don’t have anything in common. Unfortunately, “Agent” is a pretty overloaded term, especially in AI.

That being said, you should be able to record demonstrations if you add an MLAgents.Agent and define the observations and actions for it. I’m not very familiar with NavMeshAgent, but I think things like NavMeshAgent.steeringTarget would be a useful observation. The actions are a bit harder since it depends on how you move the agent, but I would probably define the action space as the desired velocity, and use NavMeshAgent.desiredVelocity in the Agent.Heuristic method.

Hope that helps…

1 Like