Post your mapgen questions here (modding or engine)

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

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

by FaceDeer » Post

This is only kinda-sorta a mapgen question, but I think it's relevant since it focuses on the behaviour of minetest.emerge_area.

I've written a few mods that I would like to have continue to perform actions in a region even after all players have left. Specifically, I was wanting to allow a digtron to be able to continue digging off into the wild black yonder without the player who set it in motion having to ride it, and I wanted to be able to place a block that would keep dynamic_liquid's abm running in the local area so that I wouldn't have to wait around for a large pool of liquid to finish draining away. It was a backburnered desire, though, until Rubenwardy posted the "forceload anchor" mod in the content database. Its brief description sounded like exactly what I wanted, though not quite in the form that I wanted, so I sat down and implemented my own version that's got an API and is designed to be safe to use on a server with an arbitrary number of players all placing forceload anchors down willy-nilly. Near as I can tell it functioned perfectly, but then when I actually tried using it to accomplish what I had created it for it didn't work at all. Digtron hit the usual "ignore" blocks when it tried running amuck and ABMs don't appear to run in forceloaded areas.

Then I added a bit of code to Digtron to call minetest.emerge_area whenever it ran into "ignore" blocks and that solved everything without any need for forceload. Digtron could run for kilometers without hesitation. I'm guessing that emerge_area will make ABMs run as well.

So my questions are:
  • What does minetest.forceload_block actually do?
  • How frequently should I call minetest.emerge_area on a region in order to keep its ABMs running, if this is indeed the correct approach in the first place?
I've already got a robust framework for a global timeslice-sharing system to keep players from bogging down the server or hogging all the time for themselves, so if all I need to do is call minetest.emerge_area every X seconds that should be easy to add to what I've already written. But I want to make sure I'm not wasting resources on something silly and the documentation doesn't say much about the nuts and bolts of these API calls. I'm guessing the server_unload_unused_data_timeout setting is relevant?

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

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

by paramat » Post

'emerge_area' doesn't run ABMs, ABMs only run within 48 nodes of any player (radius controlled by 'active block range' setting).

I'm no expert on forceloading but i expect it makes the server load a block and keep it loaded, if the block is not generated it probably does not generate it, as you experienced. I'm unsure if a forceloaded block runs ABMs within it.
Last edited by paramat on Sat Jun 23, 2018 19:42, edited 1 time in total.

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

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

by rubenwardy » Post

Surely ABMs - active block modifiers - run on any active block including those made active by emerge_area?
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

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

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

by paramat » Post

I could be wrong, but an emerged area seems different to an active area. 'Emerge area' can be applied to huge volumes and they are generated, if ABMs were run in the whole volume MT wouldn't cope.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

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

by FaceDeer » Post

I've since modified my code to repeatedly "emerge" the forceloaded regions as well, mod can be found here if anyone's interested. It doesn't seem to cause ABMs to run either.

Forceload and emerge seem to be the only potential leads I've come across in the API documentation. Anyone know of any other possibilities for getting ABMs to run when a player isn't nearby? I hope I'm not going to have to investigate having actual script-controlled players spawning in and teleporting around for this, that seems tremendously hacky.

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

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

by hajo » Post

FaceDeer wrote:other possibilities for getting ABMs to run when a player isn't nearby?
Basic-machines have a clock-generator that activates every 5 seconds,
and with the machines-priv, it should run even without nearby players.

But I'm not sure how to test that...

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

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

by FaceDeer » Post

hajo wrote:
FaceDeer wrote:other possibilities for getting ABMs to run when a player isn't nearby?
Basic-machines have a clock-generator that activates every 5 seconds,
and with the machines-priv, it should run even without nearby players.

But I'm not sure how to test that...
I've been testing by using a super-simple ABM defined for a unique block type that causes a chat message to be sent once per second. I place the unique block down, then walk far away and see if I continue getting the chat message sent to me once the region the block is in is out of my active player range.

I don't think the basic_machines:clockgen will help, it appears it actually uses an ABM to generate its once-every-five-seconds machine activation call. Line 1423 of mover.lua appears to be the spot where the magic is happening. If a player walks away from a clockgen block I would expect it to stop triggering until another player approaches.

Edit: Just did some experimenting and it looks like basic_machines:clockgen is actually broken in its current form. The ABM definition has:

Code: Select all

	neighbors = {""},
Which means it only runs when the clockgen block is next to a block with the name "" (of which there are none, of course). I think the author intended it to be

Code: Select all

	neighbors = {},
Which makes it run regardless of neighbors. I'll file an issue. Anyway, as I expected even when I fix the neighbors parameter the clockgen ABM stops working when I travel far enough away from it.

SilverSea
New member
Posts: 8
Joined: Mon Jun 25, 2018 23:08

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

by SilverSea » Post

I am having difficulty generating sea grass in water. Here is my mapgen.lua code, I basically copy and pasted stuff from the default mine_test mod and edited it. But I'm obviously missing something, in desperation I tried to add seagrass to the jungles just to see if it would work at all which it didn't.

Or if you could point me to a tutorial that explains how to add plants that would work too. I can't watch videos and I can't listen to audio so the tutorial would basically need to be text.

Code: Select all

function magicmod.register_decorations()

	minetest.register_decoration({
		deco_type = "simple",
		place_on = {"default:dirt_with_rainforest_litter"},
		sidelen = 16,
		fill_ratio = 0.1,
		biomes = {"rainforest"},
		y_min = 1,
		y_max = 31000,
		decoration = "magicmod:seagrass_1",
	})
	--Sea Grass
	minetest.register_decoration({
		deco_type = "simple",
		place_on = {"default:dirt"},
		noise_params = {
			offset = -0.15,
			scale = 0.1,
			spread = {x = 100, y = 100, z = 100},
			seed = 7012,
			octaves = 3,
			persist = 1,
		},
		biomes = {
			"desert_ocean",
			"savanna_ocean",
			"rainforest_ocean",
		},
		y_min = -8,
		y_max = -2,
		decoration="magicmod:seagrass_1"
		flags = "place_center_x, place_center_z",
		rotation = "random",
	})

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

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

by paramat » Post

The 'place_center_x, place_center_z' flags and 'rotation' are for 'schematic' type decos only, they are invalid for 'simple' type decos.
What you need is the 'force placement' flag to make the deco replace water.
Have you studied the docs? See https://github.com/minetest/minetest/bl ... .txt#L5765
Note which parameters are valid for 'simple' type decos.
There is no dirt in desert ocean and dirt doesn't extend down to y = -8 in the other 2 biomes, you need to add 'sand' to your 'place on'.
You can use

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

Hello guys! i need help with a mod called FireRealm. it would be kinda like HybridDog's Nether mod.
Nodes:
Rackstone
Magma
Rackstone with Fire Grass
Fire grass
Fire Tree
Fire Leafs
Fire Tree Saplings
Fire Web
And your ideas:)
Levels:
Firerealm top - A wavy top of Rackstone with coal block and fire web hanging off of it.
Firerealm 2nd level - A wavy top of Rackstone with fire web hanging off of it
Magma sea - a sea of magma and rackstone islands in it
And your ideas:)
Misc:
Floating islands
And your ideas:)
Help
MapGens
And what you can help with:)
Thx all:)
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

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

by hajo » Post

StarNinjas wrote:i need help with a mod called FireRealm
What have you already done?
Link for download / github ?
What already works, what is the problem ?

You need to be more specific then 'need help'.

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

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

by TumeniNodes » Post

StarNinjas wrote:Hello guys! i need help with a mod called FireRealm. it would be kinda like HybridDog's Nether mod.
Nodes:
Rackstone
Magma
Rackstone with Fire Grass
Fire grass
Fire Tree
Fire Leafs
Fire Tree Saplings
Fire Web
And your ideas:)
Levels:
Firerealm top - A wavy top of Rackstone with coal block and fire web hanging off of it.
Firerealm 2nd level - A wavy top of Rackstone with fire web hanging off of it
Magma sea - a sea of magma and rackstone islands in it
And your ideas:)
Misc:
Floating islands
And your ideas:)
Help
MapGens
And what you can help with:)
Thx all:)
Why is this posted in this section?
A Wonderful World

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

I haven't do anything yet it's mostly an idea. Isn't this where is should be posted? Parkway told be a while back that this is where it need to be posted.
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

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

by TumeniNodes » Post

I have no idea who Parkway is...
do you have any specific questions related to Mapgen?

Other than that, this would have been better posted in the 'modding discussion' section
A Wonderful World

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

TumeniNodes wrote:I have no idea who Parkway is...
do you have any specific questions related to Mapgen?

Other than that, this would have been better posted in the 'modding discussion' section
Stink it corrected me i meant paramat
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

TumeniNodes wrote:I have no idea who Parkway is...
do you have any specific questions related to Mapgen?

Other than that, this would have been better posted in the 'modding discussion' section
ok
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

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

by TumeniNodes » Post

It's not that you've done anything wrong.
It is that you will get more notice in the modding discussions section for this.

Then, when it gets into the mapgen work, and you have question related to it, post those here.
A Wonderful World

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

TumeniNodes wrote:It's not that you've done anything wrong.
It is that you will get more notice in the modding discussions section for this.

Then, when it gets into the mapgen work, and you have question related to it, post those here.
Alrighty
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

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

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

by paramat » Post

Hi StarNinjas. Indeed i did direct you here in a PM but only for 'specific questions'.
You already have a suitable 'help needed' topic here viewtopic.php?f=47&t=19871

If you want to make a mapgen mod then you have to learn how to code it, it's unlikely anyone will want to write it for you, which is what your topic seems to be asking for. Start by studying and editing mapgen mods that are similar to what you want to do. Your intention is quite advanced so lots of learning and modding needs to be done first.

I like my new name 'parkway' :)

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

paramat wrote:Hi StarNinjas. Indeed i did direct you here in a PM but only for 'specific questions'.
You already have a suitable 'help needed' topic here viewtopic.php?f=47&t=19871

If you want to make a mapgen mod then you have to learn how to code it, it's unlikely anyone will want to write it for you, which is what your topic seems to be asking for. Start by studying and editing mapgen mods that are similar to what you want to do. Your intention is quite advanced so lots of learning and modding needs to be done first.

I like my new name 'parkway' :)
ok thanks for the tips parkway. also as a dev can you move my topic to modding discussion? if not ill ask ruben
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

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

by amadin » Post

.
Last edited by amadin on Wed Dec 18, 2019 19:11, edited 1 time in total.

User avatar
StarNinjas
Member
Posts: 411
Joined: Wed Mar 14, 2018 00:32
GitHub: starninjas
IRC: StarNinjas
In-game: J1
Location: Terrarca
Contact:

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

by StarNinjas » Post

amadin wrote:How to make the generation of lakes with lava from -20 as it was in the old versions of the game. For me, it's so much more interesting to play than to look for a river of lava in caves. And the second question. How to make caves horizontal (+ \ - 10 blocks up or down)?
ok thx
Don't go to bed tonight, without knowing what would happen if you died. https://thegospelfilm.org/

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

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

by paramat » Post

StarNinjas, amadin was not addressing you.

amadin. do you mean how sometimes you would find lava caves in deep water in mgv6? Mgv6 hasn't been changed so i assume you want the same in mgv7 and the more recent mapgens?
In MT 5.0.0 i have added 2 new parameters to all non-mgv6 mapgens:

Code: Select all

#    Y of upper limit of large caves.
#    type: int
# mgv7_large_cave_depth = -33

#    Y of upper limit of lava in large caves.
#    type: int
# mgv7_lava_depth = -256
You can then set both to y = -33 or maybe even 47 to have lava caves much closer to the surface.

For more horizontal tunnels in non-mgv6 mapgens alter the noise params and stretch the 'spread' X, Z values to make the tunnel structure more horizontal. For example in mgv7 add this to .conf:

Code: Select all

mgv7_np_cave1 = 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0
mgv7_np_cave2 = 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0
These are the default values. The noise 'spread' is the (61, 61, 61) and (67, 67, 67) so perhaps double or triple the X and Z values of each. For example doubled:

Code: Select all

mgv7_np_cave1 = 0, 12, (122, 61, 122), 52534, 3, 0.5, 2.0
mgv7_np_cave2 = 0, 12, (134, 67, 134), 10325, 3, 0.5, 2.0
That's the closest you can get to what you want. In mgv6 you can't alter the tunnel structure.

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

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

by amadin » Post

Thanks

Chiantos
Member
Posts: 377
Joined: Sun Jan 15, 2017 09:04

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

by Chiantos » Post

Deleted message
Last edited by Chiantos on Mon Sep 30, 2019 06:47, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests