[Mod] Settlements [settlements]

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

Re: [Mod] Settlements [settlements]

by ShadMOrdre » Tue Jul 24, 2018 07:38

Nice mod! Villages blend well with terrain.

Mob NPCs get stuck. Perhaps add options to allow advanced_npcs or working_villagers.

Lava and water do not seem to be appropriately contained, as I have to rush to build walls around those liquids when a village spawns nearby.

Is it possible to add more building schems, without heavily copy/pasting code? It would be nice to simply provide a folder of schems (.mts files), that are available to choose from. Would make using the buildings from Sokomines villages, as well as other custom types, much easier.

I've noticed a conflict with Societies mod, where it appears that your village placement algorithm places settlements at exact location that Sunos Societies villages previously appeared. Given the same map seed, Societies crashes with Settlements mod enabled, and Societies villages cannot spawn and crash server. Since Societies is written in Portuguese or Esperanto, I'll work with you, if you are willing, and Bruno to try to resolve this, as both village types would look great, compliment each other, and could potentially interact.

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

Rochambeau
Member
 
Posts: 119
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Wed Jul 25, 2018 18:23

ShadMOrdre wrote:Nice mod! Villages blend well with terrain.

Mob NPCs get stuck. Perhaps add options to allow advanced_npcs or working_villagers.

Lava and water do not seem to be appropriately contained, as I have to rush to build walls around those liquids when a village spawns nearby.

Is it possible to add more building schems, without heavily copy/pasting code? It would be nice to simply provide a folder of schems (.mts files), that are available to choose from. Would make using the buildings from Sokomines villages, as well as other custom types, much easier.

I've noticed a conflict with Societies mod, where it appears that your village placement algorithm places settlements at exact location that Sunos Societies villages previously appeared. Given the same map seed, Societies crashes with Settlements mod enabled, and Societies villages cannot spawn and crash server. Since Societies is written in Portuguese or Esperanto, I'll work with you, if you are willing, and Bruno to try to resolve this, as both village types would look great, compliment each other, and could potentially interact.

Shad


NPCs only spawn in buildings and don't have the ability to open doors. Maybe TenPlus1 can help.

The well schematic needs some overhaul as water can drip on some locations. It's on my todo list.
The lava in the blacksmith should stay in the forge. Never had a problem with that.

At the current state, the schematics need some complementing definitions inside the code (size, depth, width, replace material, ...). Maybe I could add a routine to read all schematics in a certain folder and build a table with these informations.
One problem might be, that I'm using small buildings that do not need huge platforms. The bigger the building, the bigger the platform, the uglier the settlements.

The mod also replaces the wall material of the huts. And only of huts. That needs lua code to work and don't "break" other buildings.

I see there are a lot of mods competing for building sites. :-) I wasn't aware of that as I don't use those mods. First I want to finish my mods internal todo list. Then I can try to get along other with mods.

My current priority is the migration to LuaVoxelManip. That needs a complete modification of the mods logic and will take some time due to real life activities.
 

Sokomine
Member
 
Posts: 3976
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Wed Jul 25, 2018 18:50

Rochambeau wrote:NPCs only spawn in buildings and don't have the ability to open doors. Maybe TenPlus1 can help.

My mob_world_interaction mod has pathfinding (written by burli) modified so that paths through closed doors can be found. The mobs need to know about open/closed doors as well. As the ones spawned here don't seem to be particulary intelligent it might be sufficient to let them try to open doors randomly.

Rochambeau wrote:The lava in the blacksmith should stay in the forge. Never had a problem with that.

If the forge is made out of materials that can be griefed by cavegen (i.e. stone) and is located in the area that can be changed by sourrounding mapchunks (16 nodes in from all sides), then cavegen may eat through the forge and remove the containing stone.

Rochambeau wrote:One problem might be, that I'm using small buildings that do not need huge platforms. The bigger the building, the bigger the platform, the uglier the settlements.

That's true. Your buildings seem to be streched a lot in height. It works quite well when looking at them, and they seem to be functional enough. Yet extending the mechanism to buildings in general may not work.

Rochambeau wrote:I see there are a lot of mods competing for building sites. :-) I wasn't aware of that as I don't use those mods. First I want to finish my mods internal todo list. Then I can try to get along other with mods.

Guess players who like one mod in that direction will likely like other mods that do similar things as well :-) Sadly there isn't really a way to handle interaction. As long as everything's local to one mapchunk, we might get away with an additional api that could tell a mod if the current mapchunk has already been taken over by another mod. Might not be so easy as mapgen can run parallel processes. Storing in a database which mod took over which mapchunk might be a better solution. I'm worrying about that problem as well as I have some mods that change the terrain, and not all can exist simultaneously in the same world yet.

Rochambeau wrote:My current priority is the migration to LuaVoxelManip. That needs a complete modification of the mods logic and will take some time due to real life activities.

Your houses are pretty small. I'm unsure weather they'll really profit from LuaVoxelManip or not. But at least it might make some things easier.

My handle_schematics mod has functions for placing buildings inside voxelmanip volumes and doing the necessary calls for on_constructed. There's also a function for detecting flat land of a given size (used in basic_houses), and there'll soon be a function to flatten hillls that are local to the mapchunk and to similarily fill holes in order to gain more flat land.

Your arrangement of the buildings in a circular pattern is quite intresting. I wonder if it can be combined with my detection of flat land.
A list of my mods can be found here.
 

Rochambeau
Member
 
Posts: 119
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Thu Jul 26, 2018 06:18

Sokomine wrote:Your houses are pretty small. I'm unsure weather they'll really profit from LuaVoxelManip or not.


The mod doesn't use "set_node" too much, but the function find_surface with its "get_node_or_nil" is called pretty often.

So the main reason for switching to LVM is this:

Every time you call set_node or get_node your mod needs to communicate with the engine, which results in copying. Copying is slow, and will quickly kill the performance of your game.

https://rubenwardy.com/minetest_modding_book/en/map/lvm.html#introduction

and this:

If you run that, you’ll notice that data[vi] is an integer. This is because the engine doesn’t store nodes using their name string, as string comparision is slow.


https://rubenwardy.com/minetest_modding_book/en/map/lvm.html#reading-nodes

Sokomine wrote:Your arrangement of the buildings in a circular pattern is quite intresting. I wonder if it can be combined with my detection of flat land.


I'm glad that you like it. Feel free to play around with it.
 

Sokomine
Member
 
Posts: 3976
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Thu Jul 26, 2018 14:58

Rochambeau wrote:The mod doesn't use "set_node" too much, but the function find_surface with its "get_node_or_nil" is called pretty often.

What do you need that for? Just use the heightmap! The heightmap is extremly cheap compared to all other methods. There might still be an occasional call to get_node (or equivalent) for getting the terrain type - but your settlements don't adjust to the biome anyway, so there's no need for that either.

LVM is really great for large-scale map manipulation. But it's not free of cost either. Reading and writing back the LVM area does cost a bit. Changing just a few nodes is cheaper with set_node. It's hard to tell which one will be more efficient in your case. Guess you'll have to experiment.
A list of my mods can be found here.
 

Rochambeau
Member
 
Posts: 119
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Fri Jul 27, 2018 19:38

Sokomine wrote:What do you need that for? Just use the heightmap!


I mostly play with valleys mapgen and heightmap is not really reliable. I suspect this problem is not resolved yet ?
 

Sokomine
Member
 
Posts: 3976
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Fri Jul 27, 2018 20:25

Rochambeau wrote:I mostly play with valleys mapgen and heightmap is not really reliable. I suspect this problem is not resolved yet ?

Oh :-( In that case...but on other mapgens, heightmap works very well.
A list of my mods can be found here.
 

Rochambeau
Member
 
Posts: 119
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Sun Jul 29, 2018 19:03

Some bigger changes since last time. Mostly under the hood.

Every function with get/set_node has a corresponding function using LuaVoxelManip. After several tests: not much difference in performance. At least on my system (2014 Intel i7-4510U).
If somebody wants to try both systems, set "settlements.lvm = false" in const.lua to true.

All functions are still in the code, but I think I will abandon LVM. When getting voxelmanip and Voxelarea with minp and maxp of the current chunk, the LVM area sometimes is too small for bigger (> 20 buildings) or stretched settlements. Buildings are cut at the borders or are completely missing. Maybe I could enlarge the LVM to load a bigger area, but that's something I'm not pursuing.
 

User avatar
rubenwardy
Moderator
 
Posts: 6013
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Settlements [settlements]

by rubenwardy » Sun Jul 29, 2018 19:21

Sokomine wrote:LVM is really great for large-scale map manipulation. But it's not free of cost either. Reading and writing back the LVM area does cost a bit. Changing just a few nodes is cheaper with set_node. It's hard to tell which one will be more efficient in your case. Guess you'll have to experiment.


Hi, here's the performance cost of setting a cube area with LVM vs set_node. The x axis is the diameter, so 20 is 20x20x20. This is the best case for an LVM though, it's less clear when you have sparse setting of nodes.

For your usecase, it would probably be much better to place the houses as schematics than LVMs. Not sure what you're doing right now

Source: https://github.com/minetest/minetest/pu ... -360564966

Image
Image
 

Rochambeau
Member
 
Posts: 119
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Mon Jul 30, 2018 19:07

rubenwardy wrote:For your usecase, it would probably be much better to place the houses as schematics than LVMs. Not sure what you're doing right now


Thank you for your explanation. I dropped the migration to LVM and work with get_node/swap_node again. I'm quite pleased with its performance.

Latest bugfixes:
- forceload blocks where the schematics are built. So no more cut/incomplete buildings at mapchunk border
- fixed the well.mts. Water should be contained inside the well
 

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

Re: [Mod] Settlements [settlements]

by FaceDeer » Sun Jan 05, 2020 23:48

So, a week back I was shown this mod and asked about whether I could make it play nice with the commoditymarket mod. I fell in love with the simplicity of its buildings and layout compared to mg_villages. I've been working on a mod called dfcaverns that adds huge underground caverns and have been wanting to put little villages and clusters of ruins in them, and the screenshot looked perfect.

But then I dug into the code, and haven't stopped digging all week. :) My initial plan was just to look for an opportunity to insert some APIs that would allow this mod to flexibly handle placing other kinds of settlements in other locations, but before I could get to that I needed to do a huge amount of refactoring. The code used a lot of global variables, had a half-complete switch to using voxelmanipulators, and just generally was not easy to work with or extend. I'm deep enough in that I think I'll finish the task, so I figured I'd mention it here and see whether you guys will want to merge it back when I'm done or request any features as I go.

My refactor branch is here: https://github.com/FaceDeer/settlements/tree/refactor

I've rearranged the code extensively to make the interface cleaner, I finished the voxelmanip work, and I've added randomly-generated names for towns using another mod I've had sitting on the back burner for a while (https://github.com/FaceDeer/namegen). If a player gets close enough to the center of town that town is marked as "discovered" by them, and subsequently if they come within a certain radius it will be marked on their HUD with a waypoint. This can be disabled in the mod's settings.

I'm finally about to start working on the thing I started down this path for, I'm going to add an API so additional sets of building schematics and site parameters can be added by other mods. The existing defaults will remain, of course. Anything else I should be doing?
 

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

Re: [Mod] Settlements [settlements]

by ShadMOrdre » Mon Jan 06, 2020 04:34

FaceDeer,

A long while back, I started to hack at this code. My working "solution" involves using modified, uniquely named versions of this mod, almost akin to what mg_villages does. I have 6 or 7 versions running, each creating a unique "settlement". I've recently been able to have this use a lua mapgen heightmap as well.

My goal has always been to make this into a more suitable API, using either lua or .mts schems, and being biome aware. Most of my own customizations to this mod involve changes from .mts schematics, to using lua schems. I've also customized each version to run independently, renaming each version to a unique name.

In most of the screenshots I've posted, where villages are shown, they are a version of this mod. It's simplicity cannot be understated. Having used mg_villages for years, the most striking thing about the villages from this mod, are that they can exist at any height, and are placed with the terrain, instead of planted in a big circle. I wish Sokomine could add this ability to mg_villages, as a mix of the two village styles really adds further depth.

While mentioning Sokomine, I've also wanted to implement a simplified city_builder logic to give even more depth to towns. The simplicity of this mod, combined with the simplicity of city_builder, could easily be coded to provide an almost RTS feel to village building, from a game play perspective, while also allowing customized building from an RPG game style, and still be easily accessible to any sandbox type game as well.

From what I've seen of your projects, Facedeer, this might be a project worth recommending. I'll gladly share any code you might be interested in.

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

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

Re: [Mod] Settlements [settlements]

by FaceDeer » Mon Jan 06, 2020 05:27

Ooh, I am very interested in your lua mapgen heightfield stuff, the version of the mod I'm currently working from still relies entirely on the built-in mapgen heighfield object and that won't work when I eventually attempt to integrate this into dfcaverns. That's a major task that I've been putting off, I'm not entirely sure how I'll be doing it yet.

I switched over to lua schematics in my refactor as well, the node replacement map system is a pain to work with using the binary format (the replacements are done once when first loading the .mts and then you can't redo it with other replacements until the server restarts). I'm using this little mod pulled out of worldedit and hacked up a bit to produce a nicer output: https://github.com/FaceDeer/schemsave . In combination with the debugging tool in settlements that lets you place individual buildings in-world it's made it very easy to quickly tweak the buildings' schematics.

I haven't quite settled on the details of the API I want to build, with projects like this I sometimes find that it's best to just try implementing stuff and see how it actually works in practice. But what I'm thinking is probably going to be some sort of settlement definition that includes most of the stuff that I've left in the "const.lua" file so far - a list of surface materials that the settlements appear on, a list of schematics with frequency rules, sets of node replacement maps to randomly choose from, name generator configs, and so forth. So you'll be able to register a set of building types that appear only on snowy surfaces, a set of buildings that appears only in deserts, and so forth. Or they can overlap if you want some additional diversity. Since they'll all be running from the same mod they'll be able to avoid building over top of each others' settlement sites. I imagine this is a potential risk when running 6 different versions of this mod in parallel?
 

Sokomine
Member
 
Posts: 3976
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Mon Jan 06, 2020 22:47

FaceDeer wrote:I've been working on a mod called dfcaverns that adds huge underground caverns and have been wanting to put little villages and clusters of ruins in them,

Underground caverns may require an entirely diffrent building style. I'd imagine people settling mostly in small caves in the side of the walls, with some nice entrances built into the cave walls. The floor of the cave may be conveniently flat...but what if a stone from the ceiling gets loose and falls down? Better sleep in a smaller cave...

FaceDeer wrote:If a player gets close enough to the center of town that town is marked as "discovered" by them, and subsequently if they come within a certain radius it will be marked on their HUD with a waypoint.

Very nice. That could be useful for mg_villages as well. I spawn the player inside a village so that it's easier to find one.

ShadMOrdre wrote:My working "solution" involves using modified, uniquely named versions of this mod, almost akin to what mg_villages does.

Hm, the diffrent village_* style mods are a bit diffrent. They're not copies of the code but collections of schematics with some instructions of what the schematics are (i.e. this is a forge, has one workplace, no bed to sleep, can occour 3 times per village, and so on).

ShadMOrdre wrote:It's simplicity cannot be understated. Having used mg_villages for years, the most striking thing about the villages from this mod, are that they can exist at any height, and are placed with the terrain, instead of planted in a big circle.

mg_villages concentrates on the mapchunks at/close above sea level because those are logical places for villages. Other places are not considered in order not to slow mapgen down unnecessarily.

The settlements approach has its limitations as well: Can't get larger than one mapchunk (might be a plus in some situations), the smaller the size of the houses the better (easier to find a place for them), the higher the houses the better (else people may not notice the village at all).

ShadMOrdre wrote:I wish Sokomine could add this ability to mg_villages, as a mix of the two village styles really adds further depth.

I've been playing with this kind of village placement (the newest version of mg_villages allows making use of the village types etc. without placing villages by itself if so configured), but I'm not satisfied with the results yet. It just looks horrible if there's no walkable way from one house in the settlement to the next. And that may happen easily with mapgen beeing very small-scale.

Here's a screenshot of the current state:
Image
The wool "road" meet in the center of each mapchunk. Houses are placed wherever possible. Each mapchunk recives a village if possible. The houses used here are of the village type "logcabin" - extremly small ones with rarely a full block used for anything but the floor. With larger houses, far fewer suitable places are found.

ShadMOrdre wrote:While mentioning Sokomine, I've also wanted to implement a simplified city_builder logic to give even more depth to towns. The simplicity of this mod, combined with the simplicity of city_builder, could easily be coded to provide an almost RTS feel to village building, from a game play perspective, while also allowing customized building from an RPG game style, and still be easily accessible to any sandbox type game as well.

Well, that's mostly the goal of citybuilder, yes. But I'd hestistate to call it a "simple" mod. It (and the required handle_schematics mod) are rather complex. And you can't skip most of that complexity due to annoying edge cases and the like. What citybuilder currently is missing most are mobs that could build the structures. While there's no shortage of mobs that build structures, those mobs are controlled directly by the structures-placing mod. With citybuilder, mobs ought to roam around freely, occasionally searching for the two nodes "dig here indicator" and "scaffolding", walk there, do a bit of animation (wield things, dig animation, place animation), call a function and thus build the structure without having any idea of what their tiny contribution will create in the end.

FaceDeer wrote:the version of the mod I'm currently working from still relies entirely on the built-in mapgen heighfield object and that won't work when I eventually attempt to integrate this into dfcaverns.

The heightmap is very valuable for this kind of job. But if none is available...perhaps it'll help you a bit to consider what I'm doing right now to place something: Flat land can be detected, but - if we want to put something there, we can simplify that a bit. No need for the land to be flat at those positions where the structure will be placed - it will be flat/contain the nodes of the structure afterwards anyway. But we do want the circumference around that area to be as flat as possible. Still, platforms can't entirely be avoided. So at least make them not too high, outstanding and ugly. A slightly roundish shape works better than a rectangular one.

FaceDeer wrote:I switched over to lua schematics in my refactor as well, the node replacement map system is a pain to work with using the binary format (the replacements are done once when first loading the .mts and then you can't redo it with other replacements until the server restarts).

Yes, and that's one of the reasons why mg_villages and handle_schematics need to be so complex. They have to handle that sort of thing (and other edge cases).

FaceDeer wrote:some sort of settlement definition that includes most of the stuff that I've left in the "const.lua" file so far - a list of surface materials that the settlements appear on, a list of schematics with frequency rules, sets of node replacement maps to randomly choose from, name generator configs, and so forth.

That's basically what the diffrent village_* mods for mg_villages are for.

What keeps me from releasing the current test experiment with settlements-like villages (with mg_villages in the background but generating no villages on its own) is mostly the lack of roads. It doesn't look convincing if there's no way to get from one house to the other - no bridges, no tunnels, just rough terrain...no, people don't live that way. And the gravel paths in this mod here don't work so well for my purposes either.

In the end, settlements the size of a mapchunk may be much easier for mobs to handle. A realistic medieval village (as mg_village aims to create) can have a few hundred inhabitants. If it's inhabitants didn't fall prey to a disease or war recently, then there ought to live a few people in each house. And that means quite a significant amount of mobs...which then ought to seek their beds when it becomes night, or when it's night, they last got loaded at day, and now a player walks past...
Attachments
simple_villages_1.jpg
(251.58 KiB) Not downloaded yet
A list of my mods can be found here.
 

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

Re: [Mod] Settlements [settlements]

by FaceDeer » Tue Jan 07, 2020 02:21

Sokomine wrote:Underground caverns may require an entirely diffrent building style. I'd imagine people settling mostly in small caves in the side of the walls, with some nice entrances built into the cave walls. The floor of the cave may be conveniently flat...but what if a stone from the ceiling gets loose and falls down? Better sleep in a smaller cave...


Indeed, I have other plans for properly "Dwarven" settlements that are dug into the rock in a way more akin to dungeon generation. But the caverns in DFCaverns have a lot of fungus-based lumber available for more primitive structures and shelters as well, so I expect we'd see some of the less-advanced creatures building conventional hovels and huts from it. And of course there need to be mysterious ruins scattered around to discover. I'll have to play around a bit to see what looks nice.

The trickiest bit I foresee is that there are a lot of overhanging ledges in the giant caverns, so figuring out where the "ground" is will be a fun challenge.

Sokomine wrote:
FaceDeer wrote:If a player gets close enough to the center of town that town is marked as "discovered" by them, and subsequently if they come within a certain radius it will be marked on their HUD with a waypoint.

Very nice. That could be useful for mg_villages as well. I spawn the player inside a village so that it's easier to find one.


I almost started writing up a formspec-based map for showing the relative locations of the settlements a player knows about, but then I slapped myself and said "No, FaceDeer, you're already on a sidequest! Don't start yet another one!" :) I put the hud-making code in a separate file, hud.lua, so hopefully it'll be easy to rip off for other mods. I'm currently MIT-licensing everything I do, would you need me to dual-license it to something else for you?

Sokomine wrote:The settlements approach has its limitations as well: Can't get larger than one mapchunk (might be a plus in some situations), the smaller the size of the houses the better (easier to find a place for them), the higher the houses the better (else people may not notice the village at all).


I've been pondering ways to make multi-chunk settlements without making the code hugely more complicated. The easiest would be to simply try to spawn additional nameless settlements in adjacent chunks as "suburbs" of the main settlement (calling emerge on them to ensure the adjacent chunks all get spawned right away and we don't have to "remember" anything about the extended layout long-term).

But that's another side-quest, I shall continue resisting those for now. So much backlogged in my quest stack already...

Sokomine wrote:
FaceDeer wrote:the version of the mod I'm currently working from still relies entirely on the built-in mapgen heighfield object and that won't work when I eventually attempt to integrate this into dfcaverns.

The heightmap is very valuable for this kind of job. But if none is available...perhaps it'll help you a bit to consider what I'm doing right now to place something: Flat land can be detected, but - if we want to put something there, we can simplify that a bit. No need for the land to be flat at those positions where the structure will be placed - it will be flat/contain the nodes of the structure afterwards anyway. But we do want the circumference around that area to be as flat as possible. Still, platforms can't entirely be avoided. So at least make them not too high, outstanding and ugly. A slightly roundish shape works better than a rectangular one.


One possible detail that will help me somewhat is that I'm using the "subterrane" mod as the cavern-creating engine for DFCaverns, and it provides a pre-populated list containing the indexes of all nodes that are part of the cavern floor. So I'm thinking I'll do some kind of flood-fill pathfinding algorithm to explore the floor nodes and find large contiguous groups of them. Won't need to scan through every node in the chunk that way.

First I'll finish refactoring the existing mod, though, focusing on the surface settlements for now. That'll be more widely useful than cavern-specific stuff.

Sokomine wrote:
FaceDeer wrote:I switched over to lua schematics in my refactor as well, the node replacement map system is a pain to work with using the binary format (the replacements are done once when first loading the .mts and then you can't redo it with other replacements until the server restarts).

Yes, and that's one of the reasons why mg_villages and handle_schematics need to be so complex. They have to handle that sort of thing (and other edge cases).


I'm guessing the binary schematic format was created primarily for use with trees and other such mapgen objects that get placed on the map hundreds of times per second? It's the only reason I can think of for needing to squeeze all that optimization in at the expense of readability and flexibility. I've long battled with over-optimization and the problems it causes us coders in my day job, so at this point I just turn everything into lua tables whenever I have to work with schematics and call it a day. :)

Sokomine wrote:In the end, settlements the size of a mapchunk may be much easier for mobs to handle. A realistic medieval village (as mg_village aims to create) can have a few hundred inhabitants. If it's inhabitants didn't fall prey to a disease or war recently, then there ought to live a few people in each house. And that means quite a significant amount of mobs...which then ought to seek their beds when it becomes night, or when it's night, they last got loaded at day, and now a player walks past...


One of the things I like about the tiny clusters of huts that settlements produce is that it makes the "untamed wilderness" feel of the non-settlement parts of the map feel plausible still. If there's a hundred people living just over the hill, why is there still a nest of monsters or unexploited ore to dig here on this side of it? These tiny hamlets feel more like what some small intrepid group has been able to eke out of freshly-settled land. I bet it'll feel even moreso once I add a "ruined" settlement type to represent the intrepid groups that didn't make it.

I should mention I did succumb to one side-quest today; I got annoyed at the empty shelves in townhall and kingsmarket and wrote "bookgen.lua" for my refactor branch. It uses a simple Markov chain gibberish-generator to put a bunch of books into the shelves that were written by "a resident of <town name>". They can be taken as little trophies of your explorations perhaps. I got some source text from Project Gutenberg to seed the Markov chains with for testing purposes, the text of Gulliver's Travels and some old book about cave geology. I'm open to other sources of text, perhaps something a bit less voluminous (Gulliver's Travels is half a megabyte, which is overkill for generating gibberish that it's unlikely anyone's ever going to really read).
 

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

Re: [Mod] Settlements [settlements]

by FreeGamers » Tue Jan 07, 2020 05:45

I'm looking at using trm_lorebooks as my source of books, the default books in it will need work later in the future, but i found it easier to work with and more consistent than the Project Gutenberg mod written by duane. If you are just refering to Project Gutenberg the libre book project, then disregard the final part of that statement.
 

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

Re: [Mod] Settlements [settlements]

by FaceDeer » Tue Jan 07, 2020 06:32

FreeGamers wrote:I'm looking at using trm_lorebooks as my source of books, the default books in it will need work later in the future, but i found it easier to work with and more consistent than the Project Gutenberg mod written by duane. If you are just refering to Project Gutenberg the libre book project, then disregard the final part of that statement.


Ah, those sound like interesting mods, I'll look into adding hooks to populate shelves with those instead.

What I whipped up is not either of those things, though. bookgen.lua makes books that are filled with random gibberish whose structure is based on an existing text, so it looks almost like it means something but not really. For example:

screenshot_20200106_232955.png
(234.36 KiB) Not downloaded yet


I was mainly thinking of these things as something you could carry away with you that indicated "I was in Applecliff!" Or whatever. They make the shelves less barren. :)
 

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

Re: [Mod] Settlements [settlements]

by FreeGamers » Tue Jan 07, 2020 07:11

carrying treasures inside specimens besides an ancient lemon

Indeed. That reminds me of some Terry Davis oracle programs.

That looks pretty good though apart from gibberish. I actually like the consistency of the sfinv formspec over the trm background but thats just my tastes and appreciation for minimalist design. I'm using TRM lorebooks because it was easy to plug in and extend it. I would appreciate a good stand alone mod api for adding books that supporting the default behavior of copying books. It supported another treasure API that adds teasure into default areas so I had a nice lazy way to add them into my world.

However, I use a new lootchest system and could probably use a more bare-bones book system without much fuss. Sorry for the rant, but those have been my thoughts about books. Its an area that I still plan to work on in my game. I'll have to look at the pros and cons of each but the version in your screenshot looks nice.
 

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

Re: [Mod] Settlements [settlements]

by ShadMOrdre » Tue Jan 07, 2020 08:41

This mod has built in code that fills chests, as well as, furnaces. It would be trivial to update this mod to use a settable list of treasure items.
MY MODS: lib_ecology lib_materials lib_clouds lib_node_shapes ---- Inspired By: Open Source Virtual World Simulator Opensimulator.
 

Sokomine
Member
 
Posts: 3976
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Tue Jan 07, 2020 19:37

FaceDeer wrote:And of course there need to be mysterious ruins scattered around to discover.

Mysterious ruins are always great! Best if there's a story behind them...

FaceDeer wrote:I put the hud-making code in a separate file, hud.lua, so hopefully it'll be easy to rip off for other mods. I'm currently MIT-licensing everything I do, would you need me to dual-license it to something else for you?

I'm usually using GPLv3.0 unless it's something very tiny.

FaceDeer wrote:But that's another side-quest, I shall continue resisting those for now. So much backlogged in my quest stack already...

Oh yes :-( I know that feeling too well.

FaceDeer wrote:One of the things I like about the tiny clusters of huts that settlements produce is that it makes the "untamed wilderness" feel of the non-settlement parts of the map feel plausible still. If there's a hundred people living just over the hill, why is there still a nest of monsters or unexploited ore to dig here on this side of it?

Ah, I see. We have diffrent times in mind. In my times, people had time to settle down and expand. The "nest of monsters" no longer exsists - the sand mobs peacefully settled down in the sandcity village type (that one's explicitly created for them), and other hostile mobs either learned how to adjust and became a part of society or died out. In that world, untamed unowned animals like sheep roaming around are a problem. Such animals always ought to be owned by some local farmer or be of an untamable wild species.

FaceDeer wrote:It uses a simple Markov chain gibberish-generator to put a bunch of books into the shelves that were written by "a resident of <town name>".

That sounds very nice, but I fear that it might also be problematic. Players might try to read some sense into them - in particular if there are quests in the world and the books might be mistaken for hints.

Also having one book author per settlement might be a bit much. Your inhabitants just started settling there - they're busy with surviving against that mob horde next hill...not much time to write a book! Perhaps parish registers would be more in line of what could be expected. If there are monsters, perhaps stories about them to warn kids could also be useful ("no, that dirt mob doesn't want to hug you...").
A list of my mods can be found here.
 

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

Re: [Mod] Settlements [settlements]

by FaceDeer » Tue Jan 07, 2020 20:39

Sokomine wrote:
FaceDeer wrote:And of course there need to be mysterious ruins scattered around to discover.

Mysterious ruins are always great! Best if there's a story behind them...


I've been working on a new release of DFCaverns that will be adding a new cavern layer beneath the existing "underworld" layer, and I'm definitely feeling like a story is developing for this world. It's diverging from the original "Dwarf Fortress in Minetest" foundation a bit, but that's okay. Right now the gist of it is that there was once a vast war between surface-dwellers and some kind of primordial horror from the deeps, and the surface-dwellers succeded in sealing the horrors below a layer of undiggable material.

So of course now I've put a new cavern layer down there to discover, a "Primordial" layer that resembles the classic journey-to-the-center-of-the-world subterranean jungle, and have had to implement a way for players to penetrate the undiggable material. I may need to learn more about mob-crafting next to make it something worth hesitating about. :)

I haven't done as much work on making the upper layers have a "story" to them, but that's probably for lack of ruins to hang those stories on in the first place. Hopefully that'll change.

Sokomine wrote:
FaceDeer wrote:I put the hud-making code in a separate file, hud.lua, so hopefully it'll be easy to rip off for other mods. I'm currently MIT-licensing everything I do, would you need me to dual-license it to something else for you?

I'm usually using GPLv3.0 unless it's something very tiny.


Okay, I'll dual license this one to that for you. I plan to do some more work on the hud stuff before "release" so no rush though.

Sokomine wrote:Ah, I see. We have diffrent times in mind. In my times, people had time to settle down and expand. The "nest of monsters" no longer exsists - the sand mobs peacefully settled down in the sandcity village type (that one's explicitly created for them), and other hostile mobs either learned how to adjust and became a part of society or died out. In that world, untamed unowned animals like sheep roaming around are a problem. Such animals always ought to be owned by some local farmer or be of an untamable wild species.


Might be interesting to have a very large scale "civilization map" that makes some regions more built-up than others. Not sure how well that will work in practice, most of the active servers I've visited have generally had players hanging out within just a couple of kilometers of the main spawn area.

Oh, hey, I should look at adding an optional spawn manager for settlements that assigns new players to a random existing settlement as their initial spawn point. Almost all the villages have huts with beds in them so it'll be easy for players to move to another settlement later if they want. And maybe an optional auto-protection of the chunk the settlement is in? I don't generally like protecting these things, settlements should be "living", but other server admins may think differently there.

Sokomine wrote:Perhaps parish registers would be more in line of what could be expected. If there are monsters, perhaps stories about them to warn kids could also be useful ("no, that dirt mob doesn't want to hug you...").


Good idea. I've started putting together the actual API for settlement definition and I think I'll add callbacks on each individual building type to allow custom initialization of nodes. That way one could add building-type-specific books, too. The trading outposts could have ledgers and order books, the town hall could have land registries and letters sent to and from other settlements, the church could have birth, wedding, and death records. Those are all things that could be randomly generated and also look both meaningful and boring.
 

karlexceed
New member
 
Posts: 6
Joined: Sun Jan 05, 2020 22:35
GitHub: karlexceed
In-game: karlexceed

Re: [Mod] Settlements [settlements]

by karlexceed » Wed Jan 08, 2020 05:38

FaceDeer wrote:I was mainly thinking of these things as something you could carry away with you that indicated "I was in Applecliff!" Or whatever. They make the shelves less barren. :)

Sokomine wrote:Mysterious ruins are always great! Best if there's a story behind them...

FaceDeer wrote:one could add building-type-specific books, too. The trading outposts could have ledgers and order books, the town hall could have land registries and letters sent to and from other settlements, the church could have birth, wedding, and death records. Those are all things that could be randomly generated and also look both meaningful and boring.

I love this idea! I've always been looking for ways to make a world feel more inhabited.

There are so many possibilities - cookbooks (maybe even as a long-form written version of the actual crafting guide), indecipherable spellbooks, religious tomes in ancient languages...
 

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

Re: [Mod] Settlements [settlements]

by FaceDeer » Wed Jan 08, 2020 07:57

The first alternate settlement type added using the API I'm developing: a small cluster of igloos (igli?) placed on terrain with snowblock surface material.

screenshot_20200108_003503.png
(393.56 KiB) Not downloaded yet


I went with igloos because that was the absolute simplest thing I could think of. Makes a good test case. :) The regular medieval-like villages still spawn elsewhere, as normal.
 

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

Re: [Mod] Settlements [settlements]

by FaceDeer » Tue Jan 14, 2020 05:57

Okay, I'm going to throw down an anchor and get a release version ready. I just merged my branch into master, though I won't call it done just yet - there's a few small bits of polish left, as well as testing and (presumably) bugfixing. But the features are pretty much complete. Here's what I've got:

  • Vastly improved efficiency and robustness in the coding, especially in how mapgen was being handled. The mod no longer uses forceload or delayed post-mapgen execution, it does everything through the mapgen VoxelManip object directly. This also allowed me to remove a couple of hacks that were apparently there to make sure the mod didn't overload and crash. If you're upgrading an existing world that used the previous version of this mod, you may wish to delete the "force_loaded.txt" file from your world's folder - the previous version was using forceload incorrectly and was causing the chunks that settlements were located in to always be held in memory even after they'd been built.
  • Settlement locations are now stored in an AreaStore object, if you're upgrading an existing world the "settlements.txt" file will be read and converted into a "settlements_areastore.txt" file where all future settlement information will be stored. Once settlements_areastore.txt exists you can get rid of the old settlements.txt file if you like.
  • More reliable building placement in wooded areas or areas with plants. Previously trees could block building placement, now trees get treated like air when detecting ground level.
  • Repositioned buildings relative to their construction point to make the flattened platforms they're built on less obvious.
  • Added two trading depot structures to the standard medieval settlements, one for the King's Market and one for the Night Market. The Night Market will be hidden inside an unobtrusive hut. Install commoditymarket to make these fully functional.
  • All settlements now have randomly-generated names using the namegen mod. I still need to add some kind of simple fallback name generator in case that mod isn't included, so for now you should probably include it otherwise all settlements will be called "Town." There's a chatcommand for server admins to regenerate all town names in the event that you upgrade an existing world without namegen being installed and wind up with everything named "Town".
  • Players can "discover" towns when they get close to the central building, after which the town will be labeled as a waypoint on their HUD when they're within a certain range of it. This will hopefully give more of a sense of large-scale geography for players, and some incentive for exploration. By default players need to be in possession of a mapping kit to see the HUD waypoints, this is an optional requirement in the mod's settings.
  • API! The settlement types are defined by a "register settlement" function that takes a settlement definition table. I've tried to make the API nice and versatile. To stress-test it I used it to add a number of rare specialized town types: desert, jungle, igloo, and underwater coral (see the gallery below). See default_settlements.lua for usage, I was going to write up some documentation but I've run out of brain juice for today.
  • There's a server-admin-only tool included in this mod (looks like a wooden shovel) that creates settlements on right-click and single buildings on left-click. schemsave may be handy for modders saving new schematics in an easy-to-work-with format. I like lua schematics over mts schematics, there's a lot more convenience working with those. There's also a bunch of chatcommands defined by settlements, including some for renaming settlements and for setting all settlements as "discovered" by you to help server admins navigate.
  • I scrapped the Markov-chain gibberish books I was toying with earlier and added two simpler but more meaningful book types; travel guides and market ledgers. The market ledgers just contain some transactions from the King's Markets, if commoditymarket is installed. The travel guides tell the direction and distance to other known settlements, I whipped up the north_compass mod to give players a tool that can help them find the destination (though it now occurs to me that the mapping_kit lets you see the minimap, which has a "North" indicator on it, making this little mod redundant. Oh well!). New books will very slowly spawn in the bookshelves of settlements over time, so even if a player raids the place and takes everything there will eventually be more guides available. I'll ponder some way to add hooks for new book types to be added, but for now just look at the "fill_shelf" function and the "Settlement book authoring" ABM in default_schematics.lua if you want to hack something in.

I think that's everything.

Settlement types:

  • Medieval
  • Desert
  • Arctic
  • Jungle
  • Coral underwater (no screenshot, it's disabled by default in the mod's settings. I threw this one in just to test some stuff).

Link to the repository if you want to play with it. I probably wouldn't install it on a production server just yet, it's a mapgen mod so if it breaks stuff it may not be easy to clean up, but it seems reasonably well behaved in my recent local test runs. Probably in a couple of days if nothing alarming is discovered.
Last edited by FaceDeer on Fri Jan 17, 2020 04:14, edited 2 times in total.
 

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

Re: [Mod] Settlements [settlements]

by texmex » Tue Jan 14, 2020 07:10

By the mese, that’s a chunky update! I need to try this soon!!
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw
 

PreviousNext

Return to WIP Mods



Who is online

Users browsing this forum: GamingAssociation39, Irremann, MSN [Bot] and 4 guests