Page 1 of 6

[Mod] Villages for Minetest [mg_villages]

PostPosted: Mon Nov 16, 2015 02:27
by Sokomine
The villages for minetest are finally documented, and I think it's time to release them. If you want villages (and/or some lone houses) in your worlds, use this mod. It is a complex mod, and it does contain errors. The code may not exactly act as an example for good code in many areas. Yet the mod is useful. It reaches its full potential in combination with a variety of other mods (cottages, mobf_trader, moresnow, bell, ...).

If you want an easy to use modpack that already includes the most important mods this mod interacts with, get my villages modpack. It'll give you a *lot* more diffrent village types, snow on roofs, traders spawning in the village, and the handle_schematics mod this one depends on. You can combine the modpack with your favorite game.

Image
Extensive documentation can be found in the Wiki.

Download: https://github.com/Sokomine/mg_villages ... master.zip
Browse code: https://github.com/Sokomine/mg_villages
Version: 0.1
Licence: GPLv3
Depends on: handle_schematics, farming, wool and stairs (default)
Recommmends: cottages, moretrees, RealTest, forest, dryplants, cavestuff, moresnow, darkage, ethereal, moreblocks, bell, mobf_trader, docfarming (including farming plusplus), mccompat.

This mod would not have been possible without the works of nore, paramat, hmmm and many others.

Re: villages for Minetest [mg_villages]

PostPosted: Mon Nov 16, 2015 03:42
by benrob0329
Ok, so this adds villages to Minetest? Awesome!

Re: villages for Minetest [mg_villages]

PostPosted: Mon Nov 16, 2015 13:28
by Don
Awesome!
I will try this out today.

Re: villages for Minetest [mg_villages]

PostPosted: Mon Nov 16, 2015 14:12
by twoelk
Hurray !

Re: villages for Minetest [mg_villages]

PostPosted: Mon Nov 16, 2015 17:23
by Krock
Great. This project was long time hidden from most players but now you finally decided to post it here.
Thank you!

Re: villages for Minetest [mg_villages]

PostPosted: Mon Nov 16, 2015 18:01
by KCoombes
Is there a way to reduce how close villages spawn to each other?

Re: [Mod] villages for Minetest [mg_villages]

PostPosted: Mon Nov 16, 2015 18:57
by Sokomine
KCoombes wrote:Is there a way to reduce how close villages spawn to each other?

You can set mg_villages.VILLAGE_CHANCE in mg_villages/config.lua to a lower value (default: 28; minimum: 1; maximum: 400). It's pretty much at the end of the config file. Perhaps I ought to put it in a more prominent place.

Setting mg_villages.INVERSE_HOUSE_DENSITY to a high value (default: 4) reduces the amount of lone houses spawned.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Tue Nov 17, 2015 05:42
by paramat
Excellent work, i'm impressed with the amount of time and effort put into this.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Tue Nov 17, 2015 15:07
by maikerumine
Thank you for all your time, effort, and patience with creating this, Sokomine. This has been, by far, one of my favourite mods ever created for MT. I have been using this mod for over a year now and find it to be a staple in all of my games, it is a MUST HAVE for Minetest!!!

KUDOS!!!

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Fri Nov 20, 2015 16:29
by maikerumine
I found a weird bug:

2015-11-20 11:13:57: ERROR[Main]: mod "village_canadian" has unsatisfied dependencies: "hdb" "nbu"
RESOLVED....
Also, having moreblocks installed created this:
Image


So I removed moreblocks and this popped up, from the army mod:
Image

And it keeps doing this with other mods.

Where in villages is it grabbing a random block and placing it on the ground?

EDIT:

it may be in this:

Code: Select all
               -- the flattened land around the village where wheat, cotton, trees or grass may be grown (depending on village type)
               elseif( vn <= 80 ) then -- see mg_villages.inside_village_area
                  village_area[ x ][ z ] = { village_nr, 1};


Code: Select all
mg_villages.village_area_mark_inside_village_area = function( village_area, villages, village_noise, minp, maxp )
   -- mark the rest ( inside_village but not part of an actual building) as well      
   for x = minp.x, maxp.x do
      if( not( village_area[ x ] )) then
         village_area[ x ] = {};
      end
      for z = minp.z, maxp.z do
         if( not( village_area[ x ][ z ] )) then
            village_area[ x ][ z ] = { 0, 0 };

            local n_rawnoise = village_noise:get2d({x = x, y = z}) -- create new blended terrain
            for village_nr, village in ipairs(villages) do
               local vn = mg_villages.get_vn(x, z, n_rawnoise, village);
               if(     village.is_single_house ) then
                  -- do nothing here; the village area will be specificly marked later on

               -- the village core; this is where the houses stand (but there's no house or road at this particular spot)
               elseif( vn <= 40 ) then -- see mg_villages.inside_village
                  village_area[ x ][ z ] = { village_nr, 6};

               -- the flattened land around the village where wheat, cotton, trees or grass may be grown (depending on village type)
               elseif( vn <= 80 ) then -- see mg_villages.inside_village_area
                  village_area[ x ][ z ] = { village_nr, 1};

               -- terrain blending for the flattened land
               elseif( vn <= 160 and mg_villages.ENABLE_TERRAIN_BLEND) then -- see mg_villages.inside_village_terrain_blend_area
                  if n_rawnoise > -0.5 then -- leave some cliffs unblended
                     local blend = (( vn - 80) / 80) ^ 2 -- 0 at village edge, 1 at normal terrain
                     -- assign a negative value to terrain that needs to be adjusted in height
                     village_area[ x ][ z ] = { village_nr, -1 * blend};
                  else
                     -- no height adjustments for this terrain; the terrain is not considered to be part of the village
                     village_area[ x ][ z ] = { village_nr, 0};
                  end
               end
            end
         end
      end
   end


For some strange reason this fixed itself after I deleted the mg_all_villages.data file Unexplainable.

Image

Maybe my map is somewhat broken???

The village is fixed now.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Fri Nov 20, 2015 19:09
by Sokomine
maikerumine wrote:2015-11-20 11:13:57: ERROR[Main]: mod "village_canadian" has unsatisfied dependencies: "hdb" "nbu"
RESOLVED....

Yes, that's right. The village type canadian consists of very special houses that needs mods from Mauvebic in order to be able to spawn. I considered adding alternative nodes for it, but that wouldn't do the buildings any justice. They're best viewed with Mauvebic's mm2 modpack.

maikerumine wrote:For some strange reason this fixed itself after I deleted the mg_all_villages.data file Unexplainable.

Do you have default:snow in your world? Some randomly selected villages do get a snow cover. If you deleted mg_all_villages.data and recreated the map with the same seed, the village still ought to be mostly the same - except for the snow cover which is selected randomly for some villages and which is not deterministic.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Fri Nov 20, 2015 19:20
by Sokomine
Another node (probably more likely) that might be missing would be farming:wheat_8. That's what the medieval villages grow on their fields.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Mon Dec 07, 2015 20:02
by BBmine
I really like this mod! Thanks.

The only problem is that the chests are all empty. Did I forget to enable a mod?

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Tue Dec 08, 2015 14:59
by maikerumine
BBmine wrote:I really like this mod! Thanks.

The only problem is that the chests are all empty. Did I forget to enable a mod?

Copy and paste the following code in the fill chests lua, over writing the existing code...
Try this:
Code: Select all
--the code that works
-- adapted from the Mines mod

local chest_stuff = {
   {name="default:apple", max = 3},
   {name="farming:bread", max = 3},
   {name="default:steel_ingot", max = 2},
   {name="default:gold_ingot", max = 2},
   {name="default:axe_steel", max = 1},
   --{name="default:emerald", max = 5},
   {name="default:pick_steel", max = 1},
   {name="default:shovel_steel", max = 1},
   {name="default:book", max = 3},
   {name="default:torch", max = 13},
   {name="default:stick", max = 7},
   {name="default:coal_lump", max = 4},
   {name="bucket:bucket_empty", max = 1},
   {name="default:ladder", max = 10},
   {name="default:mese_crystal_fragment", max = 2},
   {name="vessels:glass_bottle", max = 1},
   {name="wool:white", max = 11},
   --{name="carpet:white", max = 11},
   --{name="quartz:quartz_crystal", max = 5},
   --{name="shears:shears", max = 1},
   --{name="crops:melon_seed", max = 18},
   --{name="mobs:saddle", max = 3},
   {name="farming:carrot", max = 3},
   {name="farming:corn", max = 3},
   {name="farming:melon_slice", max = 3},
   {name="farming:potato", max = 3},
   {name="farming:raspberries", max = 3},
   {name="farming:rhubarb", max = 3},
   {name="farming:sugar", max = 3},
   {name="farming:tomato", max = 3},
   {name="farming:seed_wheat", max = 3},
   {name="farming:cucumber", max = 3},
   {name="farming:grapes", max = 3},
}

-- get some random content for a chest
mg_villages.fill_chest_random = function( pos, pr, building_nr, building_typ )
   local meta = minetest.get_meta( pos )
   local inv  = meta:get_inventory()
   inv:set_size("main", 8*4)
   for i=0,pr:next(1,6),1 do
      local stuff = chest_stuff[pr:next(1,#chest_stuff)]
      local stack = {name=stuff.name, count = pr:next(1,stuff.max)}
      if not inv:contains_item("main", stack) then
         inv:set_stack("main", pr:next(1,32), stack)
      end
   end
end


I use it to fill all the chests on the servers. If you dont have tenplus1's farming installed, you can replace the other items if you like.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Tue May 17, 2016 23:16
by StepDevelop
OMG O.o Great mod! For my server is very useful! Thanks, you're a great modder!

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Wed May 18, 2016 19:57
by cimbakahn
I personally don't think that problem is resolved yet. I don't even have that file mg_all_villages.data and i have the message: ERROR[Main]: mod "village_canadian" has unsatisfied dependencies: "hdb" "nbu"

I have 3 files that mentions that file, but that is it:
/home/cimbakahn/.minetest/mods/villages-for-minetest-modpack/mg_villages/buildings.lua
/home/cimbakahn/.minetest/mods/villages-for-minetest-modpack/mg_villages/init.lua
/home/cimbakahn/.minetest/mods/villages-for-minetest-modpack/mg_villages/mapgen.lua

What do you suggest i do?

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Wed May 18, 2016 22:58
by philipbenr
I'll give it a shot. Thanks for all your hard work Sokomine.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Fri May 20, 2016 19:45
by cimbakahn
As to this message:
ERROR[Main]: mod "village_canadian" has unsatisfied dependencies: "hdb" "nbu"
I have scoured google trying to find these mods. I can find nbu at viewtopic.php?f=13&t=2750
Problem is there is no mod to download on the page. And i couldn't find anything at all on hdb.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Fri May 20, 2016 19:56
by Sokomine
cimbakahn wrote:ERROR[Main]: mod "village_canadian" has unsatisfied dependencies: "hdb" "nbu"
I have scoured google trying to find these mods. I can find nbu at viewtopic.php?f=13&t=2750
Problem is there is no mod to download on the page. And i couldn't find anything at all on hdb.

That's right. hdb and nbu are no longer easily available for download. If you don't have an old copy (and some experience), you ought to not use village_canadian. There are plenty of village types that are easier to use. You can even create your own if you want to.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Fri May 20, 2016 22:07
by cimbakahn
It might help if i knew what the letters stood for in hdb and nbu. And which page to find the download. I take nbu stands for nodebox utility, but what does hdb stand for. Is this all some sort of secret or something?

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Fri May 20, 2016 22:36
by cimbakahn
Ok, i now have nbu, but not hdb.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Sat May 21, 2016 01:33
by Sokomine
cimbakahn wrote:It might help if i knew what the letters stood for in hdb and nbu. And which page to find the download. I take nbu stands for nodebox utility, but what does hdb stand for. Is this all some sort of secret or something?

I don't know either. Those mods where created by Mauvebic. He is no longer participating in Minetest and deleted some of his mods some time ago and then couldn't find a backup.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Tue Aug 30, 2016 16:21
by BrandonReese
I pointed this out in another forum so I thought I should post it here. I don't know if this is a known bug or if my copy of mg_villages is screwed up.

I seem to have discovered if you have mg_villages.ENABLE_TERRAIN_BLEND = true; all villages spawn at y=1 or y=2. If you make that false it seems like they spawn at different heights that correspond better to the terrain, but there are also other bugs associated with ENABLE_TERRAIN_BLEND = false such as villages floating on water (you'll have 1 or 2 layers of dirt but then you can swim under the village) and in the mountains I've seen a few villages where the building heights vary and some of the buildings are floating.

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Wed Aug 31, 2016 10:40
by azekill_DIABLO
i've also seen a big house on a 40 blocks high stone tower, flotin over a layer of snow

Re: [Mod] Villages for Minetest [mg_villages]

PostPosted: Sun Sep 18, 2016 19:47
by TheReaperKing
Great villages!!! One thing I noticed is the license isn't in the git repo. Seems like it might be a good idea to have in there.