Mod request: Full simulation of NPC factions

Tom said in the latest stream (question asked and answered at 10:26) (and I think at an earlier date more or less the same thing was expressed) that NPC village growth will probably be faked rather than simulated, since it would “feel the same to [the players]” (11:03). I appreciate the development team’s need to focus on core elements of gameplay and avoid big time sinks. However, I don’t think what Tom said would be true exactly; I think you would be able to tell the difference. And even if not, I take geeky pleasure in the knowledge that simulations are going on everywhere in the world.

I wanted to make this post to find out if there was anyone who felt the same who would be interested in modding the game such that this would no longer be faked, but would be true simulation of NPC villages, in case the development team does indeed go for the “faking it”-route? I would do it myself, but I doubt my programming skills in this respect.

for those of us who didn’t pick up on the comment (or are too slow to comprehend the meaning, like myself), can you elaborate? is this in regards to having the “cyclic caravan” that will bring in new units?

1 Like

Are we talking about simulated NPC factions à la Millénaire for Minecraft, where the NPCs had villages that really grew if you gave them resources (and manpower)? Where they built “automatically” new houses if required?

The problem with such a thing (which is also visible in Millenaire) is that it requires a lot of calculation power. Each NPC needs to be simulated much more carefully, instead of a simple “walk outside at day, sleep in a bed at night.” You need to simulate them as you would a player’s villager and then some more, because something needs to interactively react to events (i.e. you need to script a primitive “player”).

It’s much easier to say “If the town is happy and trade is going well, every three days we build a new house and every day you get another villager”. This is simple, doesn’t require much calculation and frankly is sufficient I think. You’re going to spend most of the time in your town, not some NPC’s one. So in the end, you wouldn’t notice all those smooth, little changes that happen because your attention is completely elsewhere.

If that’s what you meant.

(Edit: As a side note, I absolutely adore Millenaire. It’s really cute to “grow” a settlement or even multiple, see them grow up and everything - but sadly, back when I’ve played it (around MC 1.3), it was just too laggy.)

1 Like

RepeatPan has the right idea, that was indeed my intention. I am aware that it requires (significantly) more computation power, but I imagine it should be possible to find a balance between accurate simulation and calculation power? At least for stronger machines? I don’t really know for certain, but it’s done in certain other games, right?

I’m sure the simplistic “faking it” approach would indeed suffice in most circumstances and for most people. It’s just that this is one of my biggest loves: accurate simulation. Back in the original Warcraft and StarCraft games, my favorite thing was when you were teamed up with an ally who built up their base from the start like you did. I love games without direct control like Majesty: A Fantasy Kingdom Sim, Dwarf Fortress, and of course Stonehearth itself. It’s just what I like. And like I said, I think I would be able to tell the difference. (Because I like this sort of thing, if it’s implemented, I actually spend a rather large amount of time looking at the NPCs. The same was true in the old Blizzard games, for instance. Or watching/babysitting my Majesty heroes (although in that case, it was more of an integral part of the game).) This is why I asked if there was anyone around who shares my enthusiasm for such things, but if that’s not you, that’s fine of course. Thank you for your thoughts regardless.

I was entirely unaware of the Minecraft mod Millénaire, but that sounds fantastic, I’ll have to look into that. Shame that it was too laggy, but I’ll give it a go, at least enough to get an idea of how it works. Who knows, maybe they’ll have improved it, or maybe my machine will be strong enough to handle it. Thanks for the link.

Yes and no. There are a few things that make this rather difficult (borderlining impossible):

  • Other games are not using lua. While lua is somewhat fast, it’s nowhere near C++ (here: we have sometimes 1/4th of the code, at the expense of 1/78th of the performance). In theory, that means that we can have a hundred times less units than your average game.
  • Because of lua, multithreading is impossible. We can’t say “put this AI on core A, this one on core B”. One core has to handle all game logic - not just the AI, but events, the server communication (to a certain extent) and more.
  • It depends on how “deep” you simulate things. Warcraft, as example, has very little in the AI department: Peons are usually just chopping trees/collecting wood/repairing things, which is not too much to do and can be fairly optimized. The military AI is likely not too difficult either, by simply throwing units at you, more or less intelligent - but that’s the “player” component here, not individual thinking: No matter how many units you have, it will always require about the same amount of thinking.
    Stonehearth goes deeper, perhaps much deeper, with all the not-really-micromanagement-unless-you-go-the-extra-mile stuff. To simulate this - and the more complex AI that comes with it - is much more demanding than your average goto(mine); fetch(gold); goto(base); play_sound("work_work");

So other games do it, sure, but they have different prerequisites. They are not as big on modding (or openness) as SH is which allows them to implement many things differently. Millenaire is a good example of this: It’s terribly laggy. Or at least, it was. They might have done some multi-threading since them; something that we cannot do. Or, if we can, then it would come at… a price. I have an idea about that, but I’m not sure if Radiant was to implement something like that.

I don’t doubt that there might be some things that you do notice in a “smooth” transition. It might be possible to have some sort of middle-ground: The simulation is rough unless you look at it, in which case, it’s suddenly smooth as butter and everything.

All in all, if it was feasible to run, it will be some effort. The AI itself not necessarily, you could likely re-use the player’s NPC AI. However, you need to write a player, which is a difficult task: How do you place buildings? Stockpiles? When do you gather for resources, and where?

Writing clever AIs is hard. If you are familiar with Transport Tycoon, have a look at some gems.


Thank you for your in-depth reply. It’s true that I proposed this idea very naively, knowing only a bit of C++ and Java and very little else. It’s a shame the prospect could not be more positive, but I appreciate your candor.

I would be happy to settle with a very dumb “NPP” (non-player player?) AI. If it’s goblins, for example, they could just place huts very haphazardly, even randomly. I would just get a kick of seeing them actually do the building – rather than having houses just appear when the player is not looking – even if there was little intelligence behind it otherwise. Of course, smarter would be better (except for goblins :P), but like I said, I’ll settle. And if none of it turns out to be possible, well, so be it. I’ll still love Stonehearth regardless, that much is certain.

Thanks again. I’ll have a look at those gems soon, but first, I have to get packing to go to France tomorrow morning!

1 Like