Post your mapgen questions here (modding or engine)

Icalasari
Member
Posts: 166
Joined: Tue Sep 23, 2014 05:29
IRC: Icalasari
In-game: Icalasari

Re: Post your mapgen questions here (modding or engine)

by Icalasari » Post

Is there a way to fix the light after generation? Best I can find is fix_light but that requires defining a specific area. Namely, the Starlight Stone nodes in my post above aren't lighting the area as they should until a new light source is placed by them

User avatar
Skamiz Kazzarch
Member
Posts: 613
Joined: Fri Mar 09, 2018 20:34
GitHub: Skamiz
In-game: Skamiz
Location: la lojbaugag.

Re: Post your mapgen questions here (modding or engine)

by Skamiz Kazzarch » Post

You can use a VoxelManip to recalculate the light in newly generated terrain.
https://github.com/minetest/minetest/bl ... .txt#L4290

Code: Select all

* `calc_lighting([p1, p2], [propagate_shadow])`:  Calculate lighting within the
  `VoxelManip`.
    * To be used only by a `VoxelManip` object from
      `minetest.get_mapgen_object`.
    * (`p1`, `p2`) is the area in which lighting is set, defaults to the whole
      area if left out or nil. For almost all uses these should be left out
      or nil to use the default.
    * `propagate_shadow` is an optional boolean deciding whether shadows in a
      generated mapchunk above are propagated down into the mapchunk, defaults
      to `true` if left out.

Code: Select all

minetest.register_on_generated(function(minp, maxp, blockseed)
	local vm = minetest.get_mapgen_object("voxelmanip")
	-- vm:set_lighting({day = 0, night = 0})
	vm:calc_lighting()
	vm:write_to_map()
end)
I think this should do it? If there are still artifacts you can try to uncomment the 'set_lighting' line, which might help, or it might not. I think there was some gotcha there, but I don't know what it was right now.

Icalasari
Member
Posts: 166
Joined: Tue Sep 23, 2014 05:29
IRC: Icalasari
In-game: Icalasari

Re: Post your mapgen questions here (modding or engine)

by Icalasari » Post

Unfortunately it didn't work (unless I misunderstood and have to configure it some first? At least I'm starting to catch myself on that now XD)

arisunz
New member
Posts: 2
Joined: Mon Jul 25, 2022 00:04
In-game: arisunz

Re: Post your mapgen questions here (modding or engine)

by arisunz » Post

I'm just getting started with modding and I'm toying with the idea of a subnautica-like game, so far I'm raising the water level on the v7 mapgen and I kinda like how it looks, but I'm wondering if there's any way to "flood" caves too?

Basically, if I don't want any air pockets anywhere under water level, how should I go about it?

I guess I can straight up disable caves, but I want to avoid that if possible

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Post your mapgen questions here (modding or engine)

by sirrobzeroone » Post

arisunz wrote:
Mon Jul 25, 2022 00:12
...
minetest.register_on_generated() would be easiest I think:
https://minetest.gitlab.io/minetest/min ... -functions

simply change all "air" to whatever your water node is below level y == watertop.

I think this example from hamlet will cover what you need - worth reading the replies above from others as well in this thread :):
viewtopic.php?p=292933#p292933

You'll need to insert a y height check which may mean a little more loop work but otherwise I think the above should work out the box so to speak for you :).

arisunz
New member
Posts: 2
Joined: Mon Jul 25, 2022 00:04
In-game: arisunz

Re: Post your mapgen questions here (modding or engine)

by arisunz » Post

sirrobzeroone wrote:
Mon Jul 25, 2022 00:58
arisunz wrote:
Mon Jul 25, 2022 00:12
...
minetest.register_on_generated() would be easiest I think:
https://minetest.gitlab.io/minetest/min ... -functions

simply change all "air" to whatever your water node is below level y == watertop.

I think this example from hamlet will cover what you need - worth reading the replies above from others as well in this thread :):
viewtopic.php?p=292933#p292933

You'll need to insert a y height check which may mean a little more loop work but otherwise I think the above should work out the box so to speak for you :).
Ah, sweet!

Code: Select all

minetest.register_on_generated(function(minp, maxp, blockseed)
    if minp.y < WATER_LEVEL then
        for x = minp.x, maxp.x do
            local limit
            if maxp.y > WATER_LEVEL then
                limit = WATER_LEVEL
            else
                limit = maxp.y
            end

            for y = minp.y, limit do
                for z = minp.z, maxp.z do
                    local pos = {x=x, y=y, z=z}
                    local node = minetest.get_node(pos)
                    if (node.name == "air") or (node.name == "nodes:water_flowing") then
                        minetest.set_node(pos, {name="nodes:water_source"})
                    end
                end
            end
        end
    end
end)
There's probably some dumb indexing error hiding somewhere but overall this seems to do the trick! Thank you so much!

robbieradiant
New member
Posts: 3
Joined: Thu Aug 11, 2022 16:36
GitHub: robbieradiant
IRC: sonicSnap + robbieradiant
In-game: sonicSnap
Contact:

Re: Post your mapgen questions here (modding or engine)

by robbieradiant » Post

does anyone know how Tutorial has the same default world for every world? i've checked the files but I'm still not quite sure, I've seen people say schematics but then stop there. could someone point me in the direction of doing this myself in a game?

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: Post your mapgen questions here (modding or engine)

by sirrobzeroone » Post

robbieradiant wrote:
Thu Aug 11, 2022 16:50
does anyone know how Tutorial has the same default world for every world? i've checked the files but I'm still not quite sure, I've seen people say schematics but then stop there. could someone point me in the direction of doing this myself in a game?
I just looked at the files and Definitely schematics. Check under minetest_tutorial>>mods>>tutorial_mapgen. init.lua is quiet interesting seems to load schematics to a list of reference points if my quick skim of the code is accurate.

Rubenwardy also seems to have an example of doing this here:
https://github.com/CERN/CTW/blob/develo ... ge.lua#L34
from
viewtopic.php?t=25901

you can also do this by loading premade map - heres one thread:
viewtopic.php?t=27678

and link to BB's mod that does this:
https://github.com/Buckaroobanzay/modgen

Hope that helps with a little more info and potential solutions - Good Luck

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Post your mapgen questions here (modding or engine)

by Blockhead » Post

robbieradiant wrote:
Thu Aug 11, 2022 16:50
does anyone know how Tutorial has the same default world for every world? i've checked the files but I'm still not quite sure, I've seen people say schematics but then stop there. could someone point me in the direction of doing this myself in a game?
If you'd checked the forum thread of Tutorial, or the game's README files, you would have found your answer without needing to ask.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: Post your mapgen questions here (modding or engine)

by Grubler » Post

I can't make a post so soon since my last one, so here I ask, what do you think the layers of rock under a minetest world may look like? And how would a person go about adding things to the world generation to make things work a bit more like how things on earth might be like? Perhaps I am interested in somewhat of a more "realistic" mining experience.

IsaFag
New member
Posts: 2
Joined: Wed Oct 26, 2022 22:07

Re: Post your mapgen questions here (modding or engine)

by IsaFag » Post

Hi, I'm trying to make a mod that would make small worlds of 4000 x 2000 x 4000 (x, y, z) nodes. I've searched this forum for weeks now and I can't find an exact answer to my question :
Is there is a parameter I can use to specify a smaller world size to Minetest while using the singlenode terrain generator?
The mod would be about living in a small space habitat (thus me trying to have a small map size).
If there is no such parameter in Minetest, do you know of any other way I can achieve this? I've seen a post about putting a barrier of hard to destruct blocks to limit the player into an area. But if it's possible to limit the world size, I would prefer that to having a barrier.
English is a second language, which may not help in me trying to find what I'm looking for, so a kind answer would be very appreciated.

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Post your mapgen questions here (modding or engine)

by Blockhead » Post

IsaFag wrote:
Wed Oct 26, 2022 22:19
Hi, I'm trying to make a mod that would make small worlds of 4000 x 2000 x 4000 (x, y, z) nodes. I've searched this forum for weeks now and I can't find an exact answer to my question :
Is there is a parameter I can use to specify a smaller world size to Minetest while using the singlenode terrain generator?
The mod would be about living in a small space habitat (thus me trying to have a small map size).
If there is no such parameter in Minetest, do you know of any other way I can achieve this? I've seen a post about putting a barrier of hard to destruct blocks to limit the player into an area. But if it's possible to limit the world size, I would prefer that to having a barrier.
English is a second language, which may not help in me trying to find what I'm looking for, so a kind answer would be very appreciated.
Hi,

It's definitely possible to limit the generated size of a world with just a setting. Mapgen -> Map generation limit can do this for you. This will prevent anyone moving or placing nodes past that edge as well. However, it only operates on a single number which is a maximum distance in every direction away from 0,0,0 and so 4000 x 2000 x 4000 isn't quite possible. In combination with that setting, you will have to use a type of barrier block like the one from Mineclone2, then write a mapgen callback (an example) to fill the space outside of the desired play area with barrier blocks when it is generated.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

IsaFag
New member
Posts: 2
Joined: Wed Oct 26, 2022 22:07

Re: Post your mapgen questions here (modding or engine)

by IsaFag » Post

Thanks for all this information, it is exactly what I need to get started. I will make do with a 4000 nodes world in all directions. It's still ok for my concept.

Slightly
Member
Posts: 37
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: Post your mapgen questions here (modding or engine)

by Slightly » Post

Can I specify settings like mg_biome_np_heat inside my biome mod instead of having to make sure it is done separately in the general settings? If so, how? I feel like this is probably an obvious thing but I'm new to MT modding and have not been able to figure it out so far.

Second question: which mg setting determines how much hotter/colder from the defined temp and how much dryer/wetter from the defined humidity the biomes will place? As in which number is the range from those defined values you can expect to see the biome placed in?

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Post your mapgen questions here (modding or engine)

by Blockhead » Post

Slightly wrote:
Tue Nov 15, 2022 21:43
Can I specify settings like mg_biome_np_heat inside my biome mod instead of having to make sure it is done separately in the general settings? If so, how? I feel like this is probably an obvious thing but I'm new to MT modding and have not been able to figure it out so far.
Yes you can override the player's mapgen settings and either force them to constants you decided or include the option to configure them from your own mod's settings. Here is a little example of forcing the heat noiseparams to having a scale of 150 (never use print in production code obviously, replace with minetest.log usually):

Code: Select all

local set = minetest.get_mapgen_setting_noiseparams("mg_biome_np_heat")
print(dump(set))
set.scale = 150
minetest.set_mapgen_setting_noiseparams("mg_biome_np_heat", set, true)
set = minetest.get_mapgen_setting_noiseparams("mg_biome_np_heat")
print(dump(set))
lua_api.txt references:
minetest.set_mapgen_setting_noiseparams
Settings interface
Slightly wrote:
Tue Nov 15, 2022 21:43
Second question: which mg setting determines how much hotter/colder from the defined temp and how much dryer/wetter from the defined humidity the biomes will place? As in which number is the range from those defined values you can expect to see the biome placed in?
The exact ranges are based on the entire set of biomes running in the game including all the base game's biomes if not unregistered, plus those of your mapgen mod. Each biome is a heat and humidity value and for each voxel the distance to all registered biomes is measured and the closest biome selected. This is visualised through a Voronoi diagram, which you can use Admidsttest to view. That program comes with several presets but you can also write up your own biome definitions into it, plus it also shows you what your world's landmass and biomes will look like. So you should try to place your biomes as close to the centre of where you want them on the Voronoi.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Slightly
Member
Posts: 37
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: Post your mapgen questions here (modding or engine)

by Slightly » Post

Blockhead wrote:
Wed Nov 16, 2022 03:29
Yes you can override the player's mapgen settings...

So you should try to place your biomes as close to the centre of where you want them on the Voronoi.
This was very clear and helpful, thank you. I've got the biomes blending fairly well and showing up grouped in ways that feel fairly natural, but I'm still occasionally getting small patches of biomes I don't want randomly in the middle of others where i feel they shouldnt be. I'm still working on definitions or settings that will eliminate that. I'll study this answer. Thank you again!

User avatar
mr_chicken
Member
Posts: 37
Joined: Sat Sep 07, 2019 07:18
GitHub: root
IRC: Doris Day
In-game: Faded_Glory Rex_2000
Location: Here
Contact:

Re: Post your mapgen questions here (modding or engine)

by mr_chicken » Post

Hello.

I have this crazy idea...

Map the entire planet of minetest, aka use emerge to generate map blocks.
I've got 1Tb under /var for this and i'm at 15.6%, it occupies 15Gb so 120-125 Gb i guess ...

The thing is, i'm at 15.6% after running (in parts) /emerge_area 0,-32,0 30927,100,19000

Any tips and tricks to speed things up?

Like doing 2% and then let the server rest for 30 minutes in a loop

Edit: Oh yea, it seems to slow down after working a few hours, Intel Dual Channel 2ghz, 8 gig mem.
Playing minnoye ispytaniye on a Агат II, driving a Лaдa that goes 300 hectares on a single tank of kerosene

User avatar
Midnight
Member
Posts: 168
Joined: Sun Dec 19, 2021 13:56
GitHub: MidnightPhantom
IRC: Dragon
In-game: Dragon_Abysss
Location: Dehradun, India

Re: Post your mapgen questions here (modding or engine)

by Midnight » Post

I have a question, How can I spawn a boundary block near lava preventing lava to fall.

User avatar
Skamiz Kazzarch
Member
Posts: 613
Joined: Fri Mar 09, 2018 20:34
GitHub: Skamiz
In-game: Skamiz
Location: la lojbaugag.

Re: Post your mapgen questions here (modding or engine)

by Skamiz Kazzarch » Post

If you hold on for a while I will write you a mod for it, because I just realized that I also want that.
Do you want to block just lava or all liquids?

Edit: here you go.
no_cave_spill.zip
(450.62 KiB) Downloaded 40 times
It places a stone basin around all underground liquid sources like so:
screenshot_20221204_163134.png
screenshot_20221204_163134.png (398.15 KiB) Viewed 2261 times
Works for all games which define a "mapgen_stone". aka most of them.

I really should have done this sooner, because the way liquids spill almost infinitely in Minetest annoys me to no end. So thank you for the idea.

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: Post your mapgen questions here (modding or engine)

by ShadMOrdre » Post

Skamiz Kazzarch,

You should add this as a mod to the mods section. I'm sure others will also find it useful.


Shad

User avatar
Skamiz Kazzarch
Member
Posts: 613
Joined: Fri Mar 09, 2018 20:34
GitHub: Skamiz
In-game: Skamiz
Location: la lojbaugag.

Re: Post your mapgen questions here (modding or engine)

by Skamiz Kazzarch » Post

I hereby declare that the no_cave_spill mod provided above is WTFPL.

There. Now you can publish it yourself, if you think it's worth it.

Personally I don't think so, since making a proper mod topic seems like more effort then creating the mod in the first place.
I might publish it properly as part of a modpack with my other QOL mods at some point in the future, but that really isn't guaranteed in any way.

User avatar
debiankaios
Member
Posts: 910
Joined: Thu Dec 03, 2020 12:48
IRC: debiankaios
In-game: debiankaios Nowe
Location: germany
Contact:

Re: Post your mapgen questions here (modding or engine)

by debiankaios » Post

How to make own map? (please quote, thankyou)

User avatar
Liil
Member
Posts: 127
Joined: Thu Dec 03, 2020 15:29

Re: Post your mapgen questions here (modding or engine)

by Liil » Post

How is it possible to make a underground biome?

I have made several biomes now. But I have problems creating underground biomes.

Replacing underground nodes in caves doesent seem to work, they are still default:stone, even if I make a code with:

flags = "force_placement",
place_offset_y = -1,
is_ground_content = true,

When I create a new biome that is defined to spawn underground, it doesent work. There is only a sandwich-like layer of a few blocks of my new biome that goes trough the defined are. All other blocks are still default:stone.

Whats the trick by letting a underground biome spawn?

Any easy code examples?
cdb_xMf8awymgVmp

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

Re: Post your mapgen questions here (modding or engine)

by TenPlus1 » Post

Check the api.txt file showing how you can add cave decorations using specific flags: https://github.com/minetest/minetest/bl ... .txt#L9179

User avatar
Liil
Member
Posts: 127
Joined: Thu Dec 03, 2020 15:29

Re: Post your mapgen questions here (modding or engine)

by Liil » Post

Thank you very much TenPlus1, this solved the issues I had.

By using:
flags = "force_placement,all_floors",
and
flags = "force_placement,all_ceilings",

I can make my idea work.
cdb_xMf8awymgVmp

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests