[Mod] Settlements [settlements]

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

[Mod] Settlements [settlements]

by Rochambeau » Post

Settlements

Image

Image

Description
This mod adds small settlements (7 - 20 buildings) during world generation. The small huts contain chests with random stuff.
If mobs_redos NPCs are available, there will be some life inside the buildings (they spawn on default:junglewood, maybe I'll register a special node for themthey spawn on a special node with junglewood looks). Still testing.

Buildings by now:
  • townhall (as center of settlement)
    well
    hut
    tower
    church
    garden
    blacksmith
    lamp
Notes
Settlements can be played with Minetest 0.4.16 or above.

Depends on default
Optional:
- mobs_npc (as inhabitants)
- farming (some vegetables as chest content)

List of features
Buildings are rather smalls to fit in almost every terrain.

Bug reports and suggestions
You can report bugs or suggest ideas on GitLab.

Links
Source
Download
How to install

License
WTFPL
Attachments
screenshot_2_small.png
screenshot_2_small.png (587.94 KiB) Viewed 4127 times
screenshot_small.png
screenshot_small.png (671.04 KiB) Viewed 4127 times
Last edited by Rochambeau on Fri Jul 13, 2018 07:34, edited 2 times in total.

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Settlements [settlements]

by Stix » Post

Nice! Ive been waiting for a good villages mod that places schematics according to the terrain instead of flattening the ground. The only thing this is missing is gravel roads and more natural/realistic farms :3.
Hey, what can i say? I'm the bad guy.

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] Settlements [settlements]

by TenPlus1 » Post

Nice mod, was surprised to see 8 npc's sharing a tiny house though :)

Note: you could speed up generation using swap_nodes for foundations, also furnace has no formspec attached to it.

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: [Mod] Settlements [settlements]

by hajo » Post

Rochambeau wrote:adds small settlements (7 - 20 buildings) during world generation.
Would it be possible to also have 'village-spawn-eggs',
ie. to make it easy to place such settlements manually ?

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Settlements [settlements]

by Stix » Post

hajo wrote:
Rochambeau wrote:adds small settlements (7 - 20 buildings) during world generation.
Would it be possible to also have 'village-spawn-eggs',
ie. to make it easy to place such settlements manually ?
Yeah that would be nice.
Hey, what can i say? I'm the bad guy.

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

Re: [Mod] Settlements [settlements]

by texmex » Post

Very good-looking!

R-One
Member
Posts: 160
Joined: Wed Dec 20, 2017 23:06
Location: Nice, France

Re: [Mod] Settlements [settlements]

by R-One » Post

hello, an oversight in init.lua on gitlab ?
package.cpath = package.cpath .. "; /usr/share/lua/5.2 / ?. so"
package.path = package.path .. "; / usr / share / zbstudio / lualibs / mobdebug / ?. lua"
require ( 'mobdebug'). start ()

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

Re: [Mod] Settlements [settlements]

by Rochambeau » Post

hello, an oversight in init.lua on gitlab ?
It's necessary when debugging with Zerobrane Studio. I forgot to remove it.
Would it be possible to also have 'village-spawn-eggs',
ie. to make it easy to place such settlements manually ?

Code: Select all

/giveme settlements:tool
leftclick: one building is generated, hardcoded
rightclick: attempting to build a settlement. Currently only works when in the "right area". Buildings can only be built when finding these surface materials:

Code: Select all

  "default:dirt_with_grass",
  "default:dirt_with_snow",
  "default:dirt_with_dry_grass",
  "default:dirt_with_coniferous_litter",
  "default:sand",

Note: you could speed up generation using swap_nodes for foundations, also furnace has no formspec attached to it.
Repaired the furnace. Furnaces don't have meta data, so won't work as expected. Same as chests. Meta is added by on_construct.
The only thing this is missing is gravel roads and more natural/realistic farms :3.
Gravel roads would be nice indeed. I tried to avoid them by claiming "it's only a settlement, not a village or town". ;-) Maybe in the distant future. As for the realistic farms: I designed the gardens after those in Minecraft. Yeah, that's bad. But I'm not that creative. If you point to a better looking farm, I see what I can do.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Post

Stix wrote: Nice! Ive been waiting for a good villages mod that places schematics according to the terrain instead of flattening the ground.
The vast majority of human players on a server isn't capable of adjusting their building style to the sourrounding terrain.
Stix wrote: The only thing this is missing is gravel roads and more natural/realistic farms :3.
:-/ Such demands is what you get if you promise "placed without adjusting the land" :-)
TenPlus1 wrote: Nice mod, was surprised to see 8 npc's sharing a tiny house though :)
There was heavy overpopulation in my test worlds as well. It's possible that they breed so much in order to get at least some people through the next night when aggressive monsters (sometimes called players) will appear.
Rochambeau wrote: "default:dirt_with_coniferous_litter",
That's something I'll have to teach mg_villages/handle_schematics as well.
Rochambeau wrote: Gravel roads would be nice indeed. I tried to avoid them by claiming "it's only a settlement, not a village or town". ;-) Maybe in the distant future.
Very understandable :-) MT's terrain is very tricky in that regard.
Rochambeau wrote: As for the realistic farms: I designed the gardens after those in Minecraft. Yeah, that's bad. But I'm not that creative. If you point to a better looking farm, I see what I can do.
Hm, yes, I don't overly like standard MC houses/villages. They seem so...tiny and stretched too much in height. At least the forge is pretty nice, and the huts as such aren't too bad either. The church looks much too cramped.

Overall, the settlements generated look quite good. In detail, there are points where much imporvement is needed. For example it feels wrong to have the tower at almost the lowest place of the village, where you can hop on top of it from the mountain it's partly embedded in. Many huts end up mostly embedded in a hill as well. It's partly acommodated for by the house having overhanging roofs. Thus the paths to the front door are usually free. Other houses end up on visible platforms. That's hard to avoid. I had that in my random_buildings mod as well (though with some randomness added to the platforms/pillars).

In one test world, the houses where cut off at an absolute height of 30.

A settlement inside a dense rainforrest isn't optimal either. The trees ought to be cut down in such a case.

Holes inside the village area are problematic. If all those poor mobs spawning inside the houses ever manage to get out of the door, they'll surely fall into all these deep holes and stay there forever. That can't be!

My handle_schematics mod has a cheap function for analyzing the hightmap and for finding places with equal height:

Code: Select all

local heightmap = minetest.get_mapgen_object('heightmap');
local res = handle_schematics.find_flat_land_get_candidates_fast( heightmap, minp, maxp, sizex, sizez, minheight, maxheight );
sizex and sizez are the dimensions of the flat area you're looking for. minheight and maxheight can limit where it can be placed (i.e. most houses don't want to be placed below water level; ships on mountains are uncommon). Returns res.places_x and res.places_z (for houses rotated by either 90 or 180 degrees; sizex and sizez are swapped). Those tables are arrays that contain all the indices relative to heightmap that are flat enough for a house of said dimensions. Places choosen for a house can be marked as occupied so that they won't get offered in subsequent runs of handle_schematics.find_flat_land_get_candidates_fast.

The circular way the mod places its houses looks very convincing. That'd be a very suitable arrangement of houses for the village type grasshut in my villages modpack as well.

Nice to see replacements used so that the houses look diffrent. Seems to work very well.

I hope that the mod will be developped further.
A list of my mods can be found here.

Cartmic
Member
Posts: 43
Joined: Thu Jul 12, 2018 18:03

Re: [Mod] Settlements [settlements]

by Cartmic » Post

Hello,

I have a question about your licence file, I note that you have a copyright in there but below you provide a public domain licence and a link to it, so tell me is your code (c) Copyright Rochambeau (2018) or licenced under the the licence you refer to?
Trailgen A C++ mgv6-like mapgen using the biome api viewtopic.php?f=7&t=26751

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

Re: [Mod] Settlements [settlements]

by rubenwardy » Post

Both.

Copyright doesn't mean that you can't use it, it just means that that person owns the copyright. All works will have a copyright, open or not. Copyright is automatic

You're mixing up copyright with "all rights reserved"
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Cartmic
Member
Posts: 43
Joined: Thu Jul 12, 2018 18:03

Re: [Mod] Settlements [settlements]

by Cartmic » Post

rubenwardy wrote:Both.

Copyright doesn't mean that you can't use it, it just means that that person owns the copyright. All works will have a copyright, open or not. Copyright is automatic

You're mixing up copyright with "all rights reserved"
Sorry I came across as quite abrasive there.
Thanks for that clarification.
Trailgen A C++ mgv6-like mapgen using the biome api viewtopic.php?f=7&t=26751

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

Re: [Mod] Settlements [settlements]

by Rochambeau » Post

@ those who looked a the sources and know what the mod is doing at the current state:

would the use of voxelmanip bring any advantages in performance?


The next thing I'm trying to do is find better places for building a settlement. Thanks @Sokomine for bringing 'heightmap' to my attention.
To minimize the use of visible platforms the mod could determine the highest and lowest y in the area and if the difference is not too big -> settlement. That will dramatically decrease the number of suitable spots, but the remaining settlements might look more natural.

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

Re: [Mod] Settlements [settlements]

by Rochambeau » Post

Added simple height detection. Settlements are only created, when the height difference is 10 or less. So no hardcore mountain settlements anymore.
Still heavy WIP.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Post

Rochambeau wrote: To minimize the use of visible platforms the mod could determine the highest and lowest y in the area and if the difference is not too big -> settlement. That will dramatically decrease the number of suitable spots, but the remaining settlements might look more natural.
My handle_schematics/basic_houses mod is already capable of detecting sufficiently large flat areas for building individual houses. Combined with your intresting circular arrangement that could produce good results. You'd still have to search through the list of possible places in order to find the one closest to the location on the circle you aim for with that particular building.

I've also made some progress with the detection of hills (= local to the mapchunk; can be removed for more flat surface area without affecting the overall landscape) and holes (= suitable for highlandpools or for filling up and thus creating more flat space).
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 » Post

Found a way to create some gravel paths:
Image

Still in early stage and much space for improvement. But it works.
Attachments
screenshot.png
screenshot.png (894.22 KiB) Viewed 4127 times

User avatar
Hume2
Member
Posts: 709
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: [Mod] Settlements [settlements]

by Hume2 » Post

Nice mod. I'm now testing it. It works but it might also throw this error:

Code: Select all

2018-07-17 11:14:21: ERROR[Main]: ServerError: AsyncErr: Lua: finishGenRuntime error from mod 'settlements' in callback environment_OnGenerated(): ...k1asw/blb/minetest/bin/../mods/settlements/utils.lua:35: attempt to index a nil value
2018-07-17 11:14:21: ERROR[Main]: stack traceback:
2018-07-17 11:14:21: ERROR[Main]: 	...k1asw/blb/minetest/bin/../mods/settlements/utils.lua:35: in function 'find_surface'
2018-07-17 11:14:21: ERROR[Main]: 	...k1asw/blb/minetest/bin/../mods/settlements/utils.lua:220: in function 'determine_heightmap'
2018-07-17 11:14:21: ERROR[Main]: 	...ok1asw/blb/minetest/bin/../mods/settlements/init.lua:77: in function '?'
2018-07-17 11:14:21: ERROR[Main]: 	...ok1asw/blb/minetest/bin/../builtin/game/register.lua:419: in function <...ok1asw/blb/minetest/bin/../builtin/game/register.lua:399>
Edit: I found another bug. When the farming redo mod is disabled but the MTG's farming is on, it might still generate stuff from farming redo like melon slices or corn in chests.
If you lack the reality, go on a trip or find a job.

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

Re: [Mod] Settlements [settlements]

by texmex » Post

Rochambeau wrote:Found a way to create some gravel paths:
Image

Still in early stage and much space for improvement. But it works.
I's already beautiful!

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

Re: [Mod] Settlements [settlements]

by Rochambeau » Post

Hume2 wrote:Nice mod. I'm now testing it. It works but it might also throw this error:

Code: Select all

2018-07-17 11:14:21: ERROR[Main]: ServerError: AsyncErr: Lua: finishGenRuntime error from mod 'settlements' in callback environment_OnGenerated(): ...k1asw/blb/minetest/bin/../mods/settlements/utils.lua:35: attempt to index a nil value
2018-07-17 11:14:21: ERROR[Main]: stack traceback:
2018-07-17 11:14:21: ERROR[Main]: 	...k1asw/blb/minetest/bin/../mods/settlements/utils.lua:35: in function 'find_surface'
2018-07-17 11:14:21: ERROR[Main]: 	...k1asw/blb/minetest/bin/../mods/settlements/utils.lua:220: in function 'determine_heightmap'
2018-07-17 11:14:21: ERROR[Main]: 	...ok1asw/blb/minetest/bin/../mods/settlements/init.lua:77: in function '?'
2018-07-17 11:14:21: ERROR[Main]: 	...ok1asw/blb/minetest/bin/../builtin/game/register.lua:419: in function <...ok1asw/blb/minetest/bin/../builtin/game/register.lua:399>
Edit: I found another bug. When the farming redo mod is disabled but the MTG's farming is on, it might still generate stuff from farming redo like melon slices or corn in chests.
Thank you for testing. I fixed both bugs with the latest commits.

User avatar
Hume2
Member
Posts: 709
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: [Mod] Settlements [settlements]

by Hume2 » Post

Now it works fine. I have another screenshot for your collection :)
Image
Attachments
screenshot_20180717_144209.jpg
screenshot_20180717_144209.jpg (115.32 KiB) Viewed 4127 times
If you lack the reality, go on a trip or find a job.

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

Re: [Mod] Settlements [settlements]

by Rochambeau » Post

Replaced my own routine of height detection, because it was too slow. The mod uses the official heightmap now, though it seems a little buggy.
I often get heightmaps consisting of purely -31000 or other values that are impossible. I'm trying to filter those buggy heightmaps.

cdu13a
New member
Posts: 1
Joined: Sat Jan 03, 2015 03:10

Re: [Mod] Settlements [settlements]

by cdu13a » Post

Nice work. It's been enjoyable wandering around looking for villages.
Image
Image

One little problem however. Using settlements with some other mods like say a mod like lower crossroads viewtopic.php?f=9&t=19036. Settlements will place buildings in the middle of the roads. While I do like that the villages often appear near/straddling roads, it would be nice if when placing a building that settlements could check if the nodes it was being placed on is_ground_content or not, and then move the building over a bit if it's not. that way we can play a bit nicer with other mods structures.
Attachments
Screenshot_20180720_122801.jpg
Screenshot_20180720_122801.jpg (146.83 KiB) Viewed 4127 times
Screenshot_20180720_122251.jpg
Screenshot_20180720_122251.jpg (209.07 KiB) Viewed 4127 times

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Post

This settlement was cut off at a height of about 31 (most likely mapchunk border):
Image
Rochambeau wrote: Found a way to create some gravel paths:
The gravel paths are a very nice addition and look good from above. Trouble is that it's not easy (sometimes close to impossible) to actually navigate them. I wonder if the same algorithm used for pathfinding for mobs might help here. In combination with the mob claiming to be able to jump no higher than 1 block and be afraid of jumps of more than 1 block, it might almost work. Still, for a good paths network, stairs and slabs are necessary.
Rochambeau wrote: Replaced my own routine of height detection, because it was too slow. The mod uses the official heightmap now, though it seems a little buggy.
I often get heightmaps consisting of purely -31000 or other values that are impossible. I'm trying to filter those buggy heightmaps.
That usually indicates that height at that point cannot be determined. You may be looking at a mountain peak whose base is in the mapchunk below. Or there might be no ground in this mapchunk at all.
cdu13a wrote: Settlements will place buildings in the middle of the roads. While I do like that the villages often appear near/straddling roads, it would be nice if when placing a building that settlements could check if the nodes it was being placed on is_ground_content or not, and then move the building over a bit if it's not. that way we can play a bit nicer with other mods structures.
That'd certainly be nice - but might also be a lot of work and may not even work out in the end. Such things are very critical regarding order of modifications and which functions are used.

I've made some progress with my analysis of the heightmap regarding detection of hills and holes. Individual ones can now be distinguished from each other. I've still got to find a way to deal with holes in a hill and vice versa.
Attachments
settlements_top_missing.jpg
settlements_top_missing.jpg (183.69 KiB) Viewed 4127 times
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 » Post

Sokomine wrote:This settlement was cut off at a height of about 31 (most likely mapchunk border)
Hm, I guess I need to find a way to force load neighboring chunks.

Some other problem I stumbled upon migrating to LuaVoxelManip:
My subroutine to calculate pos on circles around the settlement center (cos, sin) sometimes gave me coordinates with decimal places (p6.x = 132.9956, p6.y = 8, p6.z = 1085.6584). When I fed tose coordinates to LVM, I got some strange results.
While

Code: Select all

s = minetest.get_node_or_nil(p6).name
gave me "air"

Code: Select all

local vi = va:index(p6.x, p6.y, p6.z)
local tmp = minetest.get_name_from_content_id(data[vi])
told me it found default:stone.

As a solution, I rounded the coordinates to to full int and the results where consistent. So I guess LVM and minetest.get_node_or_nil handle coordinates with digital places in different ways.

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Settlements [settlements]

by Krock » Post

Donating my 4000th post to this cute new mod.
I also did some testing and found this town right next to the spawn in my custom Lua mapgen world:
Image
Attachments
screenshot_20180721_140609.jpg
screenshot_20180721_140609.jpg (543.6 KiB) Viewed 4127 times
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests