Repository navigation
Replies: 2 comments 1 reply
|
Hi! This is a more godot related question, thing is that removing stuff may happen in between a frame or later, so the current best approach would be calling your function like this |
With standard vectorized environment training (that's how multiple AIControllers are treated with SB3/CleanRL/and some other training script setups), it's not really easy to remove an agent during training as there's a fixed size buffer. So you would have to modify both the sync code, the training framework/setup and potentially the gdrl env wrapper to accommodate a changing size of agents. The easiest way to handle this is to not modify the amount of agents during training. Whether it's feasible depends on the project. In some projects, you can reuse the agent instead of removing/respawning, and you can also make some agents temporarily inactive by using an observation flag (is_active) along with potentially zeroing out all other observations during the inactive period, and ignoring the actions for that period. With our Rllib multiagent training example, any AIController you set to We also have a discord server if you'd like to discuss this or other issues more (although feel free to ask here as well, whichever you prefer). |
Uh oh!
There was an error while loading. Please reload this page.
I have a Godot project with multiple agents that interact with each other.
During fights, sometimes an agent’s parent node becomes null. The problem is that the agent still tries to call methods like get_obs or get_rewards, but since its parent no longer exists, an error occurs..
I attempted to create a remove_agent function in the sync script, but since the action arrays are initialized with a fixed length based on the number of agents, errors still occur:
My question is:
What is the best way to safely remove an agent in Godot whose parent node is null, while ensuring that all related arrays and structures (agent lists, action spaces, policy names, etc.) are updated correctly? Is manually removing the agent the right approach, or should I handle this problem differently?
All reactions