welcome guest
login or register

17th of January 2026

17th of January 2026
Debugging
up
6 users have voted.

Comments

Copypaste from Ancient Savo discord, describing the problem at hand;

so, the AI keeps asking the question "to produce item X what do I need? Do I have the needed raw materials? If not, what do I need to produce them", and so on. And I thought it would produce a tree-like structure. Which it did, but now as I'm looking into the details to ensure everything works properly, I unlocked a new problem.

One of the needed raw material for producing iron items is charcoal. And to produce charcoal you need a kiln.

To produce a kiln there are two alternatives;

  1. build one from scratch
  2. reset and clear an already burnt kiln

the AI goes on to evaluate both of the alternatives to figure out which one to pick. Evaluating option 1. goes down to further tasks as expected. But what happens when evaluating option 2? How to get a burnt kiln? Easy, burn a kiln! To do that you need a kiln. How to get a kiln? Well, there are two options; either build one from a scratch, or reset and clear a burnt one. Which one to pick?

so we can see that it is about to dive into an endless loop of trying to figure out if it is faster to build a kiln from a scratch, or to reset a burnt kiln which can be produced by burning a kiln which can be produced by resetting a burnt kiln which can be produced by burning a kiln which can be produced by resetting ...

This would be a rather straight-forward problem to solve if I was going with hard-coded stuff. But the thing is that I want the AI to be able to handle what ever tasks and descriptions there are in the XML. So that future me or modders can just add in any kind of items and tasks and crafting recipes, and the AI will be able to figure out how and when to craft this or that.

A middle-ground option would be to include "manually defined instruction for AI" in the XML files, but if possible I try to avoid that.

At the moment I'm thinking about adding a simple "circularity detection" for the AI, but this needs some more consideration. Just to think if that is the best way to go, or if there are alternatives, or if the circularity detection could fail, or create new problems.

Add new comment

CAPTCHA
Please reply with a single word.
Fill in the blank.