Our game, Indigenous, involves players building villages by commanding their villagers as well as working alongside them in a mashup of third-person survival and RTS game modes.
I’m currently working on commanding the villager to gather items - more specifically in the stage where the AI locates the item to gather. I’m trying to find a “best practices” scenario for the gather logic.
It’s not a hard problem to solve if you ask the AI to gather wood since wood is everywhere, but what if the player asks the villager AI to gather a rare mineral that’s in a set of caves across the island? The player doesn’t know exactly where the mineral is - only that he knows is probably in those caves. Do you run a sphere check on the entire island? That seems like a performance killer to me…
My other thought was to break the island into named zones and throw all gatherable items into a data table alongside each zone they exist within, then the villager AI can walk to the zone then cast a smaller sphere trace.
Of course all of this has to be procedural and run in real-time, since our islands are procedurally generated…
Does anyone else have a better idea? I’m not experienced in AI at all so I’m really just trying to use intuition, which is likely leading me to an incorrect solution.