Need help with Population_Faction file



2-3 days ago I have written an idea to create a better name generator for Stonehearth.

I know how to make it in code, but I’ve got problems in decompiling the file, in which actual generator is: population_faction.luac . The reason is simple: luadec gives errors in decompiling that file:

[quote] code
– DECOMPILER ERROR: Confused at declaration of local variable
– DECOMPILER ERROR: Overwrote pending register.
– DECOMPILER ERROR: Confused about usage of registers!
– DECOMPILER ERROR: Confused at declaration of local variable
– DECOMPILER ERROR: Confused at declaration of local variable
– DECOMPILER ERROR: Confused about usage of registers for local variables.
All other functions in that file haven’t any errors in decompiling. Only function, which I want to edit… :confused:


I don’t really do anything with lua but it looks like the variable code has a problem with it being a local variable so it doesn’t know what to do. Don’t quote me on that though


Whoops, I replaced there the code which was decompiled with ‘code’ to not publish those fragments of data (other people may make my idea faster than me…) :stuck_out_tongue: The decompiled file is here. As you can see, all is decompiled correctly. All but those function, I want to see/edit…

pop.txt (2.8 KB)


luadec has issues, try unluac instead. It’s much more reliable.


I tried unluac too. but in results I’ve got nothing in file…

those commandline (Win8) is correct?

luadec file.luac > result.txt


Yep. GIve me 5mins to grab it and I’ll post a link to functional decompiled code. Also just in case the unluac command

java -jar unluac.jar file.luac > file.lua


Ok. Looks like I must add JDK into PATH line in my PC. Thanks :slight_smile:


Here it is anyway, what are you trying to do with it anyway?


Something what we could name “Enchanced Name Generator”, to make more available names for villagers than… 90 (at the moment), perfect for mods like @Avairian’s Nihonjin (After I finish the ‘board’ for default faction, I’ll go with japanese names etc.)

Thank you so much :slight_smile:


All the names for villagers are chosen from the json files for the races. What are you trying to do that can’t be done just by adding more names there?


At the moment we have 198 male and 216 female villagers (all firstname+lastname combinations). For some players this number may not be enough.

We may add another names into the actual system, but the more we add, the larger file we get. So, we may be looking for another way to generate names.

In Nihonjin mod, for example, there will have a problem with actual name generating system. If we want to add japanese names, the file will grow enormous.

In addition, we may get some ‘fantasy-like’ names for villagers like um… “Garwyn Framvad” (name made from parts of actual names :P).

Some hardcore players may have get more and more villagers… ending in having at least 2 villagers with the same name. This is one of the way to solve this ‘problem’ :wink:


When generating names from parts it’s best to work phonetically before transcribing to a written form for pronunciation reasons. It’s not an easy business as some phonemes/syllables don’t fit very well with others leading to some fairly intricate complexities and they vary for every language.

Of course you just come with a few dozen names, 50 first and last gives 2500 combos, 100 gives 10k combos. You shouldn’t push this system for the purpose of having more names, more interesting names is fine though.

A part system combined with actual family structures could be interesting as well but that needs more of a game to build on than is there currently. Imagine if people got together had kids with the same surname and then the kids could change the names slightly when they got older. It would need a basic family system to build off though.


I am already focused to get more interesting names.

System with actual family structures? With current files we may have problem with achieving this (villager name is written into one string). Two ways to do this:

  • combining with ‘space’ between the first name and surname
  • splitting the name into two strings
    Family system would have also some problems like additional locals (2 for parents, to prevent incests :stuck_out_tongue: ) etc.

I am not good with LUA, normally I am working with PHP+SQL and Delphi. At least I may give ideas and diagrams/pseudocode for other mod creators.

But I want to do at least one ‘mod/halfmod/mod feature’ by (almost) myself.

But back to the topic…

Looks like I made a mistake in code because when I am trying to see my edits in action, the game is not generating the villagers D:


Maybe start a thread for it? An advanced name system seems like it could have potential for a variety of things, we’d only need a standard format for the name if we were careful. I’d have to actually see what you’re doing to try and help with an errors.

*MOD IDEA* Enchanced Name Generator?

Excuse me if I’m wrong, but I don’t think you should be posting parts of the Stonehearth source code up onto the discourse


But surely it is fine? The code used in this case is very nearly identical anyway. I’ll avoid it though.


This raises a good point seeing as everything is going to be pretty much open to modding …

@sdee can we get an official comment on what is and isn’t acceptable in this instance?

This is the comment in question:


i suppose it comes down to what would be “naturally” exposed to the players already… i have a feeling this will be OK, given that the game is already going to be so moddable from top to bottom (meaning, all these systems will be exposed in some form or fashion)…

but an official word would be nice, just to make sure… :+1:


I hope so, it will help modders, however, it’s best check now than find out latter


It’s in your hands! Go ahead and post relevant chunks, again with the caveat that none of this is final API, so you might want to stick a warning or a version number on it, to prevent confusion if/when it changes later.