Best practice for creating different Resource Blueprints

Hi,

I am looking to build a simple strategy game as an exercise. I want to have different kinds of resources that the AI will carry from A to B, like wood logs, stone, food, etc.

What is the best practice to work with these blueprints that all are of one type (Resource) but come with different characteristics?

My approach is to create a base Blueprint BP_Resource from which the other resources extend.

However I would later like to make the AI citizens consume various resources based on their needs. For example I would like the citizens to have needs for wood logs and food. When the need for food is high, they should go and look for food. When the need for logs is high, they should go and get some logs.

I don’t want to build this separately for each resource, obviously. Should I set up an Enumerator for this? Or a ResourceType structure that points to the Blueprint of the resource? Like how can I abstract the concept a little more, like you would do in code?

I am worried that in the EQS I can only query for explicit classes, not for something generic like “Resource I currently need”.

Thanks in advance

For sure, generic item blueprint with child classes is the way to go.

As for the ‘need implementation’, that’s a bit more of a fuzzy area. You could make the NPC have the basic need structure / config and subclass it for your actual players.

Exactly how you code something like the need, is really up to you. Yes, you might use enumerators, but you could just as easily have integers or floats etc.

Thanks for your response!

After playing around a bit, using a Struct for the Needs with a Class Reference to the Resource that is linked to the need turned out to be a practical way to go. I can just loop over each need, select the need with the largest desire and make the pawn pick up the Resource specified in that need through an EQS.

I will follow this route and see where it goes.

Sounds logical :slight_smile: