Post your mapgen questions here (modding or engine)

User avatar
duane
Member
 
Posts: 1582
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Tue Sep 12, 2017 03:20

Wuzzy wrote:I did a quick test by teleporting to X, -20000, Z in the minimal subgame. The wieldhand immediately indicated I am in darkness.


I'm not entirely sure I'm following your discourse, but it occurs to me that setting the lighting won't help anyway. The acid test for lighting is what happens when you finish generation and start interacting with the terrain. When I'm having lighting issues, the first thing I do is dig a few nodes in the area and see if the lighting changes. In the past, even when I got an area underground to generate with light, the game would darken the region again as soon as I changed anything.
Believe in people and you don't need to believe anything else.
 

User avatar
Napiophelios
Member
 
Posts: 982
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

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

by Napiophelios » Tue Sep 12, 2017 04:43

paramat wrote:
> Maybe i can make it automatically use the biome stone node,

This is now done https://github.com/minetest/minetest/pull/6185 although it uses the defined biome 'node_stone'. it cannot use a brick variant because a mod or subgame may not have a brick version of the biome 'node_stone'.


This is pretty cool. I had no idea about this.
I got so jazzed when I found an ice dungeon today :)

Minetest has really taken off these last 2 years,
it's way more than just an MC clone anymore.
 

User avatar
Wuzzy
Member
 
Posts: 3610
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

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

by Wuzzy » Wed Sep 13, 2017 17:48

From lua_api.txt:
Code: Select all
         y_min = 1,
         y_max = 31000,
     --  ^ Lower and upper limits for biome.
     --  ^ Because biome is not recalculated for every node in a node column
     --  ^ some biome materials can exceed their limits, especially stone.
     --  ^ For each node column in a mapchunk, biome is only recalculated at column
     --  ^ top and at each of these surfaces:
     --  ^ Ground below air, water below air, ground below water.
     --  ^ The selected biome then stays in effect for all nodes below until
     --  ^ column base or the next biome recalculation.


What is the rationale for this behaviour? I mean that node_stone can exceed way beyond y_min. This makes the Biome API rather unpredictable and it's harder to do stacked biomes.

“Because biome is not recalculated for every node in a node column” → Is this important? I don't think I really understood it.

This test mod (depends on default from Minetest Game) creates wooden planks (as node_stone) down to Y=-32 rather than -10:
Code: Select all
minetest.clear_registered_ores()
minetest.clear_registered_decorations()
minetest.clear_registered_biomes()
minetest.register_biome({
  name = "antistone",
  node_stone = "default:wood",
  y_min = -10,
  y_max = 10,
  humidity_point = 50,
  heat_point = 50,
})



Would it be possible to just make biome algorithm not place anything when Y reaches a height outside of y_min and y_max?

IMO it would make sense to prevent biomes from manipulating any nodes outside the range, it would simplify things a lot and is way more straight-forward.
I can't think of a good rationale why biomes should be allowed to place any nodes outside of that range in the first place.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH
 

User avatar
duane
Member
 
Posts: 1582
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Thu Sep 14, 2017 01:10

Wuzzy wrote:“Because biome is not recalculated for every node in a node column” → Is this important? I don't think I really understood it.

This test mod (depends on default from Minetest Game) creates wooden planks (as node_stone) down to Y=-32 rather than -10:


-32 is a magic number in minetest. That's the bottom of your sea-level layer of chunks. Anytime you see it, a klaxon should go off in your mind.

Mapgens generally calculate biome only once for each XZ location, because that's the quickest and easiest way to do it for a typical map. Height limits are obeyed at ground level. Which is to say, your biome for that chunk's XZ is always whatever it calculates at your highest bit of terrain. They recalculate for each chunk, but usually make the biome the same as it is at ground level (even if it's not in that chunk), because that usually works. You've already found some of the exceptions. Bear in mind that ground level is usually calculated for every chunk, even if it's at Y=-34000.

Edit: See why I started doing all this stuff myself now?
Believe in people and you don't need to believe anything else.
 

User avatar
Wuzzy
Member
 
Posts: 3610
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

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

by Wuzzy » Thu Sep 14, 2017 11:58

This is a technical description but I was more asking for a justification for why the mapgen does the things the way it does.
But whatever, I guess I just use a LuaVoxelManipulator. It isn't hard and I hope it's not wasting too much CPU time.


Next question: Is it bad when I register 100-200 ores? :D
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH
 

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

User avatar
Sergey
Member
 
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

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

by Sergey » Thu Sep 14, 2017 18:44

Wuzzy wrote:Next question: Is it bad when I register 100-200 ores? :D

And how did name them? ore1, ore2, ... ore200?
 

User avatar
duane
Member
 
Posts: 1582
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Fri Sep 15, 2017 03:42

Wuzzy wrote:This is a technical description but I was more asking for a justification for why the mapgen does the things the way it does.
But whatever, I guess I just use a LuaVoxelManipulator. It isn't hard and I hope it's not wasting too much CPU time.


I meant that to be the justification -- it's quick and easy. That's a strong motivation. The noises we use for heat and humidity are 2D. If you really wanted to follow through with 3D biomes, you'd probably want to change them to 3D at some point, which is a lot more load on the cpu. Even just worrying about changing it based on altitude creates more complicated code and eats more processor time for something that most players don't care about. /shrug
Believe in people and you don't need to believe anything else.
 

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

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

by paramat » Fri Sep 15, 2017 23:29

> I did a quick test by teleporting to X, -20000, Z in the minimal subgame. The wieldhand immediately indicated I am in darkness.

I teleported deep and it works for me, the wield does go dark for a second because you are in ignore nodes before the chunk is generated.

> Also, your code doesn't make sense. write_to_map can't take data as an argument, only a boolean

Thanks, data is indeed not needed here, i got that habit from hmmmm's example:
https://forum.minetest.net/viewtopic.php?f=18&t=6396

> How do I know to which biome a particular position belongs to outside of on_generated?

You would need to recreate the noises, biome points and voronoi diagram code in lua, i will add 'getBiomeAtPoint()' before 0.5.0.

> What is the preferred way to read the biomemap mapgen object? All I get is a flat array.

The index to a mapgen object 2D flat array is
(z - minp.z) * zstride + (x - minp.x) + 1
where zstride is chunksize in nodes (default 80).
The +1 may or may not be needed depending on whether the table is indexed from 0 or 1, i think in lua it's indexed from 1.

> Can I grab the v6 tree noise in Lua and use it to place decorations exactly in forests?

Yes. Just 'get' it (or if nil use the default noise params) and use in a lua noise function.
 

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

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

by paramat » Fri Sep 15, 2017 23:44

> What is the rationale for this behaviour? I mean that node_stone can exceed way beyond y_min.

Speed and simplicity.

> “Because biome is not recalculated for every node in a node column” → Is this important?

Yes, if biome was calaculated per node (which is unnecessary) it would have to do so 512000 times per mapchunk, each biome calculation involves calculating the distance to each biome point and choosing the closest.
Instead it calculates biome only when it needs to for each column of nodes, currently it (re)calculates at each upper surface found while working down a node column: 'Ground below air, water below air, ground below water.' so only calculates 1-2 times per node column (there are 6400 node columns).

> it would make sense to prevent biomes from manipulating any nodes outside the range,

Yes ideally, i will work on it.

> Is it bad when I register 100-200 ores? :D

It will slow down mapgen, up to you to find a balance.
 

User avatar
BrunoMine
Member
 
Posts: 1048
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

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

by BrunoMine » Sat Sep 30, 2017 14:18

How to check if a region has changed?
If my mod wants to create a village in a coordinate, how can I check if another mod already built another village in the same place?
 

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

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

by hajo » Sat Sep 30, 2017 18:42

BrunoMine wrote:mod wants to create a village in a coordinate,
how can I check if another mod already built another village

For that, it is probably easiest to count blocks that only occur in buildings,
eg. doors, chests, glass...
 

roboto
Member
 
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

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

by roboto » Sun Oct 01, 2017 16:55

I'm integrating geomoria into Lord of the Test. I had success making it spawn in the lottmapgen; however, I can't seem to make it spawn in a specific biome like Misty Mountains (I don't know how to do this).

Question: How do I make geomoria spawn in Misty mountains only?

P.S. I am new to Lua and want to challenge myself. If you have an answer, turn it into hints--don't give me the whole answer. :)
 

User avatar
duane
Member
 
Posts: 1582
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Mon Oct 02, 2017 06:02

roboto wrote:I'm integrating geomoria into Lord of the Test. I had success making it spawn in the lottmapgen; however, I can't seem to make it spawn in a specific biome like Misty Mountains (I don't know how to do this).

Question: How do I make geomoria spawn in Misty mountains only?

P.S. I am new to Lua and want to challenge myself. If you have an answer, turn it into hints--don't give me the whole answer. :)


That's kind of tricky since biome is set per map column rather than per map chunk, but you can just check the middle of the biomemap for the appropriate biome in mapgen.lua, then call or don't call geomorph(). You'll need the minetest.get_biome_id(biome_name) function as well as the minetest.get_mapgen_object() function.
Believe in people and you don't need to believe anything else.
 

roboto
Member
 
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

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

by roboto » Mon Oct 02, 2017 23:35

I'm getting errors on minetest.get_biome_id being a nil method.

http://dev.minetest.net doesn't have any minetest.get_biome_id in the list of methods.
 

User avatar
Devy
Member
 
Posts: 130
Joined: Sat Jan 21, 2017 02:31
GitHub: CoderForTheBetter
In-game: devy

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

by Devy » Tue Oct 03, 2017 03:39

roboto wrote:I'm getting errors on minetest.get_biome_id being a nil method.

http://dev.minetest.net doesn't have any minetest.get_biome_id in the list of methods.


It is right here in the lua api on github: https://github.com/minetest/minetest/blob/4e19791cde6b203ad853905d8c1481c43004a7ea/doc/lua_api.txt#L2692

Maybe that was recently introduced and it is only available on Minetest 0.5.0-dev?
 

Byakuren
Member
 
Posts: 816
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

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

by Byakuren » Tue Oct 03, 2017 06:10

No, the wiki is just outdated.
Every time a mod API is left undocumented, a koala dies.
 

roboto
Member
 
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

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

by roboto » Fri Oct 06, 2017 02:33

Ok, I have
Code: Select all
  if lottmapgen.lottmapgen_biomes(11) then
    minetest.get_biome_id("iron_hills")
    biomemap = minetest.get_mapgen_object("biomemap")
    geomorph()
  end



And I'm not sure if this is going to work.
 

MommyKat
Member
 
Posts: 38
Joined: Sun Jul 02, 2017 18:02
Location: Let me check my GPS
In-game: MommyKat DrClaw AriaJade

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

by MommyKat » Fri Oct 06, 2017 17:50

Hello all! I am NOT a programmer, just been a player for a few years, but we are trying to develop some more interesting private servers for our kids and their friends, and we (husband and me, he's the computer guy!) are tripping over an issue. I don't know if it's actually a modding issue, or a mapgen issue, feel free to redirect me.
We are trying to use V7 mapgen (because the insane terrain is just awesome!) and moretrees mod, but they don't seem to get along. We can get the moretrees in the inventory, but we can't seem to get them to generate automatically in the biomes. There was something about a plant library dependency, and he fixed that, but it still doesn't work. Help!
"If you don't have a good sense of humor, you're better off dead!" --Roger Rabbit

"Love feels a lot like tomatoes"-Candace Flynn
 

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

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

by TumeniNodes » Fri Oct 06, 2017 21:32

MommyKat wrote:Hello all! I am NOT a programmer, just been a player for a few years, but we are trying to develop some more interesting private servers for our kids and their friends, and we (husband and me, he's the computer guy!) are tripping over an issue. I don't know if it's actually a modding issue, or a mapgen issue, feel free to redirect me.
We are trying to use V7 mapgen (because the insane terrain is just awesome!) and moretrees mod, but they don't seem to get along. We can get the moretrees in the inventory, but we can't seem to get them to generate automatically in the biomes. There was something about a plant library dependency, and he fixed that, but it still doesn't work. Help!


did you install biom_lib? viewtopic.php?f=11&t=12999

also, pay attention to this section of the mod post, I am not sure if it ever was fixed with V7 (actually, just read through all the posts there, and you will probably find any answers you are looking for )

"It is aimed primarily at mapgen v6, and does not use the biome capabilities supplied by mapgen v7 (that will change some day). As such, if used in a mapgen v7 world, it'll work just fine but the temperature and humidity maps will not match up the way you might expect.

On server-exit, biome_lib will "hang" the server for a bit so that it can play out the rest of its deferred-generation log. This process may take a couple of minutes, and is done to prevent areas being left under-populated.

This mod was formerly known as "plants_lib" and used to be included in the Plantlife Modpack."
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am
 

User avatar
duane
Member
 
Posts: 1582
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Sat Oct 07, 2017 04:36

MommyKat wrote:We are trying to use V7 mapgen (because the insane terrain is just awesome!) and moretrees mod, but they don't seem to get along. We can get the moretrees in the inventory, but we can't seem to get them to generate automatically in the biomes. There was something about a plant library dependency, and he fixed that, but it still doesn't work. Help!


It's been a while since I played with more trees, but I seem to remember having to enable most of the trees, as replacements for the stock trees, in the configuration (or in minetest.conf). This was done so that people wouldn't lose the stock trees without warning (although most probably want to). There should be something in the readme file in more trees about that.
Believe in people and you don't need to believe anything else.
 

User avatar
duane
Member
 
Posts: 1582
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

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

by duane » Sat Oct 07, 2017 04:41

roboto wrote:Ok, I have
Code: Select all
  if lottmapgen.lottmapgen_biomes(11) then
    minetest.get_biome_id("iron_hills")
    biomemap = minetest.get_mapgen_object("biomemap")
    geomorph()
  end



And I'm not sure if this is going to work.


That definitely will not work. However, at this point I'm not sure what you intended to do here and how much advice you want, so it's hard for me to advise you.

What I would do is store the return value of get_biome_id, and compare it to one index (xz location) in the biomemap, which you've retrieved. Use an if statement based on that to call geomorph().

+ Spoiler
Believe in people and you don't need to believe anything else.
 

User avatar
v-rob
Member
 
Posts: 684
Joined: Thu Mar 24, 2016 03:19
Location: Right behind you.
GitHub: v-rob
 

roboto
Member
 
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

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

by roboto » Wed Oct 11, 2017 04:33

@duane,

You were unclear about comparing the biome id with the (xz location??) So I took a peek at the spoilers and used set biome = biomemap[location]???? as
local biome = biomemap["-200", "-250"]
-200 is the x coordinate whereas -250 is the z coordinate. That was my assumption of what you meant.

I also put a link between lottmapgen.lottmapgen_biomes(11) and minetest.get_biome_id("iron_hills") because lottmapgen.lottmapgen_biomes(11) was not named "iron_hills" in the lottmapgen mod.
 

roboto
Member
 
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests