Hi, so i’m making a task based RTS where pawns have needs, works and other tasks they have to complete. This would be a system similar to Rimworld or Oxygen Not Included where a task is added to a pool and the pawn evaluates which one is the higher priority task, and then executes it.
The idea behind it is to have a multiple of task providers who submit tasks to a pool, and then that same pool is evaluated and most important task is choosen to be executed.
Example: A pawn would have:
Hunger - Eat Task
Tiredness - Sleep Task
Workplace - GoTo Task, Work Task
School - GoTo Task, Study Task
each task would have its own execution code which would be segregated into their own systems (IE: EatTaskExecutionSystem). My main problem is on how to create such a Task pool and how to structure it. Each task would have its own Task Data.
IE:
EatTask - EatTaskData - int ItemToEatID
SleepTask - SleepTaskData - float3 sleepingSpot
GoToTask - GoToTaskData - float3 position
and so on… but i can’t just add the component data to the Entity as that would be changing its archetype, this would be one of the main systems of the game so this would not be optimal.
A DynamicBuffer would not suffice as they would be different structs for each Task Data.
Why did i choose this system? I want my game to be easly modifiable, where if i want to add a new mechanic, all i’d have to do is to create a new FooTaskExecutionSystem, FooTaskData and some way to add that task to the pool.
Is such a system possible on ECS?
Would i need to create an Managed System tree instead of an unmanaged?
Are there any better alternatives?