How to deal with complex, long term decisions?

Passero

New member
I'm building a 4x space game and I'm using behavior designer for my AI.

My individual units use their own BT which is fine and I can easily develop them.

I am now in the process of looking into building an overall AI that dictates the behavior of the AI player in general.
For example, I'm looking to build a tree that helps the AI behavior into making decisions what to do in the short term in order to fulfill a long term objective.
My AI players have a personality so some will be focused towards military while others towards diplomacy.

For example some AI will start by building a space port so it can start building mining ships so they can gather resources to build weapons and more ships.
Another AI will also build a space port but instead of building a miner, it will start creating a trader ship so it can look for trading opportunities to make money.
Another AI will focus on a research ship to research other systems.

That's just one example.

I'm basically lost into finding a proper way to model complex long term goals into the BT. If an AI is aggressive, it will focus on military but it will still need to put some focus in the diplomatic part of the tech tree as well in deciding on the diplomatic objectives in game. It will also need to research other systems and so on.
In the same way, a diplomatic AI will still need to build up a military stronghold so it can defend/attack if it needs to.

Any tips on how I can best model such behaviors in behavior designer?
 
Ok thanks. I looked at that before but never got into it.
I mainly was confused with the priority vs utility selector. From a pure technical perspective, the utility chesk every tick for the utility and aborts accordingly while the priority is more static and let the task run and only rechecks when the tree starts over, right?

And in order for the utility to work properly, the values need to be normalized because otherwise they won't make sense to compare to each other.
Also, because utility checks are done on every tick, the utility calculation should be performant. complex calculations will not be good...
Any build in way to reduce the rate at which these are checked? Instead of every tick, maybe every second or even longer in between?
 
Just to recap if I understand the idea correctly...

Suppose I have an action that will decide what building to build next.
In that action, I will loop over all available buildings I can build and calculate the utility for each of them. The action will return the highest utility amongst those buildings so the BT can use that.
The same would be for the action to decide what ship to build. Each available ship will have a utility and the highest value will be passed to the BT.

In the utility selector, if the ship's utility is higher than the building, a ship will be build. If the building is higher, the building will be build.

From there, I can see that there are plenty of utility checks happening every tick...
 
Suppose I have an action that will decide what building to build next.
In that action, I will loop over all available buildings I can build and calculate the utility for each of them. The action will return the highest utility amongst those buildings so the BT can use that.
The same would be for the action to decide what ship to build. Each available ship will have a utility and the highest value will be passed to the BT.

In the utility selector, if the ship's utility is higher than the building, a ship will be build. If the building is higher, the building will be build.

From there, I can see that there are plenty of utility checks happening every tick...
That could work. I wouldn't worry about the number of utility checks that happen - those are extremely quick and I would first get it working and then look at optimization. The utility functions should be the high level "what is the purpose of the AI", whereas the individual behavior tree tasks are for carrying out that purpose.
 
Top