Devlog 2 - Need Simulation System


Need Simulation System

In order to allow the goal generator in the GOAP system to work on its own, instead of manually submitting goals to the AI Controller every time during the test. I need a demand system similar to the Sims to guide the behavior of the AI. Referring to the setting of The Sims, I added six variables as the basic needs of an NPC, they are Hunger, Energy, Fun, Hygiene, Bladder, and Social. I set up a data structure for them, and set the basic parameters they should have, such as upper limit of value, drop rate, warning line, and a happiness curve slot.

Need slot parameters

The demand value will decrease over time. You can set different depletion values. When the demand value is lower than the set value, some kind of action will be triggered. It’s easy to understand, but it’s an inflexible and unrealistic way to perform it. I need to improve it somehow.

Happiness Curve

The concept of the happiness curve is what I learned from a Sims speech. I don’t think I understood his method correctly, but I extracted his concept of happiness weight and modified it into a happiness curve.

It means that as the value of demand decreases, the demand will output a probability value based on its position in the curve, and this probability will be the key to the AI’s decision.

The position of the demand value in the curve is move from the right to the left This probability is usually higher when the demand value is lower, but the curve will control the growth rate of the probability. For example, half the hunger value may not drive you to start looking for food, but half the bladder value may make you actively start looking for toilets.

Visualization of NPC needs

After the end of each behavior chain, the AI controller will acquire the current demand from the component instance of the NSIMS system on the unit.

The process of acquiring is:

  1. Probability values generated by traversing all requirements

  2. Add the probability of returning True to a temporary boolean variable array

  3. Find the demand with the highest probability from a temporary variable array as the result

Get GOAP Project (UE5)

Leave a comment

Log in with itch.io to leave a comment.