[Mod] Settlements [settlements]

MoNTE48
Member
 
Posts: 271
Joined: Sat Apr 06, 2013 11:58
GitHub: MoNTE48
In-game: MoNTE48

Re: [Mod] Settlements [settlements]

by MoNTE48 » Tue Jan 14, 2020 08:38

FaceDeer, Your work looks amazing.
Replacing mts with lua seems unnecessary for release, this makes the mod big, and simple players do not need it. Support for lua and mts schemes for development would be more useful.
Moreover, mts-> lua-> mts conversion is very simple.
It is also mandatory dependence in the store mod seems unnecessary for me, it could be optional. The rest is really cool!
 

User avatar
texmex
Member
 
Posts: 1694
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Settlements [settlements]

by texmex » Tue Jan 14, 2020 11:07

Will it be possible to spawn settlements underground as well? I’m also trying to think in broader ways of what structures can be used other than buildings…
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Tue Jan 14, 2020 14:57

MoNTE48 wrote:FaceDeer, Your work looks amazing.
Replacing mts with lua seems unnecessary for release, this makes the mod big, and simple players do not need it. Support for lua and mts schemes for development would be more useful.
Moreover, mts-> lua-> mts conversion is very simple.
It is also mandatory dependence in the store mod seems unnecessary for me, it could be optional. The rest is really cool!


The lua schematics are actually necessary to support the varying node replacements that give each settlement a different wall material. When an .mts schematic is loaded replacements are done once and the result is cached, and cannot be re-done for that .mts until the server restarts. The original version of this mod that I started with actually converted the .mts schematic into a .lua schematic internally every single time it placed a building, which strikes me as a rather inefficient and unnecessary step. For development I left a bit of code in this mod that can be used to convert .mts into .lua, though you need to edit lua files to actually call it (it would be a mod security violation to use it routinely since it writes files into the mod's folder rather than the world folder).

If you're concerned about the mod's size, note that I removed four megabytes of high-resolution .png screenshots and replaced it with half a megabyte of smaller .jpegs, and the schematics folder is currently just 90 kilobytes in total, so it'll take a lot of schematics before there's a net increase in the mod's footprint compared to the previous version. :)

The commoditymarket mod is already an optional dependency, if it's not installed then the mod will replace those nodes with chests. If there are other merchant-type mods you'd like optional support for as well, let me know and I can have other nodes swapped in for them when available. That's another thing that's easier to do with .lua schematics, the "if modpath then blah" code is embedded right inside the schematic.

texmex wrote:Will it be possible to spawn settlements underground as well? I’m also trying to think in broader ways of what structures can be used other than buildings…


Not yet, the mod still relies on the mapgen heightfield object for finding the contours of the land it's placing stuff on. But my long-term goal is to use this to put stuff into DFCaverns, so eventually I'll need to change that. This release is basically just cleanup work to make the mod easier for me to work with in future.

I was going to add a "ruins" settlement type to the defaults, but I forgot about it until right before I was about to make that post last night and I decided I didn't want to hold off for another couple of days while I made the schematics and tested it out. I'll add that later. :)
 

User avatar
texmex
Member
 
Posts: 1694
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Settlements [settlements]

by texmex » Tue Jan 14, 2020 18:48

Initial testing shows a very nice placement of cute, tight-knit communities.

My only disappoint so far is that it depends on MTG. In a wat that’s not a surprise since the schematic nodes comes from MTG as well but in my case I’d like to use a completely different set of nodes anyway, for a new game.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Tue Jan 14, 2020 19:05

texmex wrote:Initial testing shows a very nice placement of cute, tight-knit communities.

My only disappoint so far is that it depends on MTG. In a wat that’s not a surprise since the schematic nodes comes from MTG as well but in my case I’d like to use a completely different set of nodes anyway, for a new game.


Hopefully another thing that the lua-based schematics will be helpful with fixing. :) The hard dependencies are mostly to the nodes used in those schematics (it also uses the default mod's wooden shovel texture, and now that I think of it the special junglenode flooring that the NPC mobs mod looks for is also a "default" dependency I should move into a more encapsulated place) so you could eliminate those as hard dependencies by just disabling all the default settlement types.

I'll try to clean that up a bit later today, I bet I could make everything into optional dependencies.
 

User avatar
texmex
Member
 
Posts: 1694
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Settlements [settlements]

by texmex » Tue Jan 14, 2020 20:20

FaceDeer wrote: I should move into a more encapsulated place) so you could eliminate those as hard dependencies by just disabling all the default settlement types


Cool! Ideal for me would be a mod split into a pure library mod and a content mod, but maybe you're into some slightly other philosophy. =)
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

User avatar
DrFrankenstone
Member
 
Posts: 137
Joined: Tue May 24, 2016 05:36
Location: Melbourne, Australia
GitHub: treer

Re: [Mod] Settlements [settlements]

by DrFrankenstone » Tue Jan 14, 2020 20:37

FaceDeer wrote:The lua schematics are actually necessary to support the varying node replacements that give each settlement a different wall material. When an .mts schematic is loaded replacements are done once and the result is cached, and cannot be re-done for that .mts until the server restarts.

FWIW there are ways around that problem. The hack I use is here, and ShadMOrdre suggests another approach here.
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Tue Jan 14, 2020 21:27

texmex wrote:
FaceDeer wrote: I should move into a more encapsulated place) so you could eliminate those as hard dependencies by just disabling all the default settlement types

Cool! Ideal for me would be a mod split into a pure library mod and a content mod, but maybe you're into some slightly other philosophy. =)


Heh. That's my general philosophy too, but often (as in this case) I start with a mod that does something very specific already and then I have to carefully peel the generic library out of it. That's how I extracted subterrane out of caverealms, for example. And other times I start with the generic library, but I create a few bits of content to test it with and those take on a life of their own. That happened with commoditymarkets, the default markets I created for it were originally just a couple of testbeds. So I'm not a purist, even though I try to make it work both ways.

I just did a marathon bit of reorganization of settlements' code, and in theory every other mod is now an optional dependency. If you don't have the default mod (and several of the other MTG mods) installed then none of the settlement types bundled with this mod will generate, and if you don't have the default mod the admin tools won't be registered right now (I need to whip up some custom art for those), but the mod should refrain from crashing or throwing any errirs. Note that I haven't actually tested that, though.

DrFrankenstone wrote:FWIW there are ways around that problem. The hack I use is here, and ShadMOrdre suggests another approach here.


Oh, your hack is beautiful and horrifying. I never would have thought of that. :)

I think I'm going to stick with lua schematics regardless, though. Your solution of creating "unique" filenames for every combination of replacements could get out of hand if someone defines a settlement that has a whole bunch of different possible replacements, for example in addition to randomly substituting wall materials one might also substitute the tree types that the frame is made out of and then you've got n^2 filenames to keep track of. Also, I still like being able to put code inside the schematic lua itself. If you look inside medeival_kingsmarket.lua, for example, I'm able to adapt to whether the commoditymarket:kings_market node is registered or the "vessels" mod is loaded and fix the schematic's contents on the fly. No need to worry about adding replacements for those nodes if they're not available, the schematic handles it automatically.
 

ShadMOrdre
Member
 
Posts: 570
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mod] Settlements [settlements]

by ShadMOrdre » Thu Jan 16, 2020 09:00

For what it's worth, here is an example of the direction I am headed with schematics. The idea is to create an "ontology" of codes that can be used as a singular point of reference for the node types available within schematics. This "ontology"code would essentially contain a Node Def code, a direction code, and a probability code; something like FurN or Mat009 or Str039 or Slb804. The first three letters are a specific node reference, in this case, furnace, 'material', stairs and slab. The first digit after the name is for the six cardinal directions, (north, east, south, west, up, down OR +z, +x, -z, -x, +y, -y), and could easily also be the letters 'NESWUD'. The second digit would be for the axial rotation along the corresponding cardinal direction. There are 24 possible rotations, and either the above or simply enumerating the rotations from 00 to 23 could also occupy the first and second digits. The third digit of the ontological code would be for probabilities. Except in specific circumstances, offering probabilities in percentages is more likely more efficient in the long run. Not many instance use a probability of 1/256 chance, and those cases can still be accomodated, if desired.

Long explanation, but hear me out please. By using something akin to the above proposal, lua tables can still be "viewable" images of the included schematic, and probably easy from which to "draw" a HUD image. It also makes lua schematic tables more efficient by making file sizes smaller. Most lua schems are outright serialized tables, and so include LOTS of white space, and large amounts of repetitive meta data. All that data can be compressed into a very standardized "ontological encoding". The lua tables can also be loaded into temporary variables, drawing the required node definitions from any of a set of predefined, or user defined, tables. These tables could also easily be filled with the relevant node defs from the registered_biomes table. All nodes, in all schematics could use the same data sets, or different data sets, all while using a single encoded "node def" within the actual lua table.

Long winded. I know. Here is an example of the direction I'm thinking, and have been using for over a year. This is also found in lib_mat / lib_eco, for all schematics in those mods. Trees became so trivial.

I have to post the actual schems using this in a second post.

+ Spoiler
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

ShadMOrdre
Member
 
Posts: 570
Joined: Mon Dec 29, 2014 08:07
Location: USA
GitHub: ShadMOrdre
In-game: shadmordre

Re: [Mod] Settlements [settlements]

by ShadMOrdre » Thu Jan 16, 2020 09:07

The following schematics were converted from Sokomine's mg_villages modpack, specifically, the Gambit and Cornernote village mods. All licensing and credits are according to that mod.

+ Spoiler



Shad
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Thu Jan 16, 2020 17:36

The lua schematics format I've been using is actually quite similar to that, with less "informative" variable names (they're just n1, n2, n3, etc.). It keeps the size and in-memory footprint down considerably and makes it easy to manually edit when all I want to do is change one node or one node type without having to fire up the game to do it.

I did think a bit about trying to come up with variable names that were better but in the end just went "eh, that's what IDEs and/or search-and-replace is for". :) Maybe if I work with schematics more in the future I'll continue refining schemsave's output. For now the amount of time I'd spend improving schemsave would be way more than the amount of time I'd save working with its current output.

Anyway, regarding the settlements mod itself; I'm going to put a bow on the current version at my github repo and call that "done" for now. Release candidate 1 for version 1.0, as it were. I added some additional administrative commands and tools, splitting the settlement and building generating tools into two separate tools to prevent accidents (I kept accidentally placing igloos or whatever when I wanted to create a settlement), and threw in a simple set of ruins that appears out in tundra areas (tundras were completely barren so I thought it might be nice to have something show up there from time to time). I'll bugfix whatever bugs people find, maybe put in a few more minor features if someone suggests something and I slap my forehead at how I could have overlooked that need, maybe do a little more documentation of the commands and API. But I need to take a rest from this and work on other mods for a while.

Eventually I'll do an "underground" revamp of it for use in giant caverns or other such exotic mapgens, but that'll be a 2.0 kind of thing.
 

User avatar
texmex
Member
 
Posts: 1694
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Settlements [settlements]

by texmex » Thu Jan 16, 2020 20:03

Image

Will it be possible to accomodate space between trunks but not shave the trees?
Attachments
screenshot_20200116_205059.png
(899.73 KiB) Not downloaded yet
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Thu Jan 16, 2020 20:49

In the settlement schematic info tables (eg in settlements_default.lua), check out the "platform_clear_above = false" parameter. That will cause settlements to not carve out a cavity above the platform where it's placing the building schematic. The schematic itself will still overwrite the trees where it directly overlaps, though, which could mean pieces of trunk would be left hovering over the roof. You could also add "force_place = false" to the schematic info, in which case the building would leave the tree in place and only build where there's air. I could see that working for ruins, not sure if it'll be good for most other sorts of structures. I used that flag with the jungle tree huts, if you look inside the schematic for the jungle trees you'll see that most of the actual nodes have per-node force-place enabled. That way the tree and hut gets built, and the air inside the hut is force-built so there isn't foliage filling the interior, but if there are adjacent trees they don't get a big box carved out of them. If you don't mind the possibility of half a tree resting on top of the roof then that might work for these huts.

Maybe some sort of per-node-type override on the platform_clear_above process, where foliage specifically could be left in place? You might get a blob of foliage hovering over the roof with a hollow core where the trunk once was, but that's perhaps less immersion-breaking than a whole half of a tree floating up there. And I could look into triggering the leaf decay process, as I recall that involves triggering node timers and I've already done something like that to get the wheat in the gardens to start growing. Orphaned leaf blobs would quickly disappear then.

If you want the trees to prevent the placement of buildings so that they only appear in pre-existing clearings, there's not really an existing option for that. There's the "ignore_surface_materials" property, but that's only used by the find-ground-level function that tests a single coordinate rather than something searching a building's footprint for obstructions. I'd have to get a lot more sophisticated with the code that is evaluating building locations and I fear that most forests would not provide enough building locations within a single chunk to put a viable settlement. Some of the bigger buildings would probably never find a place to build. Not sure how I'd go about this.

If you want the carve-outs to be *larger*, so that trees aren't crowded right up next to buildings and the platforms are more prominent, I could swing that. You'd still get shaved trunks, though.
 

MoNTE48
Member
 
Posts: 271
Joined: Sat Apr 06, 2013 11:58
GitHub: MoNTE48
In-game: MoNTE48

Re: [Mod] Settlements [settlements]

by MoNTE48 » Fri Jan 17, 2020 00:35

Another thing that would be really cool to expect from you is the separation of modpack framework (API) and schematics. So that you can easily use only the API, if someone does not need standard settlements for his subgame.
I think this should not be too complicated in the current state of the code.
This is what tenplus1 did with its mobs_redo -> divided it into API, mobs_animal, mobs_monster.
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Fri Jan 17, 2020 01:14

MoNTE48 wrote:Another thing that would be really cool to expect from you is the separation of modpack framework (API) and schematics. So that you can easily use only the API, if someone does not need standard settlements for his subgame.
I think this should not be too complicated in the current state of the code.
This is what tenplus1 did with its mobs_redo -> divided it into API, mobs_animal, mobs_monster.


Yeah, it's already almost there - I divided it into an API and a bunch of default settlement registrations, I could turn this into a modpack just by moving a few files around.

I've been hearing that request a lot, so I think I'll go ahead and just do it. :)

Edit: Done. Surprisingly, that went as easily as I was expecting it would go. Usually there's one last squirrelly dependency hidden away somewhere when you actually try doing that.
 

MoNTE48
Member
 
Posts: 271
Joined: Sat Apr 06, 2013 11:58
GitHub: MoNTE48
In-game: MoNTE48

Re: [Mod] Settlements [settlements]

by MoNTE48 » Fri Jan 17, 2020 09:46

Thanks, great job! Really.

But small question: why do you need intllib if only MT5 is supported, which has its own `minetest.translate` and` minetest.get_translator`? intllib is deprecated for MT5.
 

User avatar
texmex
Member
 
Posts: 1694
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Settlements [settlements]

by texmex » Fri Jan 17, 2020 13:12

FaceDeer wrote:Maybe some sort of per-node-type override on the platform_clear_above process, where foliage specifically could be left in place? You might get a blob of foliage hovering over the roof with a hollow core where the trunk once was, but that's perhaps less immersion-breaking than a whole half of a tree floating up there. And I could look into triggering the leaf decay process, as I recall that involves triggering node timers and I've already done something like that to get the wheat in the gardens to start growing. Orphaned leaf blobs would quickly disappear then.


This is what I had i mind too!

Great to see a pure API mod being carved out! But please, no modpacks. Building a dependency chain for a custom game on the API mod becomes impossible with modpacks.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Fri Jan 17, 2020 16:37

MoNTE48 wrote:But small question: why do you need intllib if only MT5 is supported, which has its own `minetest.translate` and` minetest.get_translator`? intllib is deprecated for MT5.


Because a couple of years ago, after quite a lot of annoying fiddling with incompatible Windows xgettext binaries and environment paths and whatnot, I managed to get a single-click "update/generate all the .po files necessary" pipeline working on my computer for intllib. It let me get into the habit of wrapping all user-facing strings in S() and generating templates for anyone who wanted to do some translation to work with.

I don't have a one-click pipeline like that set up for the new translation system, and last time I went poking around for one I didn't see any obvious clues on the forums on how to set one up. So right now I face the dilemma of either continuing to use intllib for now, or not wrapping user-facing strings in S() and going back to do that at some point in the future when I sort that out. I'd rather continue wrapping user-facing strings in S(), it seems like closer to "best practice" than not doing it. You don't need intllib, it's listed as an optional dependency.

Do you happen to know of a convenient Windows solution for generating the newer style of translation template?

texmex wrote:Great to see a pure API mod being carved out! But please, no modpacks. Building a dependency chain for a custom game on the API mod becomes impossible with modpacks.


I don't see why it's impossible. Have your game-specific settlement definition mod have "depends=settlements" and just ignore the others. If you don't have the "default" mod then Minetest won't let the other settlement definition mods run anyway even if you tried since it's a hard dependency for those.

I guess I could split this up into a bunch of separate repos, but at the moment I'd rather not. The API is brand new so if I introduce any changes (such as the modifications to clearing the air above schematics we were discussing) it means all the default settlement defs keep in sync rather than worrying about people updating one but not the other repo. The default settlement defs can't be used with any mod other than settlements so they would gain nothing from being separate mods, either. It just seems like a lot of hassle right now when my goal at the moment is to extricate myself from working on this mod for a little while so I can do some other stuff instead.
 

User avatar
texmex
Member
 
Posts: 1694
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Settlements [settlements]

by texmex » Fri Jan 17, 2020 20:31

FaceDeer wrote:I don't see why it's impossible. Have your game-specific settlement definition mod have "depends=settlements" and just ignore the others. If you don't have the "default" mod then Minetest won't let the other settlement definition mods run anyway even if you tried since it's a hard dependency for those.

I guess I could split this up into a bunch of separate repos, but at the moment I'd rather not. The API is brand new so if I introduce any changes (such as the modifications to clearing the air above schematics we were discussing) it means all the default settlement defs keep in sync rather than worrying about people updating one but not the other repo. The default settlement defs can't be used with any mod other than settlements so they would gain nothing from being separate mods, either. It just seems like a lot of hassle right now when my goal at the moment is to extricate myself from working on this mod for a little while so I can do some other stuff instead.


I empathize with this, of course. I shouldn't have written about dependency but rather about mod repo automation. For a large game with a lot of third-party mods I use git submodules to add them to the project. This way I don't have to handle the files of those mods at all, just pull them with the project. Maybe it's niche, I don't know.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Fri Jan 17, 2020 21:13

texmex wrote:I empathize with this, of course. I shouldn't have written about dependency but rather about mod repo automation. For a large game with a lot of third-party mods I use git submodules to add them to the project. This way I don't have to handle the files of those mods at all, just pull them with the project. Maybe it's niche, I don't know.


No, I've done that myself on other occasions. Conceptually it's a nice, clean way of managing situations like this where multiple mods are composed together into groups.

However, managing git submodules is rather a pain with the tools git has available. I have to go re-learn the shell commands for it every time I want to update stuff and sweat through "am I about to hose my repo?" moments when hitting "enter." So maybe later once settlements is nice and stable again. :)

Anyway, I just tried adding some of that special-purpose leafdecay stuff we talked about earlier. It's not perfect. I added the ability to have plaform generation omit specific node groups when carving out space above the building, so it'll remove trunks and stone and whatnot but leave anything with group:leafdecay behind. And then there's a property on settlements that goes through the map chunk post-generation and triggers the timer on all leafdecay nodes. See the settlements_medieval mod for example usage, it doesn't have to be just the "leafdecay" group.

Remaining problems: there are air nodes above parts of medieval building roofs that are part of the schematic, so you still get some cuboid spaces carved out. There are tree trunks incorporated into some medieval building schematics that prevent leaf decay near them. And you still get chunks of branches and trunks hanging in space sometimes. But dealing with edge cases of edge cases is getting a bit much right now, so some of that is "eh, maybe fix later someday". If you're making your own settlements then you can make the roof-air have prob=0 in your schematics, that should fix the cubiod air spaces for you. I'll do that for the default schematics eventually too.
 

User avatar
texmex
Member
 
Posts: 1694
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Settlements [settlements]

by texmex » Sat Jan 18, 2020 13:43

FaceDeer wrote:However, managing git submodules is rather a pain with the tools git has available. I have to go re-learn the shell commands for it every time I want to update stuff and sweat through "am I about to hose my repo?" moments when hitting "enter." So maybe later once settlements is nice and stable again. :)


I didn't mean that I wanted you to start using submodules. I meant that if you publish each mod as its own repo (mobs_redo style) then I myself can choose to only link, for instance, the API mod as a submodule in MY project :)

FaceDeer wrote:Anyway, I just tried adding some of that special-purpose leafdecay stuff we talked about earlier. It's not perfect. I added the ability to have plaform generation omit specific node groups when carving out space above the building, so it'll remove trunks and stone and whatnot but leave anything with group:leafdecay behind. And then there's a property on settlements that goes through the map chunk post-generation and triggers the timer on all leafdecay nodes. See the settlements_medieval mod for example usage, it doesn't have to be just the "leafdecay" group.

Remaining problems: there are air nodes above parts of medieval building roofs that are part of the schematic, so you still get some cuboid spaces carved out. There are tree trunks incorporated into some medieval building schematics that prevent leaf decay near them. And you still get chunks of branches and trunks hanging in space sometimes. But dealing with edge cases of edge cases is getting a bit much right now, so some of that is "eh, maybe fix later someday". If you're making your own settlements then you can make the roof-air have prob=0 in your schematics, that should fix the cubiod air spaces for you. I'll do that for the default schematics eventually too.


I trying to try this new feature out but it turns out that settlements seem to be placed by "true" randomness and not "pseudo" randomness based on seed. Hence no new settlement appears in the same place as an old one after purging map.sqlite. I think reproducability is a nice feature, for developers and players alike. I built around the principle of world reproducability in most things I create. It's really easy, because you only need to replace whatever you use in math.randomseed with the world seed. How about it? :D
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Sat Jan 18, 2020 16:33

texmex wrote:I didn't mean that I wanted you to start using submodules. I meant that if you publish each mod as its own repo (mobs_redo style) then I myself can choose to only link, for instance, the API mod as a submodule in MY project :)


Sure, but I'm a believer in making something available that users can drop into their mods folder and "it just works" so I'd want to provide a bundle of my own when I do that. :)

texmex wrote:I trying to try this new feature out but it turns out that settlements seem to be placed by "true" randomness and not "pseudo" randomness based on seed. Hence no new settlement appears in the same place as an old one after purging map.sqlite. I think reproducability is a nice feature, for developers and players alike. I built around the principle of world reproducability in most things I create. It's really easy, because you only need to replace whatever you use in math.randomseed with the world seed. How about it? :D


It actually isn't as easy as that. The question of whether a settlement gets generated in a given map chunk is a combination of "Is this chunk physically capable of hosting a settlement?" and "Is this chunk far enough away from all other existing settlements?" Since the first question can't be answered without generating the chunk in question, the second question can't be made deterministic until all possible mapchunks have been generated. Instead, the mod just checks if a chunk is far enough away from already-existing settlements. That works fine since future settlement placement will also take into account the distance from the settlement being placed now, but it means that in a sense the "seed" determining the placement of settlements includes the exact order in which mapchunks get generated. This pattern isn't quite a simple Poisson distribution.

It also has a subtle (and honestly unintended) benefit of preferentially placing settlements near the routes where players go. If a player grabs a boat and explores a sea, you'll get a lot of coastal settlements. At least, I hope that's considered a benefit since I can't think of an easy way to remove that bias. :)

Anyway, there's one area where I could make the randomness deterministic - the layout of the buildings inside each settlement. Currently if you use "/deleteblocks" to wipe and regenerate a map chunk that contains a settlement the settlement will be rebuilt with a new random layout (though retaining the old name). I figured that was kind of a feature, since an admin can look at a settlement and if he doesn't like it can redo the generation until he gets one that he likes better, so if I made it deterministic I'd also want to add some method of overriding the determinism.

I've also got a couple of tools admins can use to forcibly generate a settlement in a specific location, if they want to set up something specific for players.
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Sun Jan 26, 2020 02:23

I just pushed a fairly big change to my version of this mod, I split the code that was creating HUD waypoint markers for settlements out into a separate mod of its own called named_waypoints. That mod is now a hard dependency for settlements, even if you don't want to have the HUD markers visible to players (the same code is also used for keeping track of how far away existing settlements are, preventing them from being spawned too close together).

I did this because I want to reuse this basic mechanism for some of my other mods - for example, I've got an update to magma_conduits ready to push that will put names on the volcanoes it generates. But in the process I did a bunch of work on making the waypoints easier to manage, there's now an administrative command "/named_waypoints" that brings up a UI for visiting and modifying all existing waypoints with the click of a button.

I added upgrade code that should in theory be able to upgrade existing worlds that were created with older versions of settlements, but as with any major update to a mapgen mod make sure you back up and test out a well-established world before rolling it out.
 

User avatar
FreeGamers
Member
 
Posts: 478
Joined: Sat May 25, 2019 00:15
Location: United States
GitHub: is proprietary I use NotABug

Re: [Mod] Settlements [settlements]

by FreeGamers » Wed Feb 05, 2020 09:04

FaceDeer, a critical bug has been discovered.

Code: Select all
2020-02-05 03:02:19: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'settlements' in callback LuaABM::trigger(): ..../mods/lib_world/settlements/settlements/bookgen.lua:90: attempt to call upvalue 'bookshelf_on_construct' (a nil value)
2020-02-05 03:02:19: ERROR[Main]: stack traceback:
2020-02-05 03:02:19: ERROR[Main]:       ..../mods/lib_world/settlements/settlements/bookgen.lua:90: in function <..../mods/lib_world/settlements/settlements/bookgen.lua:56>
 

FaceDeer
Member
 
Posts: 454
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [Mod] Settlements [settlements]

by FaceDeer » Wed Feb 05, 2020 16:30

Interesting. A one-off, or something happening consistently? Just based on this callstack I think it's a result of not including the default mod as an optional dependency, which would result in the load order being undefined and bookshelves not being registered yet on some loads but not others.

I've pushed a fix that both adds default as an optional dependency and nil-checks the bookshelf on-construct function before calling it, so the crash should be prevented now.
 

PreviousNext

Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 9 guests