villages [WIP]

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Fri Aug 23, 2013 21:45

On generated is automatic, faster and more reliable, but also down to chance, i can't see away around that ... perhaps i should add that option in too *is good idea*.

Doing stuff on generated is more reliable because the whole chunk is freshly generated ... there is little chance of bugs other than the cavegen griefing bug.
I may be able to work with perlin noise to automatically choose a good location ... not in a desert, not out at sea ... now looking into it.
Last edited by paramat on Sat Aug 24, 2013 04:40, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
Neuromancer
Member
 
Posts: 793
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Sat Aug 24, 2013 16:14

Please add the land flattening feature (using one of the land flattening mods?) and auto spawning of villages. That way I can just install the mod and wander into villages. Some npcs would be a nice addition as well.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Sun Aug 25, 2013 01:57

Flatten mod version 0.1.2 released https://forum.minetest.net/viewtopic.php?id=6959
Now has ellipses of any proportion, irrigation water under flat area in normal biomes, and a choice of flattening on generated chunk or by chat command.

No automatic searching of a suitable location yet ... that's the next challenge.
Last edited by paramat on Sun Aug 25, 2013 02:08, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Mon Aug 26, 2013 21:41

Sokomine, underground irrigation and the unbroken fields it enables gave me the idea for a 'crop circle' mod, crop squares? Yes i will make crops mysteriously flatten in the night into square shapes.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

anonymoushamster
New member
 
Posts: 1
Joined: Tue Aug 27, 2013 01:53

by anonymoushamster » Tue Aug 27, 2013 01:56

moderror: failed to load and run C:/Minetest/t/bin/./mods/villages-master/init.lua
Check debug.txt for details

O.o

I'm sort of... new and an idiot... I don't understand this.
 

User avatar
Mossmanikin
Member
 
Posts: 599
Joined: Sun May 19, 2013 16:26

by Mossmanikin » Tue Aug 27, 2013 02:13

anonymoushamster wrote:moderror: failed to load and run C:/Minetest/t/bin/./mods/villages-master/init.lua
Check debug.txt for details

O.o

I'm sort of... new and an idiot... I don't understand this.


If you rename the folder "villages-master" to "villages" everything should work.
See https://forum.minetest.net/viewtopic.php?id=6450

Noob 4 life!
My stuff
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

by philipbenr » Tue Aug 27, 2013 03:29

philipbenr wrote:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    -- thanks to sfan5 for this advanced code that reads the size from schematic files
    local read_s16 = function(fi)
        return string.byte(fi:read(1)) * 256 + string.byte(fi:read(1))
    end
    local function get_schematic_size(f)


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
10:32:09: ERROR[main]: ServerError: LuaError: error: ...- Copy\bin\..\games\minetest_game\mods\villages\init.lua:289: bad argument #1 to 'byte' (string expected, got nil)


This is an error I got. I'm thinking "What the..." :\ help please?


does anyone know how to fix? I really love this mod, and want to have it.
"The Foot is down!"
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Wed Sep 04, 2013 19:39

Sokomine, flatten mod 0.3.0 is released https://forum.minetest.net/viewtopic.php?id=6959
Not much more to do before i write the vmanip version, i will release 0.3.1 soon with a bugfix and wheatfield option. Optional irrigation water is now hidden inside a 3 node thick layer of stone under 2 nodes of sand / dirt. The flat area is now 3 chunks = 240 nodes across.
Please could you let me know if there is anything else that is essential for using this mod with villages?
Last edited by paramat on Wed Sep 04, 2013 19:41, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Sat Sep 07, 2013 19:29

Last edited by paramat on Sat Sep 07, 2013 19:30, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
qwrwed
Member
 
Posts: 323
Joined: Sun Jul 22, 2012 20:56
In-game: qwrwed or Nitro

by qwrwed » Sun Oct 13, 2013 16:47

When trying to use this on sfan5's latest build, I get this error:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
17:41:15: ERROR[main]: ServerError: LuaError: error: ...netest-0.4.7-2170c99-win32\bin\..\mods\villages\init.lua:289: bad argument #1 to 'byte' (string expected, got nil)

Near the beginning of the debug.txt, there is this as well:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
error:...inetest-0.4.7-2170c99-win32\bin\..\builtin/serialize.lua:168: attempt to index local 'sdata' (a nil value)
error:...inetest-0.4.7-2170c99-win32\bin\..\builtin/serialize.lua:168: attempt to index local 'sdata' (a nil value)

Which only appeared after I installed animalmaterials and plants_lib. The first error appears whether I have the dependencies installed or not.
Last edited by qwrwed on Sun Oct 13, 2013 16:47, edited 1 time in total.
 

User avatar
THEGGABOOK77
Member
 
Posts: 140
Joined: Wed Jul 10, 2013 22:17

by THEGGABOOK77 » Sun Oct 13, 2013 18:54

Amazing, and very very informated. |:-)
190.31.223.213 : 30000 Is my Modern House server (Creative) And Totally Free
Join Now!
My Stuff
MY MODS: City Elements-Funny Signs
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Mon Nov 11, 2013 08:13

Uniflat mod may interest you Sokomine https://forum.minetest.net/viewtopic.php?id=7701
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Fri Dec 27, 2013 18:41

I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Sun Aug 17, 2014 04:35

Sokomine, here's a modified version of mg_villages that uses spawner nodes, abm and the non 'mapgen object' voxelmanip, hopefully no griefing by mudflow or cavegen, needs further testing.
This is not a fork, just the mod folder stored in my 'wieldhand' repo https://github.com/paramat/wieldhandsam2/tree/master/mg_villages
Edits:
mapgen.lua: edited 'on generated' function and 'place villages via voxelmanip' function, added abm on spawner node
nodes.lua: new village spawner node
 

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

Re: villages [WIP]

by Sokomine » Sun Aug 17, 2014 20:52

paramat wrote:Sokomine, here's a modified version of mg_villages that uses spawner nodes, abm and the non 'mapgen object' voxelmanip, hopefully no griefing by mudflow or cavegen, needs further testing.

Thank you! I've had put that off for now due to other things needing fixing first. The environment of the villages is not quite in the state I wish it to be yet. Your code will certainly come in handy once it's time to generate more..stable...and less griefed villages. I hope to reach that point soon.

Btw, mg_villages is not a direct continuation from my villages mod here. It just aims at the same thing and uses similar algorithms, although there are differences in detail. mg_villages (based on Nores village mapgen, not on mine) will be the more versatile soulution to the problem, while these villages here solve the medieval village problem slightly better. Perhaps it might eventually be time to rename this mod here and give that villages namespace over to mg_villages.
A list of my mods can be found here.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Tue Aug 19, 2014 22:51

I'm just posting this here because you don't have a mg_villages topic.
My edited version had a problem, the spawner nodes were placed at chunk centres, since ABM range is 32 nodes by default players often could not get close enough to trigger the spawners and generate the village because there is a huge vertical wall there at the chunk border. This is why it only worked with 'active block range' increased to 3+ in minetest.conf.
Now solved by using 4 spawner nodes per mapchunk, placed at each mapchunk corner, no need for a non-default active block range. I have also added a basic WIP terrain blend. My version is found here stored in my wieldhand repo https://github.com/paramat/wieldhandsam2 All edited or added code is marked between '-- PM v' and '-- PM ^', there are 4 spawner nodes in nodes.lua and i have edited and added various functions in mapgen.lua.
Last edited by paramat on Mon Aug 25, 2014 06:57, edited 1 time in total.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: villages [WIP]

by Krock » Wed Aug 20, 2014 18:12

paramat wrote:I'm just posting this here because you don't have a mg_villages topic.

Interesting but your villages mod has the same problem:
+ "Error log :)"
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Thu Aug 21, 2014 00:04

No idea i don't get that error.
 

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

Re: villages [WIP]

by Sokomine » Thu Aug 21, 2014 12:22

paramat wrote:I'm just posting this here because you don't have a mg_villages topic.

That's ok. I was mostly explaining this to other readers who might not be aware that there are two similar mods, one still under construction :-)

paramat wrote:My edited version had a problem, the spawner nodes were placed at chunk centres, since ABM range is 32 nodes by default players often could not get close enough to trigger the spawners and generate the village because there is a huge vertical wall there at the chunk border. This is why it only worked with 'active block range' increased to 3+ in minetest.conf.
Now solved by using 4 spawner nodes per mapchunk, placed at each mapchunk corner, no need for a non-default active block range. I have also added a basic WIP terrain blend. My version is found here stored in my wieldhand repo https://github.com/paramat/wieldhandsam2 All edited or added code is marked between '-- PM v' and '-- PM ^', there are 4 spawner nodes in nodes.lua and i have edited and added various functions in mapgen.lua.

Thank you! I've downloaded your version some time ago and taken a short look, eventually even figured out the meaning of the -- PM comments. Perhaps it might be possible to work with one spawner node instead of 4. There's param2 which is also easy enough to access inside the abm. But that's not the most urgent for now.

Your terrain blend is also very nice and will improve the villages immensly.

Currently, the main problem I'm facing before I may integrate your code is the problem of how to determine village height. Very large villages work well with a low random value or even 0 or 1 as they cover enough terrain to hit some ocean or lake somewhere. The smaller the village, the more odd such a low height may look. I've written a small function to analyze the height of the terrain at the border of the village (the inside is of no intrest), but there I'm facing a major problem: The current chunk may hold only a tiny fraction of the village border, and each chunk will arrive at a diffrent conclusion at which height might be optimal.

Krock wrote:Interesting but your villages mod has the same problem:

I've no idea why windows builds have trouble reading that particular file. As those buildings concerned will only work with Mauvebics mm2 modpack (which you're not particulary likely to have installed), just comment out all "canadian" buildings in the list of buildings in buildings.lua
A list of my mods can be found here.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Thu Aug 21, 2014 19:33

LOL there's a bordello as one of the Canadian buildings =)
One spawner node using param2, good idea will do this.
The terrain blend will be non-linear soon and larger, and as in my flattening mods i'll mix in some un-blended cliffs as well. A larger blend area might solve some of your problems of villages isolated in a hole because there will be a walkable slope down to a village that looks like it is in a natural depression. I will also make blending work when the surrounding terrain is lower.
Analyzing the surrounding terrain height in multiple mapchunks could be done by recreating mapgen v6 'elevation at point' in lua, complex but possible. However, if the terrain blend is large enough you may be able to leave all villages near sea level, as villages tend to be built in natural depressions for reasons of shelter, so i'll get working on terrain blend to see if we can avoid the complex solution.
 

twoelk
Member
 
Posts: 1092
Joined: Fri Apr 19, 2013 16:19

Re: villages [WIP]

by twoelk » Thu Aug 21, 2014 21:12

and I was dreaming of villages on some floatlands

...
Windmill, Windmill for the land.
Turn forever hand in hand
...
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Mon Aug 25, 2014 07:06

Sokomine, i updated my version with partial terrain blend that leaves some cliffs, also any trees removed are replanted as saplings, in this repo as before https://github.com/paramat/wieldhandsam2. I suggest making the largest villages have a ground height of at least y = 2, as being at sea level looks weird. All changes are in 'flatten_village_area' function, some content ids added, the rest in the flattening section. Will next add a narrow border cliff to hide the village and irrigation layers being visible when surrounding terrain is lower than the village.
 

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

Re: villages [WIP]

by Sokomine » Mon Aug 25, 2014 20:56

paramat wrote:Sokomine, i updated my version with partial terrain blend that leaves some cliffs, also any trees removed are replanted as saplings, in this repo as before https://github.com/paramat/wieldhandsam2.

Thank you! I've integrated it. It looks way better than before!

paramat wrote:Will next add a narrow border cliff to hide the village and irrigation layers being visible when surrounding terrain is lower than the village.

The irrigation layer has been removed. Normal soil and desert sand soil does run abs - which might not be such a good idea if the fields cover a relatively large area. I've introduced two fake nodes for that purpose - nodes that look exactly like wet soil/wet desert sand soil, buch which are entirely passive. They do not turn dry without water (thus no need for irrigation), and they don't have abms running for changing anything.

Adjusting terrain height for those regions that are lower than the village area has become even more important than before. Before, I took several ground nodes and copied them upward in case of too low ground in order to raise it. That proved to be very problematic if said ground already contained spawned village buildings. For now, the village ground is just one node thick. Which looks very odd at the borders.

The newest version has been pushed to github, and I'd appreciate test reports. I hope that griefings from cavegen and mudflow are now stopped inside the village area.
A list of my mods can be found here.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Tue Aug 26, 2014 01:38

Terrain blending doesn't work now when the original terrain is lower than the village, don't yet know why. The village is a 1 node thick platform floating above the original terrain with a big gap below it.
As far as i can tell there's no cave griefing or mudflow inside the village border (but it's hard to find stone in the buildings, don't know where to look). There are mudflow ridges on the blended terrain.
There are a few floating jungletree roots above the village.
However compared to my version it generates the village sooner and is visually cleaner because it's on-generated.
No lighting glitches.

EDIT
I spawned high above the village and fell to the village level, possibly enough to kill a player if damage was enabled. This message appeared in terminal 'CHANGING HEIGHT from 39 to 8'.
 

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

Re: villages [WIP]

by Sokomine » Tue Aug 26, 2014 02:42

paramat wrote:Terrain blending doesn't work now when the original terrain is lower than the village, don't yet know why. The village is a 1 node thick platform floating above the original terrain with a big gap below it.

That is as expected. My previous flattening code just searched for a ground node, and, when found, just copied the nodes below that ground node to the new ground height. Everything below that node was copied to a position equally far below the new ground node. This worked well for normal terrain but lead to ghost-buildings (or part thereof) in the stone below the village if that part of the village had already been generated by a neighbouring chunk. In that case, the roofs where taken as ground nodes, and the buildings copied to the ground. For now, I've changed it so that only the topmost ground node is searched and becomes the new village ground node at that spot. There are small errors there (i.e. wood from a building beeing taken as new ground). As that's not critical and may even make the village more intresting, it may remain.

Filling the gap below the dish-shaped village will then have to be done with some appropriate nodes (perhaps just stone/desert_stone).

Your terrain blending works very fine already if the terrain is higher than the village. Now, if you add the same for terrain that is lower, things will improve further.

paramat wrote:As far as i can tell there's no cave griefing or mudflow inside the village border (but it's hard to find stone in the buildings, don't know where to look). There are mudflow ridges on the blended terrain.

Wood is also griefed by cavegen (don't ask me why - tree trunks I understand, but wood?). Mudflow ridges on the blended terrain are ok I think. They even work pretty well there. If you want to do some experiments, change the if( false ) to true in line 642 of mapgen.lua. That ought to toggle cavegen griefing and mudflow on and off. At least it does for me. I don't know how reliable it will be in the end.

paramat wrote:There are a few floating jungletree roots above the village.

So far, I've only seen leaves in the process of decaying. Guess I need to add more air above the village.

paramat wrote:However compared to my version it generates the village sooner and is visually cleaner because it's on-generated.
No lighting glitches.

Those lighting glitches where caused by my faulty search for height. Which was caused by lack of knowledge about how mapgen worked. Hmmms explanations helped a lot.

paramat wrote:I spawned high above the village and fell to the village level, possibly enough to kill a player if damage was enabled. This message appeared in terminal 'CHANGING HEIGHT from 39 to 8'.

That falling is something I'll have to fix.

The next step will be to handle smaller villages where the height really has to be determined from the sourrounding terrian. That won't work with on_generated.
A list of my mods can be found here.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Tue Aug 26, 2014 03:54

Sokomine wrote:Your terrain blending works very fine already if the terrain is higher than the village. Now, if you add the same for terrain that is lower, things will improve further.

Terrain blend works fine for lower terrain in my version, and should work in your version too, i can't yet see why it doesn't.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Wed Aug 27, 2014 02:50

I saw you had been busy and tried latest commit 'f9b...', very impressive and no issues. I like the extended roads and am amazed how you managed to overcome cave and mudflow griefing while still using 'on generated'. I'm going to take a break from this but will keep my version in my repo for reference if needed.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Thu Sep 11, 2014 02:41

I have a problem with mg-villages, many villages are surrounded by a completely solid wall of jungletrees, and there is a jungletree sapling placed on every node in the terrain blend area, since sapling spawn is now done in lua, i can't get anywhere near without server meltdown.

Other than that the new version is awesome, perhaps you could start a thread for it soon since it is certainly useable?
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Thu Sep 11, 2014 03:00

So here are my edits for a version that is compatible with latest 'pathv6alt'.

In mapgen.lua the range of chunks searched is increased to 40 for more chance of spawning in a village. I only changed this because i kept spawning outside villages:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function spawnplayer(player)
   local noise1 = minetest.get_perlin(12345, 6, 0.5, 256)
   local min_dist = math.huge
   local min_pos = {x = 0, y = 3, z = 0}
   for bx = -40, 40 do
   for bz = -40, 40 do
      local minp = {x = -32 + 80 * bx, y = -32, z = -32 + 80 * bz}
      for _, village in ipairs(mg_villages.villages_at_point(minp, noise1)) do
         if math.abs(village.vx) + math.abs(village.vz) < min_dist then
            min_pos = {x = village.vx, y = village.vh + 2, z = village.vz}
            min_dist = math.abs(village.vx) + math.abs(village.vz)
         end
      end
   end
   end
   player:setpos(min_pos)
end

In villages.lua i increased chance to 400/400 for testing, because junctions between the 2 chosen paths are fairly rare, this could perhaps be reduced a little in future:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
mg_villages.VILLAGE_CHANCE = 400

Also in villages.lua here is the new start of 'villages at point'. I have added 2 perlin noises here, so 'noise1' is no longer used:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
mg_villages.villages_at_point = function(minp, noise1)
   if not is_village_block(minp) then return {} end
   local noiseb = minetest.get_perlin(-8017, 4, 0.4, 2048)
   local noisec = minetest.get_perlin(300707, 5, 0.4, 4096)
   local vcr, vcc = mg_villages.VILLAGE_CHECK_RADIUS, mg_villages.VILLAGE_CHECK_COUNT
   -- Check if there's another village nearby
   for xi = -vcr, vcr, vcc do
   for zi = -vcr, 0, vcc do
      if xi ~= 0 or zi ~= 0 then
         local mp = {x = minp.x + 80*xi, z = minp.z + 80*zi}
         local pi = PseudoRandom(mg_villages.get_bseed(mp))
         local s = pi:next(1, 400)
         local x = pi:next(mp.x, mp.x + 79)
         local z = pi:next(mp.z, mp.z + 79)
         if s <= mg_villages.VILLAGE_CHANCE
         and math.abs(noiseb:get2d({x = x, y = z})) <= 0.02
         and math.abs(noisec:get2d({x = x, y = z})) <= 0.01 then
            return {}
         end
      end
   end
   end
   local pr = PseudoRandom(mg_villages.get_bseed(minp))
   if pr:next(1, 400) > mg_villages.VILLAGE_CHANCE then
      return {} -- No village here
   end
   local x = pr:next(minp.x, minp.x + 79)
   local z = pr:next(minp.z, minp.z + 79)
   if math.abs(noiseb:get2d({x = x, y = z})) > 0.02
   or math.abs(noisec:get2d({x = x, y = z})) > 0.01 then
      return {}
   end


The villages now spawn only at the junctions of paths b and c, path c is one of the two 5 wide paths. Spawn locations can be changed by using different combinations of path noise parameters.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: villages [WIP]

by paramat » Thu Sep 11, 2014 03:12

Image


Image


Two lucky alignments.
Last edited by paramat on Fri Sep 12, 2014 03:20, edited 1 time in total.
 

PreviousNext

Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 4 guests

cron