Questions reqarding how the game makes decisions?

I have a few questions that relate to how the game makes decisions about what hearthling does what, and about how it computes stuff under the hood.

  1. Are there systems which need computations for every single hearthling individually. Like a hearthling checking whether there is a task for him to do. If so, which are they. (or every single item, or, well I think you get the point now)

  2. I vaguely remember a optimasation feature that loads only portions of the map, instead of the whole thing. In these cubes, things would get checked for. Does loading only a portion of the map that way help with performance, and if yes, how does that work?

  3. what systems does the game go through when you give, let’s say the order for a hearthling to pick up a log and put it in a stockpile.

  4. From what it looks like, the hearthling bodies are controlled by a hivemind (the systems from question 3). I think this because , for example, as soon as an enemy is spotted, one computation later, it seems like at the least, the military is under way, even although they didn’t necessarily ssee or sspoke with those who spotted it. Is a hivemind concept the way the system works?

1 Like

I’m going to focus only on the 4th cause it is easier for me. (good questions overall)

It is indeed a hivemind, but the reason the soldiers go into combat even if they were not the ones who saw the enemies is just a matter of (sensors) reach. They can “see” 64(? I think) blocks far. So when an enemy gets near your base they should notice it pretty easy. (I have a city where they can’t cause they tend to patrol to far away from where the enemies were coming through)

3 Likes

These are indeed good questions. :slight_smile:

1 and 3.) At a very VERY high level: When the player issues an order, those orders go into task pools. Hearthlings each have their own AI, but whenever they’re done with a task, they check back on the task pools they are “subscribed to” (there’s one for each class, one for each type of work, etc) to see if there’s there’s a new task that applies to them, that they can do. All the tasks that are eligible then have a run-off to see which one has highest priority, and which ones can be completed in a timely fashion (dependent on sub tasks, pathfinder, lease availability of related items). If a task can be completed, then it runs. You can see the AI for each hearthling by downloading debug tools, opening the AI browser, and clicking on a hearthling.

2.) Actually, everything that you touch is paged in. I think. We may yet optimize this.

4.) Hearthlings have a “sight” radius of 64 blocks, so as long as any military person sees a monster, everyone in the party runs over :slight_smile: However, if a worker sees a monster, and there are no military people w/in 64 blocks, then they won’t run over.

Over to you! Why are you curious? Are you perhaps hoping to mod? Or make a game?

2 Likes

Thanks for the answering both Bruno and stephanie :smile:

Oh, if only I had the knowledge, time, patientce and concentration to mod?

Actually, the reason I want to know is, well. This comes from the discussion of the mayor thread in suggestions, where coasterspaul said this:

So that got me thinking, on how stonehearth could make hearthlings that don’t have to think as much, so the game can support more hearthlings. I came up with an idea (that is, pretty radical, as it changes some of the root game) to do it, but I wanted to have good knowledge of what I claim to work, before I claim that it works.

The idea itself comes down to the hivemind. Currently the hivemind is tasked to keep everything in check for every hearthling. But what if it doesn’t, what if only the mayor, clercks and other organisational classes are linked to this hivemind (that makes decisions for the game based on your order). Then the normal hearthlings live a low-cpu-intensive life, and don’t do anything (don’t check for tasks to be done in the city at large, for example), unless they are ordered to by an organisational class. The suggestion was that it also is this way, only for big cities. does all of this make sense?

But as I said, I wanted to know whether it would work in the first place, before i suggested it.

2 Likes

I thought I do not create its own thread

If it is also possible to assign the priorities in the AI to the one Hearthling who is closer to the task?
For example 2 Hearthling are close to harvest or another task and do nothing but another Hearthling has to come from far away and do the job. It is not extreme but already noticed.