[Mod] Settlements [settlements]

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

[Mod] Settlements [settlements]

by Rochambeau » Sat Jul 07, 2018 12:18

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
(587.94 KiB) Not downloaded yet
screenshot_small.png
(671.04 KiB) Not downloaded yet
Last edited by Rochambeau on Fri Jul 13, 2018 07:34, edited 2 times in total.
 

User avatar
Stix
Member
 
Posts: 1113
Joined: Fri Aug 04, 2017 14:19
Location: USA
IRC: Stix + Stix_
In-game: Stix

Re: [Mod] Settlements [settlements]

by Stix » Sat Jul 07, 2018 12:46

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.
Depression is a bottomless pit we fall into-and is only passable by death.
Need to know something? "Google it" --GreenDimond
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

User avatar
TenPlus1
Member
 
Posts: 2320
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Settlements [settlements]

by TenPlus1 » Sat Jul 07, 2018 13:39

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: 591
Joined: Thu Oct 13, 2016 10:45
Location: DE

Re: [Mod] Settlements [settlements]

by hajo » Sat Jul 07, 2018 13:57

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: 1113
Joined: Fri Aug 04, 2017 14:19
Location: USA
IRC: Stix + Stix_
In-game: Stix

Re: [Mod] Settlements [settlements]

by Stix » Sat Jul 07, 2018 14:01

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.
Depression is a bottomless pit we fall into-and is only passable by death.
Need to know something? "Google it" --GreenDimond
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

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

R-One
Member
 
Posts: 72
Joined: Wed Dec 20, 2017 23:06

Re: [Mod] Settlements [settlements]

by R-One » Sat Jul 07, 2018 16:23

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: 106
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Sat Jul 07, 2018 18:05

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: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Sun Jul 08, 2018 00:03

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
New member
 
Posts: 2
Joined: Thu Jul 12, 2018 18:03

Re: [Mod] Settlements [settlements]

by Cartmic » Thu Jul 12, 2018 19:20

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?
 

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

Re: [Mod] Settlements [settlements]

by rubenwardy » Thu Jul 12, 2018 20:10

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"
Core Developer | Donate | My Twitter | Mods | Mods 4 Android | Node Box Editor | Minetest Modding Book

Hello profile reader

LgiOxMFYXOqtqVqMPhbw1Bn3oNRvEC7j
 

Cartmic
New member
 
Posts: 2
Joined: Thu Jul 12, 2018 18:03

Re: [Mod] Settlements [settlements]

by Cartmic » Thu Jul 12, 2018 20:33

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.
 

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

Re: [Mod] Settlements [settlements]

by Rochambeau » Fri Jul 13, 2018 07:32

@ 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: 106
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Fri Jul 13, 2018 19:13

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: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Settlements [settlements]

by Sokomine » Sat Jul 14, 2018 21:34

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: 106
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Tue Jul 17, 2018 08:28

Found a way to create some gravel paths:
Image

Still in early stage and much space for improvement. But it works.
Attachments
screenshot.png
(894.22 KiB) Not downloaded yet
 

User avatar
Hume2
Member
 
Posts: 104
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2

Re: [Mod] Settlements [settlements]

by Hume2 » Tue Jul 17, 2018 09:27

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: 870
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] Settlements [settlements]

by texmex » Tue Jul 17, 2018 10:45

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: 106
Joined: Tue Sep 23, 2014 11:37

Re: [Mod] Settlements [settlements]

by Rochambeau » Tue Jul 17, 2018 11:00

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: 104
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2

Re: [Mod] Settlements [settlements]

by Hume2 » Tue Jul 17, 2018 15:13

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

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

Re: [Mod] Settlements [settlements]

by Rochambeau » Thu Jul 19, 2018 07:22

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 » Fri Jul 20, 2018 17:01

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 https://forum.minetest.net/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
(146.83 KiB) Not downloaded yet
Screenshot_20180720_122251.jpg
(209.07 KiB) Not downloaded yet
 

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

Re: [Mod] Settlements [settlements]

by Sokomine » Fri Jul 20, 2018 21:11

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
(183.69 KiB) Not downloaded yet
A list of my mods can be found here.
 

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

Re: [Mod] Settlements [settlements]

by Rochambeau » Sat Jul 21, 2018 10:40

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: 4050
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Settlements [settlements]

by Krock » Sat Jul 21, 2018 12:08

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
(543.6 KiB) Not downloaded yet
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

Next

Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 6 guests