Skip to content

Conversation

@AnomyxStudio
Copy link
Contributor

The current GoapActionProvider implementation has two limitations:

  1. It only supports requesting goals via generic type parameters, which limits the number of goals that can be requested
  2. It doesn't support dynamic goal requests from external configuration files (CSV/JSON/XML)

Added support for requesting goals by passing Type objects directly. This enables:

  • Dynamic goal creation from configuration files
  • No limit on the number of goals that can be requested simultaneously
// Before - Limited to generic parameters
_provider.RequestGoal<IdleGoal>();

// After - Supports dynamic goal requests
RequestGoal("IdleGoal");

private void RequestGoal(params string[] goals)
{
    var assembly = Assembly.GetExecutingAssembly();
    var types = goals.Select(goal => assembly.GetType($"Sample.{goal}")).ToArray();
    _provider.RequestGoal(types);
}

@crashkonijn
Copy link
Owner

Hi there!

Thanks for the PR!

That was technically already possible by building your own GoalRequest and using RequestGoal(IGoalRequest), but I agree this is better!

I've made a couple minor changes :)

It appears the pipelines are broken, I will merge this when I've fixed them!

@crashkonijn crashkonijn merged commit b05b7a0 into crashkonijn:master Feb 20, 2025
11 checks passed
@AnomyxStudio
Copy link
Contributor Author

You're right - I was aware of the IGoalRequest approach, but encountered some challenges when trying to resolve goal instances through AgentType.ResolveGoal due to its generic constraints. While there are potential workarounds using IGoalRequest, I felt that adding direct Type support would provide a simpler and more straightforward solution since it achieves the same functionality with less complexity. Thanks for the merge!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants