Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Pause system, API to pause and resume agents without re-evaluation #329

Open
Temasdin opened this issue Jan 27, 2025 · 0 comments

Comments

@Temasdin
Copy link

Temasdin commented Jan 27, 2025

Currently, it’s unclear how to easily implement pausing and resuming the performance of AI agents without re-evaluation.

Sometimes, we need to pause the AI. For instance, a simple pause menu might require globally pausing the entire system. Alternatively, we might want to pause specific agents, which would be a local agent pause rather than a system-wide one. Upon resuming the game or reactivating an AI agent, we would like them to continue pursuing their previously paused goals and the last action without re-evaluating, as re-evaluation could lead to loss of state or data.

  • Setting Time.timeScale = 0. However, this approach is suitable mainly for pause menus and even then, not always
  • Disabling the GoapBehaviour along with its IGoapController does not actually pause the ongoing AI logic that is currently being executed
  • Caching agent goals via agent.CurrentPlan.Goal followed by agent.ClearGoal() stops the AI, and later, calling agent.RequestGoal(cachedGoal) resumes the logic without re-evaluation. However, if the agent is toggled too quickly, attempting to read its goal risks throwing a null exception when accessing agent.CurrentPlan
  • Calling agent.StopAction() causes a loss of state and triggers re-evaluation

It would be great to have a clear API that allows pausing an agent without losing its state or data, ensuring that when resumed, it avoids re-evaluation, and the previously paused action continues seamlessly (provided that the conditions are still valid).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant