preloader

Multi-Tasking

What we see...

An NPC is cold and needs to build a fire. But before that, the NPC needs to bring wood to the storage area near the campfire location. To do that, the NPC needs to wander and find wood to pick up into their personal inventory so they can head back to the storage location when their arms are full.

But the NPC is also hungry—not just now, but wouldn't mind storing some food in a pouch for later.

And the NPC is curious about new things that it sees nearby.

And the NPC is wary of bad things that are nearby and acts friendly to the forest animals that it sees.

So the NPC sets out from the campfire and is looking around the area. As it sees a stick of wood, it wanders over to pick it up, bends over, grabs it, and puts it into a sling for carrying wood. It wanders again, sees another piece of wood and heads in that direction. However, before getting to it, it sees a nearby piece of fruit on the ground. The NPC diverts slightly away from the piece of wood to get the fruit, bend over, pick it up, and pop it into it's mouth. It then resumes heading for the 2nd piece of wood, picks it up, and puts it into its pouch.

The NPC continues on, seeing wood and food, diverting to pick them both up if they are close—even interrupting its path at times. In the meantime, it steers clear of a baddie it sees—ignoring a piece of fruit that was too close to risk. On the way to a stick on the ground, the character waves to a friendly woodland creature, cheerfully saying hello.

At some point, their food pouch is full and they aren't hungry so they stop moving to and picking up more berries and fruits. And then, when their wood bag is full, they return to the camp, dump the contents into the storage area, use some of it to build a fire, light it, and then sit down to get warm.

Mission accomplished—not just getting the wood and building the fire, but collecting the food, staying safe, and greeting little furry friends.

What's happening...

The steps involved in building a fire seem like something out of an example of a planner such as GOAP. In fact, the collection of the food could also be a GOAP plan as well. However, planners will typically pick a single goal and execute a single plan (which may change) in order to accomplish that single goal.

What is extrordinary here is that these plans are running at the same time—in parallel! Sometimes they would even be executing one step of one plan, discover something else that was more convenient at the time (from the other plan?), execute that, and resume what it was doing in the first plan (if it was still a good idea). Additionally, these two plans are being interupted by general "life" moments.

At the very simple level, the agent is moving to, picking up, and storing or using the items because they are tagged like "Flammable" or "Edible". While the agent could have been left to simply pick up objects with the appropriate tags as it sees them, that takes away not only the reason for doing so, but what comes next once they are picked up.

In our implementation, the IAUS has a series of behaviors that, at their core, have the same premise—in this case, "I am cold" (or need to cook food, etc.). However, thinking in terms of the series, each behavior has another consideration specifying a prerequisite that needs to be in place. So, while "I am cold" certainly is a valid reason to build a fire, the "build fire" behavior requires that there be a certain amount of wood in the storage pile. If the pile doesn't have enough, then "I am cold" plus "not enough wood" would lead to the "search for wood" behavior. This would continue on so that even "pick up wood" has the same "I am cold" consideration plus the others that go after.

The result is that the behaviors get self-assembled in order of their need and, as they are satisfied, the progression towards the ultimate goal continues. But because, in the IAUS, we are evaluating all of our possible behaviors every think cycle, we can be thinking about "move to wood" and "move to food" at the same time. In the example case, if we are moving towards a piece of wood and see a convenient pice of fruit, we can execute that and, when it is no longer in play, the "move to wood" we were doing will likely be back to the highest scoring behavior to execute. The parallel plans all stay intact as long as they are appropriate!


Gameplay Examples

More than just simple, "if this then that" behaviors.

Look at some of the examples of things that our tech can do!

(Click to read an in-game example.)