Post your mapgen questions here (modding or engine)

User avatar
Wuzzy
Member
Posts: 4046
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 » Post

Doesn't work. I have no idea what I do wrong.

I use get_2d, not get_2d_map. Is this difference important?

Code: Select all

temperature = mgv6_perlin_biome:get_2d({x=player_pos.x + mgv6_np_biome.spread.x*0.6, y=player_pos.z + mgv6_np_biome.spread.y*0.2})
Is there an easy and reliable way to check if my mgv6_perlin_biome outputs correct values? Maybe the bug is somewhere else …

Is PerlinNoise compatible with PerlinNoiseMap or do they output different noises?

It's very difficult to reproduce the core mapgen noise. I have to do everything right perfectly. A single mistake and I get complete garbage data, with no way to debug (or is there?). :-(
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
paramat
Developer
Posts: 3679
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

Here's the point noise code i used in an earlier version of Meru https://github.com/paramat/meru/blob/56 ... it.lua#L96 Maybe try '+ 150' '+ 50' to see if that works (with default mgv6 parameters)?
Note that is old code so uses the old noise parameters (SEEDDIFF, OCTAVES, PERSISTENCE, SCALE).

Code: Select all

         np_biome.spread.x = np_biome.spread.x * (csize + 2 * MAP_BLOCKSIZE)
         np_biome.spread.y = np_biome.spread.y * (csize + 2 * MAP_BLOCKSIZE)
Why multiply spread? It should be unchanged and in nodes.

User avatar
sirrobzeroone
Member
Posts: 191
Joined: Mon Jul 16, 2018 07:56

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

by sirrobzeroone » Post

Still struggling with rivers, they are painful when you don;t particularly want them to be placed to randomly.

Hopefully quick question - On generation I perform some cleanup on my river so it doesn't spill over the edges etc (codes not complete yet but close). However I can find any block thats more negative than the current block I'm replacing usually for reference. However I can't see a way of finding a block more positive before the whole on_generated has run.

At the moment what I'm trying to do is backwards replace a node as I have some basic mirroring going on so if for example I need to remove block x=1 y=1 z=1 and assuming river bed is currently centered on 0 I know I also need to remove x=1 y=1 z=-2. Currently I tried doing this using minetest.set_node({x=x, y=y, z=z-2}, {name="default:sand"}). I attempt to do this while currently setting the data object for x=1 y=1 z=1. So this very fragmented block of code below:

Code: Select all

				data[a:index(x, y, z)] = c_ice	-- expanded that for clarity			
				minetest.set_node({x=x, y=y, z=z-2}, {name="default:sand"})
essentially backwards overwriting the required block while setting the current block...except it dosent work. I think this is because the voxelmanip doesn't update until the end and update the whole so essentially my "node" dosen;t yet truly exist until the chunk is updated. So is there an easy way to essentially go back and replace a specific node when the chunk is mid generation?

I do have a workaround store the x,y,z for the required nodes in a table then after chunk generation ends then call set node and run it across all coords in the table...This just seems more untidy to me, but maybe it is the best way.

Appreciate the help and advice, I'm very close to having a river I'm happy with just trying to iron out some noise overlay issues.

User avatar
sirrobzeroone
Member
Posts: 191
Joined: Mon Jul 16, 2018 07:56

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

by sirrobzeroone » Post

Sigh, think i worked this out now but about to sleep would this work?

Code: Select all


data[a:index(x, y, z)] = c_ice 
data[a:index(x, y, z-2)] = c_sand

edit: yep that worked, I should have clicked as the generation of the chunk is really just a big table using x,y,z as key....
Last edited by sirrobzeroone on Mon Aug 26, 2019 21:01, edited 1 time in total.

User avatar
Wuzzy
Member
Posts: 4046
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 » Post

Ooff! I finally managed to find the problem in my v6 biome detection. Basically I did set the correct offset, but only for the HUD display. When I recalculated the noise to calculate the actual biome, it still used the old non-offset. So yeah, that last problem was totally my fault. :D
But thanks for pointing out the sneaky offset, that one was really important.

And of course, the silly spread offset was also another bug in my code, but I already noticed it on my own and removed it in the meantime. I already had huge doubts when I added this; I was getting desparate. xD

Here's the fruit of your help:
viewtopic.php?f=9&t=23158
viewtopic.php?f=9&t=23138
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

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

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

by StarNinjas » Post

Are biome temperatures Celsius?

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

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

by duane » Post

StarNinjas wrote:Are biome temperatures Celsius?
Biome temperatures are officially undefined. However, they bear a stronger resemblance to Fahrenheit than to Celsius.
Believe in people and you don't need to believe anything else.

User avatar
paramat
Developer
Posts: 3679
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

Biome heat and humidity are both abstract values.
With the default heat and humidity noise parameters, both heat and humidity have average values of 50, and vary from -37.5 to 137.5, although the extreme values are very rare.

Image

Horizontal - Heat
Vertical - Humidity

ICE Icesheet
TAI Taiga
COF Coniferous forest
DEF Deciduous forest
RAF Rainforest

TUN Tundra
SGR Snowy grassland
GRA Grassland
SAV Savanna

CDE Cold desert
SDE Sandstone desert
DES Desert

In the MTG biome system, the freeze line (0 degrees Celcius) is at heat = 35.

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

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

by StarNinjas » Post

Ok Thanks!

User avatar
Wuzzy
Member
Posts: 4046
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 » Post

How do I reliably (!) spawn entities as part of the map generation process? For example, when I want to spawn a minecart on a rail in an abandoned mineshaft, or I want to spawn a villager in a village. These entities have to spawn during mapgen. Right?
Currently, spawning entities in this phase often fails, and this is probably due to <https://github.com/minetest/minetest/issues/4759>, i.e. entity spawning is like the lottery and completely unreliable.

So my question is: How do I work around issue 4759? Or do I have to wait for a bugfix?
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

Termos
Member
Posts: 321
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Wuzzy wrote:These entities have to spawn during mapgen. Right?
Currently, spawning entities in this phase often fails
Maybe has something to do with entities being active only within active_objects_send_range_blocks, and mapgen happening usually outside that radius.

Honestly I wouldn't think of placing entities mapgen time, instead maybe place a special node with a timer or abm, so an entity is spawned and the node removed whenever a player gets in range?

User avatar
Wuzzy
Member
Posts: 4046
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 » Post

Yeah, that may or may not work. I need to test this. It sucks I have to regularily poll for players, but yeah. What really annoys me that even then, I have no 100% chance the entity will spawn, and I don't know if it failed. So just trying to spawn the entity until it actually spawns will not work. I basically only have one try for an entity spawn.

Another question:
In MT 5.0.0, the mapgen order was changed to dungeons > ores > decorations.
Now what is the recommended way to generate ores in decorations nonetheless?
For example, when I have a crystal spike spawned on the surface as decoration, and I also want some ore generated inside the crystal nodes (for example, the uber rare shiny crystal ore). The crystal spike is made out of nodes that don't not appear anywhere else.

Because of the new mapgen order, I can no longer use the ore system to generate ores in the crystal spike (this worked in previous versions, I checked). Right? Because decorations now generate after ores, not the other way round.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

Termos
Member
Posts: 321
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Wuzzy wrote:It sucks I have to regularily poll for players, but yeah.
Not necessarily, If I'm not mistaken, abms and maybe timers too only fire within active_block_range, so setup one that fires immediately and the engine will do the rest, no polling.

User avatar
twoelk
Member
Posts: 1380
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

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

by twoelk » Post

maybe
if ore found surrounded by certain amount of air then decorate it?

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

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

by duane » Post

Wuzzy wrote:Now what is the recommended way to generate ores in decorations nonetheless?
Why not just put the ore in the schematic?
Believe in people and you don't need to believe anything else.

User avatar
Wuzzy
Member
Posts: 4046
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 » Post

Why not just put the ore in the schematic?
But then it would not be random and always be at the same spot. That's not how ores are supposed to work.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

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

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

by duane » Post

Wuzzy wrote:
Why not just put the ore in the schematic?
But then it would not be random and always be at the same spot. That's not how ores are supposed to work.
I mean, make multiple layers with random chances of showing up, like trees. The only drawback I can see is that the items wouldn't always be the same height, which might be a good thing in some cases.
Believe in people and you don't need to believe anything else.

User avatar
paramat
Developer
Posts: 3679
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

> Now what is the recommended way to generate ores in decorations nonetheless?

There isn't one because it's not possible anymore =) The order change caused improvements that outweigh the rare usage you desire.
https://github.com/minetest/minetest/pull/7656

Kurtzmusch
Member
Posts: 41
Joined: Sat Oct 21, 2017 18:12
In-game: Kurtzmusch

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

by Kurtzmusch » Post

is it possible to check if a mapblock exists? when i generate my mapblocks i want to check if a mapblock below it exists, and if it does, update its lighting... when traveling upwards (+y) mapblocks will be lit by sunlight, and generating a new mapblock above it wont cast its shadows
Like Puzzles? Escape The Dungeon

User avatar
SnikeMK
New member
Posts: 4
Joined: Mon Aug 25, 2014 07:18

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

by SnikeMK » Post

HI all!
Maybe do you have a mod for sorting inventory?

User avatar
paramat
Developer
Posts: 3679
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

Kurtzmurch, what do you mean by 'exists'?: Loaded into the client, or generated?

SnikeMK, inventory is not mapgen, you're in the wrong thread =)

Kurtzmusch
Member
Posts: 41
Joined: Sat Oct 21, 2017 18:12
In-game: Kurtzmusch

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

by Kurtzmusch » Post

generated, doesnt matter if in ram or hd
Like Puzzles? Escape The Dungeon

User avatar
paramat
Developer
Posts: 3679
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

Kurtzmusch, use 'get node', if the nodename is "ignore" it is either ungenerated world or outside the configured 'mapgen limit'.
EDIT: I was wrong, see below.
Last edited by paramat on Sun Oct 06, 2019 23:49, edited 1 time in total.

User avatar
paramat
Developer
Posts: 3679
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

Hm that's not right. if 'get node' loaded an unloaded area of world from disk that would take a long time and the Lua code would halt for that time. So 'get node' is instant but returns "ignore" for unloaded world.
The 'generated' status of a mapblock is stored in the world database so cannot be accessed instantly.

To know if a mapblock is generated, it would have to be added to a queue for loading from disk at a later time.
'minetest.load_area()' https://github.com/minetest/minetest/bl ... .txt#L4420
Then at regular intervals, use 'get node or nil' to check if it is loaded yet.
Then when the result is not 'nil', check the node name, if "ignore" it is an ungenerated mapblock.

'get node or nil' returns nil for unloaded areas, such an area can be generated but just not loaded in the server.
See https://github.com/minetest/minetest/bl ... .txt#L4242

Kurtzmusch
Member
Posts: 41
Joined: Sat Oct 21, 2017 18:12
In-game: Kurtzmusch

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

by Kurtzmusch » Post

huum, this solution seems a bit intensive.. having to keep calling get_node_or_nil until its not nil seems a bit... hacky. ive been thinking about using mod_store to store the mapblocks that have been generated instead... not sure how that would perform if a huge part of the map gets explored though
Like Puzzles? Escape The Dungeon

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest