Idle Hearthlings at 2 and 3 Speed

Recently I returned after a long time without playing the game, and I had a lot of fun with it, specially using the ACE. Playing as the Northern Alliance, I’ve managed to get up to 32 Hearthlings without any lag or game freezes. However…

Now what happens is that when playing the game on speed 1, everything goes normally. Every hearthling knows what to do and everything runs smooth.
On speed 2, hearthlings will be idle after finishing a task (i. e. placing one block in a building) and proceeding to the next one. This can lead to hearthlings building slower than on speed 1.
On speed 3, things get even worse, as hearthlings can’t do next to nothing besides standing still for who knows how long. While all of this is happening, the game FPS is still over 60 (i. e. I can move the camera, open menus, change game speed, nothing else is affected besides the hearthlings), and I can even increase the game graphics to high and the game still runs smooth.
What I wanna know is what’s happening. Like, I know they are idle because they need to think about what they’re going to do, they need to know what’s arround them, what’s in their backpacks, etc.
But how can I “increase how fast they think” ? How can I get hearthlings to move around and do stuff on speeds 2 and 3?

My Computer Details are a AMD FX-6300 Six-Core Processor, a NVIDIA GeForce GTX 1060 6GB Video Card and 8GB of RAM. Game runs smooth on any graphical configuration, and this issue only occurs from mid to late game (i. e. with fewer hearthlings I can play up to speed 3 with no issues).

1 Like

Unfortunately this is the bottleneck of SH, and our greatest enemy. There isn’t much we can do on a modding level - the opposite, really. The more we add, we have to be careful because we’ll also be adding more processing “consumption” (although we’re always trying to find out things that can be improved, and every now and then we do find a couple of things that improve performance a little) but the issue is indeed with AI, processing and the fact that the game will only use a single thread for that, etc… it’s all so deep down on the engine level that the only way we could hope to fix this now that development has been discontinued is if we, one day, try to “unofficially” patch the game through DLLs and such.

For now, however, this is probably your limit :frowning: Different processors can have different results (for example, a lot of people experience good results on older processors because they had less cores but really strong ones; I myself experience pretty good results as well (up to 60-100 hearthlings without issues) with an i9 9900k, but it’s understandable that not everyone can have access to those things)

In the end, what happens is that even though your computer can handle the game fine (ie: like you said, you have high FPS) it’s not really your computer’s fault but the way the game organizes and processes things.

:frowning:

Some people are really “invested” in this area and can talk to you more about it, or give you tips on how to optimize your town and such (maybe @Wouter_Sikkema or @Banto?)

While it’s true that you’re stuck with one core, there’s much that can be done on the modding level. The vast majority of the performance improvements that were made in the run-up to release were in optimizing Lua scripts. It’s not one single point - just lots and lots of small inefficiencies in AI actions and things they call, plus some systems that affect AI actions being too bottom up (e.g. restocking was done independently by each hearthling until the restock manager, which was much less efficient).

And besides, in theory you could totally replace the existing AI system with another one. Aside from the Lua threading (which turned out to be a bad idea anyway), and the bits transcoded to C++ 1-to-1, all the AI is in Lua.

1 Like

Well, polishing the AI definitely sounds like something we could get to at some point…

Replacing it entirely… sounds very daunting. But I guess it could be interesting for the far future, if there is enough interest and such :jubilant: but it does sound like it would be a pandora’s box…

Yeah, replacing the AI is more of a theoretical solution than a practical one, but you guys have done some incredible and unexpected things before, so I wouldn’t put it past you. :stuck_out_tongue:

On the more doable side, I’ve considered in the past an “austerity measures” mod that disables as much of the non-essential stuff as possible - fewer/no conversations/recreational activities, rarer appeal checks, no real pet AI, less efficient mining planning, etc. It would make the overall game feel a lot less magical, but would allow players who just want a big city to get that.

2 Likes

Yes, we were recently talking about trying out fewer appeal and crampiness checks to see how that impacts performance.

Indeed there’s a lot of things that could be cleaned or reduced - or simply transitioned to simpler or more abstract systems. I mean, even food consumption can be super abstracted into a reduction over time based on your population without requiring the actual entities to go and serve themselves and eat and so on… Of course we’re not changing that :jubilant: but just as an example.

There’s definitely room for improvement on that sense. Maybe not through ACE (although some really successful performance experiments could make it to ACE through optional settings, I suppose) but through companion mods and such…

By the way, would love to see some mods from you (and the rest of the team) appearing up on the workshop one day :smiley: Though I’d understand if that won’t happen for other reasons :merry:
It would be nice anyway!

1 Like

speaking as someone with some personal experience in optimising busynesses, there is ofc an overlap between a production process, and game performance on simmilar hardware.

is there actually a list of things from most performance hungry to least somewhere?
i mean gut feeling wise its ofc the pathfinder at the top, followed by hearthling behavior after that… but did you guys ever look into it from such a a point of view?

Of course. That’s the first thing you do when optimizing. I don’t have access to any of those spreadsheets, since I’m not at Riot anymore, but the profiler used to capture that data is available to modders (I think it was released with 1.1?) and I know ACE people are aware of it.

2 Likes