[Mod] Erosion [1.0][erosion]

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

[Mod] Erosion [1.0][erosion]

by Chiu ChunLing » Sun Oct 30, 2016 08:48

Okay, so this is a mod I'm working on that basically is intended to make the surface look a little less blocky on slopes and such, as well as adding some dirt/sand/gravel pile effects. It uses moreblocks and the moreblocks API for this purpose. I've made just enough progress putting it together that I want more feedback on how this is supposed to work. Also modding generally, I guess.

Anyhow, other than adding in what was strictly necessary to get things working (like adding falling blocks of the various materials that get eroded) I also changed all the default dirt blocks (and their eroded slope varients) to make them fall. Between that and the way things get eroded at pretty much the slightest excuse, it's overall a bit harder to play (though you can walk around without needing to jump nearly so much, which is somewhat nice). I'm hoping to eventually make the slope formation rules generate better looking terrain, right now it's still pretty very...angular looking. Generally pretty walkable, but not as visually appealing as I want (Edit: I'm probably not going to get the terrain generation looking too much better than it is now...it already feels like I'm pushing my luck with performance).

Edit: I forgot to mention that the loose dirt/sand/gravel you collect can be crafted back into full blocks (Four of them make one block of the original material, the recipe is shapeless since you can't make anything else with them...you can also place them directly, but they're a bit frustrating to try and use to actually build anything other than a sloped pile). You can also craft sloped cobble into microblocks without needing the exactly corresponding slope, though this results in some lost material. In this version you might notice that there is a noticeable overall loss of the various erosion materials as they fall on each other and stuff, this will never be fixed entirely is normal and expected (the materials being lost are renewable within the mechanics of the mod, and not terribly valuable anyway), but it will hopefully somewhat less obvious in future versions.

This is currently (and probably forever?) a really simple mod, just a depends.txt and an init.lua, available at the Github link below (along with a readme and license, but that has less information than this post). I have no plans to add additional elements, though support for some other mods is possible if that's desired.

Some screenshots of the current results: CurrentImageOldImage
CurrentImageOldImage
CurrentImageOldImage
CurrentImageOldImage

This should be considered an super early version, subject to change, try it out on a new world and don't get too attached because improving the slope formation rules may not apply well to already eroded slopes (I mean, there is a chat command added to the trial version which enables slope generation in existing mapchunks--thanks to help from paramat--but it doesn't do the surface slopes and has an issue when used above ground probably/hopefully they will, but I'm not sure yet, I'm now pretty sure I can't get the voxelmanip to work with anything that's already been generated, but I'm not planning on making any more major changes to it at this point).

Edit: I made some revisions of how the slopes form, it's not perfect but I feel it's better. I also revised the ABMs and stuff...made it so falling dirt/gravel won't make stone and such erode. It's kinda fun to just use loose dirt to make a big dirt pile, though I need some more revisions.

It's been suggested that I alter the map generation and use VoxelManip to do more of the generation without relying on ABMs and LBMs, but this is currently beyond my experience. I think it's a good idea and I'm going to work on that, but it may not happen particularly soon. This most recent version fixes some issues and makes the terrain a little smoother. I now have a working map generation function, but it seems like it might be pretty crude, both in that I don't know a good way to identify where stone is exposed to air other than by checking every node and because the surface terrain is not as smooth as I would like (obviously what I would like would be perfectly simulated reality, probably not going to get there).

I decided that the underwater slopes were more problematical than helpful, they don't really alter gameplay or visual sense and they do impair performance. I might do something with a "surf zone" in the nodes just below water once I figure out how to use minetest.get_mapgen_object() properly...I think I'll go with making it so that the surface layer of water is replaced with flowing water and letting the waves lap against a level beach, but that's all in the future...and probably best handled by a separate mod. For now I just have a few more tweaks.

View or download from Github
Even more experimental version
Outdated early version

The trial version has a chat command "erosion_slope_gen" which generates sloped stone in caves and such for an existing mapchunk (which may not have them due to being generated before the erosion mod was enabled). This requires the user to have the privs noclip, server, and rollback (server and rollback because it can make significant changes to the mapchunk, noclip because otherwise you can totally get trapped). It has an issue I couldn't fix when used at the surface (generates a line of sloped stone hanging in the air) and isn't really necessary.

Note that the code is still super-unlicensed, in case you want to assist me with keeping up my three felonies a day. Turns out that if you create a file called "license.txt" on Github, they provide a selection of template licenses you can use. Among them MIT. Which reminds me, I have been to Boston in the fall...among other things.

License: MIT
Dependencies: default, moreblocks
Optional Dependencies: farming

I'm considering whether it is possible and desirable to add support for some other mods, like Ethereal, which add their own turf blocks. I'm not particularly convinced it is all that necessary. As it is there is a tendency for landslides to start spontaneously and when they are too large they result in significant framerate drops and often large numbers of items which need to be cleaned up by the engine. In fact some players may find it useful to comment out the ABMs (I should provide better comments on what each does, for now it's enough to know that there are four of them and the bottom two are likely to have more impact--one of those is commented out already).
Last edited by Chiu ChunLing on Mon Nov 07, 2016 12:40, edited 14 times in total.
 

User avatar
ErrorNull
Member
 
Posts: 201
Joined: Thu Mar 03, 2016 00:43

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by ErrorNull » Sun Oct 30, 2016 10:45

awesome. i will try this mod and let you know. we have all these slope blocks and its about time we have a mod to generate these on the map to make our world look smoother.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7491
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by azekill_DIABLO » Sun Oct 30, 2016 21:23

wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwooooooooooooooooooooooooooooooooooooooooooo!

ok that enough. what an awesome mod!
 

User avatar
azekill_DIABLO
Member
 
Posts: 7491
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Sun Oct 30, 2016 23:05

Well, I want to have the mechanics down before I mess with making it do the generation. Also, I'm pretty new to this, so I have no experience with making a map generator. Could you be more specific about the nature of the problems you're seeing? I know that all the falling produces a lot of dropped items in places where there is lots of sand or whatever, I've been running around on some islands and things go pretty crazy. It hasn't been crashing, but I do notice.

Anyway, I've fixed a few issues that I probably introduced by fiddling with what I already had.
 

User avatar
ErrorNull
Member
 
Posts: 201
Joined: Thu Mar 03, 2016 00:43

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by ErrorNull » Sun Oct 30, 2016 23:58

i tried the mod and looks cool. as a random idea, did you consider just replacing existing 'edge' blocks with full slope blocks? i notice that your approach is not to replace edge blocks but to add your slope blocks next to the edge blocks.

Also another thing, i noticed that slope block that appear underwater will be tricky issue because its in air blocks.
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Mon Oct 31, 2016 04:59

I decided that the visual issue of partial blocks underwater was mostly worth tolerating, but it can be removed by having erosion only occur to blocks that neighbor air instead of also acting near water. This might reduce the issue with erosion beginning to overflow, too. If you want to try it, just find and replace
Code: Select all
"air","default:water_source"
with
Code: Select all
"air"
in the existing code. I'm still going back and forth on that, there is less gameplay change by having erosion underwater and not really a visual improvement given the partial air block appearance (I can sorta think of it as being like introducing a surf boundary...but not really).

Only replacing edge blocks with 45 degree angle slopes and not having so much material fall could be easier. I wanted a gentler slope (1 in 2) to be definitely easier than a 1 in 1 slope, though. A code that does that should be possible to derive from what I've gotten so far, but it will take more alteration than a simple find/replace, I think I might make something of the sort as a branch or something, if figuring out the voxelmanip objects proves...to be easy or very hard, I'm not sure if there's a good word for when either quality will have the same effect on a decision (dilemma doesn't seem quite right).
 

User avatar
TheReaperKing
Member
 
Posts: 531
Joined: Sun Nov 22, 2015 21:36

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by TheReaperKing » Mon Oct 31, 2016 05:10

Will this eventually be making its way to github? I'm super interested in it and I'd love to see the changes. I'm a super noob but I'm really interested in learning more about map generation.
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Mon Oct 31, 2016 06:30

I am also a noob who is super interested in map generation, so we have that in common. If this reaches a point where I feel safe having it be more generally available won't just wreck people's worlds I'll probably put it on Github (I'd love getting to that point, but right now the code is far from ready for general use, I didn't even realize how many cool possibilities existed with moreblocks slopes until I was wandering around some online servers recently...like for the first time, so I felt all nervous I would do something universally known to to bad and end up kickbanned).
 

User avatar
paramat
Developer
 
Posts: 3524
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by paramat » Mon Oct 31, 2016 07:48

A mod doesn't have to be safe or playable to be on github, it makes it easier for us to browse the code and help out.
I have a simple mapgen mod that only places fine materials with a slope of 45 degrees https://forum.minetest.net/viewtopic.php?f=11&t=8483
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Mon Oct 31, 2016 09:27

Well, that's a point I suppose. I do still need to figure out how to use the map generation functions. Is it okay to use your code as a basis for that?
 

User avatar
azekill_DIABLO
Member
 
Posts: 7491
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by azekill_DIABLO » Mon Oct 31, 2016 10:33

Chiu ChunLing wrote:Well, I want to have the mechanics down before I mess with making it do the generation. Also, I'm pretty new to this, so I have no experience with making a map generator. Could you be more specific about the nature of the problems you're seeing? I know that all the falling produces a lot of dropped items in places where there is lots of sand or whatever, I've been running around on some islands and things go pretty crazy.


no there are tons of falling sands on slopes, on slopes, on blocks, they sweep and fall, generating thousands of bugged entities.
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Mon Oct 31, 2016 11:40

Yes, I've decided to make it so nodes don't erode underwater nor directly into water (falling blocks can still fall into water of course). There weren't any real benefits to doing that compared to the cost. I'm still looking at how to do this on terrain generation with a voxelmanip, it seems like I'd need to use the get/set_param2_data methods, but I don't see any clear explanation of how they work so I'm going to have to monkey see/do it for a bit. Of course that won't involve placing the falling material, though in the case of soft terrain I'd like to place the appropriate half slopes to create a smooth appearance where possible.

I think I'm starting to figure out what this voxelmanip stuff is all about, but I'll still need a bit to make anything with it, let alone what I'm wanting.
 

User avatar
paramat
Developer
 
Posts: 3524
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by paramat » Tue Nov 01, 2016 06:55

> Is it okay to use your code as a basis for that?

Of course, most of my mods are proof-of-concept examples for others to fork, learn from etc.
For get / set param2 see my flexrealm mod https://github.com/paramat/flexrealm/blob/master/init.lua#L192
It's fairly simple to add in param2 manipulation if you're already using a lua voxelmanip for content ids.
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Tue Nov 01, 2016 07:47

Thanks. I'm not *already* using a voxelmanip but I think I have a grasp of how to write one. Still makes me a bit nervous. I think the first thing I'll do is something that just puts torches or something on top of the terrain.
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Tue Nov 01, 2016 08:38

Okay, I wrote an on_generated function that places torches just above the top of the terrain. If I'm doing anything spectacularly stupid here, let me know (I already discovered that the param2 data did not get set to zero, so all the torches were floating upsidedown rather than attached to the blocks under them, which was hilarious when I broke one...since I need to edit the param2 data anyways, that will serve as a good next step). I'm mainly concerned about "oh, yeah, what you're doing in this step will eventually cause all those mapblockchunks to be erased/laggy/purple" etc. (there was a bit of lag when I broke one of the torches, but I'm already planning on fixing that).
Code: Select all
minetest.register_on_generated(function(minp, maxp)--function that affects generated mapblockchunks
   if maxp.y < 2 or minp.y > 256 then return end
   local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")--we get the voxelmanip objects
   local data = vm:get_data()-- array of raw node data (node content ids) read from the vm object
   local vxa = VoxelArea:new{MinEdge=emin, MaxEdge=emax} --
   local heightmap,hndx = minetest.get_mapgen_object("heightmap"),1--heightmap and index
   local erdng_ids,slope_ids,air_id,torch_id = {},{},minetest.get_content_id("air"),minetest.get_content_id("default:torch")
   for k,v in pairs(eroding_nodes) do erdng_ids[minetest.get_content_id("default:"..k)] = k end
   for k,v in pairs(erosion_materials) do
      for s,_ in pairs(slopes) do slope_ids[k..s] = minetest.get_content_id("erosion:slope_"..k..s) end
   end
   for z=minp.z,maxp.z do--traverse z coordinates
      for x=minp.x,maxp.x do--traverse x coordinates
         local vpos = vxa:index(x,heightmap[hndx], z)--get the index for the surface node at this x and z
         if erdng_ids[data[vpos]] and data[vpos+vxa.ystride] == air_id then--the id was loaded in erdng_ids and the node above is air
            data[vpos+vxa.ystride] = torch_id--set that air block to be a torch
         end
         hndx = hndx+1--continue traversing the heightmap
      end
   end
   vm:set_data(data)--set altered data to the vm
   vm:calc_lighting()--recalculate lighting
   vm:write_to_map(data) --save altered data in vm
end)


Okay, so torches are wall mounted rather than facing. But the important thing is that now I know how to do a Voxelmanip, so hurray! The bad news is that I'm going to have to figure out an algorithm for deciding on what direction any slopes I place should face and I can't use the one I've already got, so boo! That's okay, it was a pretty quick and dirty solution anyway, hopefully I can do better with something that I only need to do on loading the map chunks.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7491
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Wed Nov 02, 2016 15:13

Okay, so I kinda hit a wall with doing the logic for the surface slopes and so I tackled the (for me) easier problem of applying angled surfaces to most exposed stone to give a less blocky appearance to caves and cliffs and stuff. And I came up with this.
Code: Select all
minetest.register_on_generated(function(minp, maxp)--function that affects generated mapblockchunks
   if minp.y > 256 then return end
   local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
   local data,prm2 = vm:get_data(),vm:get_param2_data()
   local vxa = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
   local erdng_ids,slope_ids,dpstn,cube3,box,vpos = {},{},{},{},{}
   for k,v in pairs(slopes) do dpstn[k] = minetest.get_content_id("moreblocks:slope_stone"..k) end
   dpstn.stone,dpstn.air = minetest.get_content_id("default:stone"),minetest.get_content_id("air")
   for x=-1,1 do cube3[x]={} for y=-1,1 do cube3[x][y]={}
      for z=-1,1 do cube3[x][y][z]=x+y*vxa.ystride+z*vxa.zstride end
   end end
   for k,v in pairs(eroding_nodes) do erdng_ids[minetest.get_content_id("default:"..k)] = v[2] end
   for k,v in pairs(erosion_materials) do
      for s,_ in pairs(slopes) do slope_ids[k..s] = minetest.get_content_id("erosion:slope_"..k..s) end
   end
   for vpos=vxa:index(minp.x,minp.y,minp.z),vxa:index(maxp.x,maxp.y,maxp.z) do
      if data[vpos] == dpstn.air then
         box.w = data[vpos+cube3[-1][0][0]] == dpstn.stone
         box.e = data[vpos+cube3[1][0][0]] == dpstn.stone
         box.d = data[vpos+cube3[0][-1][0]] == dpstn.stone
         box.u = data[vpos+cube3[0][1][0]] == dpstn.stone
         box.s = data[vpos+cube3[0][0][-1]] == dpstn.stone
         box.n = data[vpos+cube3[0][0][1]] == dpstn.stone
         box.t = (box.w and 1 or 0)+(box.e and 1 or 0)+(box.d and 1 or 0)+(box.u and 1 or 0)+(box.s and 1 or 0)+(box.n and 1 or 0)
         if box.t == 2 then
            box.f = box.d and box.n and 0
            or box.d and box.e and 1
            or box.d and box.s and 2
            or box.d and box.w and 3
            or box.u and box.n and 20
            or box.u and box.w and 21
            or box.u and box.s and 22
            or box.u and box.e and 23
            or box.w and box.s and 7
            or box.e and box.n and 9
            or box.w and box.n and 12
            or box.e and box.s and 18
            or -1
            if -1<box.f then data[vpos],prm2[vpos] = dpstn[""],box.f end
         elseif box.t == 3 then
            box.f = box.d and box.n and box.w and 0
            or box.d and box.e and box.n and 1
            or box.d and box.s and box.e and 2
            or box.d and box.w and box.s and 3
            or box.u and box.n and box.e and 20
            or box.u and box.w and box.n and 21
            or box.u and box.s and box.w and 22
            or box.u and box.e and box.s and 23
            or -1
            if -1<box.f then data[vpos],prm2[vpos] = dpstn._inner_cut,box.f
               if box.u and data[vpos+cube3[0][-1][0]] == dpstn.air then
                  data[vpos+cube3[0][-1][0]],prm2[vpos+cube3[0][-1][0]] = dpstn._outer_cut,box.f
               end
            end
         end
      end
   end
   vm:set_data(data)--set altered data to the vm
   vm:set_param2_data(prm2)--set altered param2 data
   vm:calc_lighting()--recalculate lighting
   vm:write_to_map(data) --save altered data in vm
end)
Keep in mind that this is functional but not properly finished, in that I declare a good number of tables that I'm not actually using yet. So, here's the thing. This code iterates over the entire voxelmanip object checking every single node to see if it's air that touches stone on two or three sides so as so justify the placement of a slope to smooth the edges. It does work, which I thought was very cool, but it seems a bit slow. I'm going to be using the heightmap again when I do the surface slopes (and I hope the logic I use here can help me do that) but I do still want to do the angled stone for caves and so I'm wondering if there isn't some kind of algorithm that will allow me to skip to the air blocks to make this faster.

It's not critical to making further progress, the stone smoothing function currently works whether or not I can optimize it further, and the surface processing can use the height to largely avoid this problem, but I'm still curious. Cause iterating over every single node seems dumb.

Edit: Also, unrelated but also a question, what is the most appropriate license for Minetest mods? I've seen several, and I'm not particularly in the habit of providing a license with anything I write, so I'm pretty open to suggestions as long as they seem appropriate to the community at large.
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Thu Nov 03, 2016 11:21

At this point the mod is functional and I've started using it with my other mods. It's relatively lightweight in many ways, but I think that all the angled surfaces does decrease the framerate a bit, when you're looking at an expanse of terrain and cliffs from the top of a hill or whatever.

Currently, the mod uses a lot of 45 degree slopes for the voxelmanip map generation pass, which is not what I had initially planned but proved easier than developing logic for reliably placing more different types of half slope nodes. The erosion mechanics still create the half slopes where opportunities present. The trial branch (which I'm using) has a couple of abms that cause looser material which has fallen on harder slopes to move down if possible...this is functional but usually looks a little weird when it happens nearby.

Anyway, for development to proceed much further I need feedback on some things. 1:1 slopes yeah or nay? Loose material sliding off of hard slopes good or bad? Stone smoothing worth the performance cost or not? If so, worth extending to other types of stone (currently it only operates on the basic stone, not any other variants)?

Naturally feedback on the code itself and ways to improve functionality and performance are much desired as well. Also, as I feel that I've run out of features I'm definitely committed to implementing (that I'm sure I can figure out), I've no real objection to releasing this as a working mod at this point.

Though I guess I should pick a license for it. Suggestions on that are still open as well.
 

User avatar
paramat
Developer
 
Posts: 3524
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by paramat » Thu Nov 03, 2016 14:25

For a license with no restrictions many used to use WTFPL, but now in Minetest Game we use MIT instead as it gives you legal protection and avoids unnecessary expletives which could stop your mod being used in schools etc.
https://github.com/minetest/minetest_game/blob/master/mods/beds/license.txt

For a license with more restrictions i use LGPL 2.1 as Minetest engine does.
https://github.com/paramat/planets/blob/master/license.txt

For media (textures, models, sounds) CC licenses are better, CC BY-SA 3.0, CC BY 3.0, CC0 etc.
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Fri Nov 04, 2016 03:14

Sounds legit. So I just post this in "license.txt" on Github, right?

I'm also trying to find out how to apply the on_generated function to existing mapchunks, so I can convert a world I've already got. It would be nice if this can be implemented conditionally so it only happens once, but if not I can just comment it out once I've converted my existing world.
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Fri Nov 04, 2016 19:02

The trial branch has improved on_generate functionality, but slower performance (not major, but noticeable when first starting a world). It also has an abm and lbms that are currently commented out. I think that I'll remove the lbm's now that the on_generate function is working, and the abm was an experiment that didn't really work out.
 

User avatar
D00Med
Member
 
Posts: 942
Joined: Sat Feb 07, 2015 22:49
Location: Australia...somewhere
GitHub: D00Med
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: [Mod]Erosion: uses Moreblocks to apply angled terrain

by Chiu ChunLing » Sat Nov 05, 2016 01:02

At this point I'm in need of feedback as to whether there are any significant problems with the Trial branch that are not evident in the master branch, as I'd like to put the changes into the master and focus on an algorithm to use the voxelmanip function on existing mapchunks to convert an existing world (or at least selected parts of it).
 

User avatar
paramat
Developer
 
Posts: 3524
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: [Mod]Erosion

by paramat » Sat Nov 05, 2016 10:55

For examples of mods properly licensed see the mods in MTGame.

> I'm also trying to find out how to apply the on_generated function to existing mapchunks, so I can convert a world I've already got. It would be nice if this can be implemented conditionally so it only happens once,

To use the lua voxelmanip on existing world it obviously can't be in 'on generated'.
Instead of using the "mapgen object voxelmanip" (which is simply a copy of the core voxelmanip in it's state tmmediately after core mapgen), you need to read data from the map.
Here's a good example https://github.com/paramat/watershed/bl ... t.lua#L739
Note the 'vm:' stuff at the end is different too.
This lua mapgen has a single mapgen function used 'on generated', but also used after generation for re-generating an existing part of the world (by chat command).

lbms happen once only on existing world, but are per-mapblock.
Perhaps you could use lbms in this way: If the co-ordinates of the lbm mapblock show it is at the minimum corner of a mapchunk (all co-ordinates being '-32 + n * 80' where 'n' is an integer) then re-generate the whole mapchunk?
 

Next

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 5 guests