Hello,
I am struggling to find a way to change the behavior of the agent. I have multiple agents trained differently (suppose we have one that explores the map and one that attacks the enemy). Both of them need to have the ray-cast perception sensors, but they have different observation vectors (and space size).
So I have two classes that extend the Agent class Explore : Agent, Attack : Agent trained independently and I want them to be assigned on the same NPC (if Enemy in sight ChangeBrain(Attack)).
Why I need this? I started with a size of 3 in my first training and now I need a different size, but hours of training will be lost. Other problems that may be encountered are that if I train the agent to flee/retreat and add a parameter that says if you are stronger you should attack not flee, it will never learn as he was always running (that means I need to make a new training session).
Thank you!
You’ll have to programmatically change the sensors as well with this approach.
- What about having two agents under one parent gameobject? Then you can set one as active, and when it’s time to switch, set the other as active and deactivate the first one.
- You can also give the agent a superset of the observations. It will learn to ignore the ones not relevant to the task at hand (e.g. explore might learn to ignore enemies). That way you’ll have one set of observations for both classes.
- Taking this a step further - you can give an observation that represents the role of the agent (explore vs. attack) as a GoalSensor. then you can train one agent to do both tasks.
1 Like