Haz unrealistic modding dreamz. Needz halp from crezy peepol

Hi awesome community.

So I been looking through Discourse and found only loose pieces of info from crezy peepol to halp me. I was a web dev coder long ago for 5 years so I’m feeling brave. I’m super excited about this game and want to get into serious modding. I also have no modding experience :slight_smile: I did get started already with making a comfy clay bed recipe and got it all working in the end, but the crezy dreamz will probably demand I learn lua and get in neck-deep.

I have a few questions, and if these are mostly affirmative, I’d like to set up properly to allow the crezy to flow through me.

  1. Is it currently possible to mod stuff like new classes with new behaviours/commands, or can only existing behaviours/commands be used to make clones of existing classes?
  2. Is it currently possible to figure out a good enough understanding of the api (assuming there is even one) to hook into things like gameplay events for triggering other things? You know, enough freedom to extend existing functionality without having to ‘hack’ it?
  3. How much is a modder limited by the current AI capabilities? E.g. if I want to build gameplay content that does not necessarily use any of the existing hearthling behaviours, would i need to script my own AI? E.g. creating a fisherman or creating a caravaning hearthling that goes off map temporarily to go get rich.

Would you be so awesome to help me get setup for myunrealistic modding dreamz?

  1. Lua - so I got Decoda, I saw links to lua for windows and stuff on discourse, but how do i set the lua stuff up so I can easily find classes/functions/attributes and run and test it for or in the game?
  2. I tried setting up the microworld for just testing addition of new objects/recipes but couldn’t get it working. just shows blank screen on startup and nothing in the logs. I followed the microworld user settings option provided on the github page but no luck. I could get the debug tool mod working though.
  3. What is a recommended way for me to start adding to/extending stonehearth to learn the api? As an example I’d like to add a fisherman (hopefully simple enough) class - could this be simple enough to start with?
1 Like

For your last point; #3 I would suggest looking at the trapper class and possibly have the “trapping” grounds be able to be placed on water etc

1 Like

Yup was my first thought too but that would be a kind of a clone, I’m looking to create a slightly different but simple class to help me learn how to do more difficult things - but especially the goal is to learn other parts of the api / game.

I don’t know if you can modify the AI substantially, as a lot of it is in the engine as C++ for efficiency. @Drotten might be able to answer more specifically.


Somewhat, and it depends on what you’re trying to do. Creating events for your own code is easy enough, adding in that for existing code can be done with monkey patching, but it’s a bit ugly and is running the risk of becoming incompatible with the game after it gets an update. Though you can’t hack your way into something that touches on the engine; that stuff is closed to us regular folk. But even with that, there’s plenty of freedom to mod the game as you see fit, even if you have to use some hacky solutions.

It’s completely possible, you can pretty much design a class however you want. It’s tied to the AI though, so you’d better have a proper understanding on how it works. You could start looking at a job’s description file for its task_groups, as well as in services/server/population/data/player_task_groups.json for all the different task groups currently available. Of course, those found in there does not really define how each ai task is performed, for that you’d have to take a peek at the actions found in ai/actions/.

Keep in mind though that I’ve personally only dabbled in the ai before, and there have been some changes on it since last time, so I’m hardly an expert on that subject. But there is some documentation available on that in docs/, you could take a gander at that at least.

I mentioned the documentation above, but it is scarce. Currently, there are only some topics available, and none about the engine itself. To get a feel of the api, your best bet is simply to read the code.


I made a shortcut from the Stonehearth.exe. Then I opened the properties from that shortcut and add in the target field --game.main_mod=microworld. When I run the shurtcut the microworld starts directly. When I start Stoneheart.exe everything works normal.


Wow, that is really cool! Never thought about doing that! It will surely help with all the json editing to change between modes… Thanks!

1 Like

Thats the first thing I tried S_NetworX, and windows kept complaining (i got win 7 64bit). I put it in the parenthesis, outside, tried different things. So i then reverted to trying the user settings way, which I mentioned above, then gave up.

I’ll try figure out if there was something else I’m doing wrong and still try making it run from the target field shortcut.

So I want to create a zone to fish in and poking around code I found, to my dissappointment, that it seems the way zones work is not extendable or moddable.

I saw this in ui/game/start_menu/start_menu.js;

create_farm : function () {

This references App.stoneheartClient which I can’t find anything for, so I’m assuming its part of the core game logic. Amiright? :frowning: @Radiant might want to look at this to extend the modding api in future.

This means I’ll have to find another way to get my fisher to fish. Maybe I can code a way to just look for a big water spot and use that instead of going to a zone.

1 Like

You may want to take a look in ui/root/js/stonehearth/stonehearth_client.js, App.stonehearthClient is declared and assigned there.

Edit: It’s also quite easy to add new functions to it, with something like

App.stonehearthClient.myFunction = function(args) {
   // body

At least I imagine so, I haven’t actually tested this myself.


Thanks Drotten, I got a lot to learn. I wonder why my find-in-files search didn’t show it. Really appreciate the input!

Look at the tree saplings or the Well added in the cooking mod.

Then make a similar object that’s like a “fishing bait, or fishing net” and make it only placeable in water.

Then when you go to harvest it, you can make it give you a new food/ingredient fish. Should be relatively do-able.

With this method it wouldn’t require a fisher class it’d be a task any worker can do.
You could add a new class though and make it able to clear these. Then make it so there can be different tiers to these that require higher levels of this class.

1 Like

I like the idea of a fisherman class. But why not go more the route of the trapper in mechanic?

Same as what @Aviex said, but rather than letting anyone gather from the spot, make the fisherman class be the only ones that can harvest the zone…just like the trapper in their zone with traps, have them go around the area of the zone casting a net or using a rod and then returning the raw fish. Maybe allow them to haul a greater number of fish with each level up, or chance of catching more rare fish increase, etc. There should be some incentive to him/her leveling up. (but this is just an opinion) :slight_smile:

Then just need to tack on a few recipes to complete the while thing for the chef to be able to cook the fish for consumption.

1 Like

I remember the team wanting fishing as a leisure activity done by the hearthlings.
Not sure when will that come :confused:

1 Like

Do you think that will or could possibly include a yield of fish for cooking/feeding the masses?

I don’t know. It’s been a while since it was last mentioned, so I don’t remember if the fishes were going to have a purpose.

But I’d also like to have them for cooking recipes :slight_smile:


Great suggestions and input thanks @Aviex !

Remember its not about just adding a food resource for me - its about learning modding for this game, so I want to purposefully explore various mechanics. Therefore I’m not necessarily looking for “easy” ways to do something - but nonetheless these ideas will definitely be used as part of the class :slight_smile: However, I did plan on also adding netting mechanics/abilities for higher level fishermen. Was thinking this class could be great for maybe some custom biomes with lots of water/mountains and little space for farming and shepherding.

1 Like

@FlervaFlerv thanks for the input and ideas! :slight_smile:

The idea is more to learn modding than to add a polished mod - but what i like about the idea of a fisherman class is making a biome mod that makes it difficult to farm or shepherd (e.g. lots of water and mountains) would make this thing very useful. Its also not a bad idea to create new abilities (like nets for higher levels) and learn how to mod those into the game.

Will see where things go :slight_smile:

I like this concept…can’t wait to see what you come up with :slight_smile: