Jump to content

Improve queue AI - thinking one step ahead


Recommended Posts

Okay, nobody complained about it before, at least I've never found any topics on this, but duplicants are dumb. Lets look at a few examples:

Task: You queue to build a ladder, far from base:

As is:

  1. grab ladder material
  2. run towards the goal, digs 1 cell, builds 1 ladder
  3. next ladder piece becomes "reachable", and so it repeats

Problem: Duplicants are already smart enough to grab sufficient materials for the entire buildup if there are no unreachable, but they simply don't take any tasks that are unreachable into account.

Solution: Code-wise, you could queue actions by calculating state ahead, so in the queue phase of the action:

  1. dup picks action to execute: building 1 ladder,
  2. as a result, of this action: you'll have same world but with ladder in place,
  3. look for more possibilities for action combining: next ladder becomes reachable, grab more stuff
  4. repeat 3 until dup inventory won't be able to fit anymore ladder materials

 

Task: Queue to sweep 10 different materials far from base, each weighting like 50 kilos:

As is:

  1. run towards the sweeped items
  2. pick all items of one kind (or till inventory is full)
  3. come back to base for dropoff
  4. repeat for all other items

Problem/Solution: Duplicants are smart enough to pick multiple items of same kind, why not let them pick items of different kinds?

 

Task: Mopping 20 tiles of water from the floor:

As is:

  1. Duplicant starts mopping in a random spot,
  2. water fills in mopped area as he mops
  3. he mops again and again, numbers of times, till the random game ticks don't let him move on

Problem: Mop mechanic conflicts with liquid mechanics, thus mop mechanic must be smarter

Solution: When you mop multiple tiles next to one another - start from one of the edges and go towards the next square, at the same time disallow water from next queued (by dupe) mop position to fill the previously mopped position for at least 1 second?

 

Another problem: some actions that are performed right now, should not be interrupted by higher priority Maslow actions. Like somebody is giving treatment to the sick, then his calories hit 2500 and he's like SCREW THIS, IMMA EAT. Same goes with the patient, when he's being treated... He can kinda wait a bit if he's being treated.

As you describe, digging a far away project from base takes few months to finish , more with unbreathable gas on those area take 2 more months. Lvl 9 priorites make the progress faster but half of your colonies will die , either sick, stuck or no food avaiable. 

Dont get me wrong, i love the game but the more klei introduce content , seem no improvement for the AI to catch up with the updates

Like slimelung patient in medical cot was treated by a doctor, the patient need standup for breathing because they cant breathing while on sleep position, and that proccess canceling the aid treatment progress. The doctor is like, screw this, imma eat....haaahhaa

14 hours ago, IvanX said:

Solution: Code-wise, you could queue actions by calculating state ahead, so in the queue phase of the action:

  1. dup picks action to execute: building 1 ladder,
  2. as a result, of this action: you'll have same world but with ladder in place,
  3. look for more possibilities for action combining: next ladder becomes reachable, grab more stuff
  4. repeat 3 until dup inventory won't be able to fit anymore ladder materials

The duplicant doesn't have the material in the inventory. He has to drop it before doing something else. Now that the extra material is dropped on the ground, the duplicant can dig the tile and build the ladder segment - but then he can notice there's a higher priority task for him somewhere - such as a lavatory visit - so he will leave. Next duplicant will notice there's ladder to be built, so he picks a heap of material for many ladder segments come to build, drop the excess on the floor adding to the pile ...

Best approach in my opinion would be to have a "build this from any material" option. So the duplicant would bring material for one segment and then would use whatever material he dug out of the ground to build the next segment etc. I usually just check what's the most common building material I'm going to dig through and get my dupes build the ladder/floor from it. It gets things done way faster.

The idea is pretty good, although programming it well is not an easy problem. Dupes already harvest nearby items on their "job site" and generally try to extend the job to cover as much as possible.

Getting it to handle multiple jobs at once would be some more serious planning. Especially considering they love to drop held items at random moments. Still, it would be feasible for them to bring resources near the job place if they can't apply them right now: find a free spot, put excess material there, build what can be built now, grab the excess and place it in.

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...