Post your mapgen questions here (modding or engine)

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 agree, i am not suggesting the method i described is a practical solution.

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

How would I make a mod that places a duplicate of the terrain really high up.
Except replacing certain nodes with replacement nodes
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
duane
Member
Posts: 1715
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

Extex wrote:How would I make a mod that places a duplicate of the terrain really high up.
Except replacing certain nodes with replacement nodes
You can either get into the C code of the game and make it duplicate terrain, or you can recreate the base mapgen in lua. Needless to say, this is easier if you just start with a lua mapgen. If you use realms, duplicating is as easy as adding a line to your realms.conf file.
Believe in people and you don't need to believe anything else.

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

I don't really want to rely on any mods.
I want it to also duplicate buildings and trees placed on generation.
Is there some way I can use on_generated to place a duplicate with an offseted y pos?
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

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

Extex,

Instead of depending on the realms mod, why not simply take the relevant code sections from realms, (the API), and embed that code into your own project? I get not wanting to duplicate code; but there are, more than likely, huge parts of the realms mod that you do not want.

I've made the same mistake with lib_mat / lib_eco. A developing API, that is then buried in a larger project, and thus either not used, or heavily modified. ;p. I'd probably recommend separating the realms mod into a standalone API with the various mapgen "layers" offered as standalone mods, like Sokomines' mg_villages. If kilarin hasn't already done the separation, he might still be willing to consider it. Especially if others are adopting the API to create further functionality, as this duplicate layer idea suggests.

duane should have also suggested his own mapgen mod, although it probably does not contain the functionality that you requested. Still, I'd peek at the code if I were you. :)

Shad

Red_King_Cyclops
Member
Posts: 324
Joined: Sun Jun 16, 2019 20:17
Location: x=123, y=120, z=534

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

by Red_King_Cyclops » Post

Is it possible for there to be flat biomes in a non-flat world (e.g. a salt flat biome)?
Currently working on new mods.

User avatar
duane
Member
Posts: 1715
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

Red_King_Cyclops wrote:Is it possible for there to be flat biomes in a non-flat world (e.g. a salt flat biome)?
Biomes don't affect the shape of the terrain -- they just control decorations and soil types.
Believe in people and you don't need to believe anything else.

Red_King_Cyclops
Member
Posts: 324
Joined: Sun Jun 16, 2019 20:17
Location: x=123, y=120, z=534

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

by Red_King_Cyclops » Post

duane wrote:
Red_King_Cyclops wrote:Is it possible for there to be flat biomes in a non-flat world (e.g. a salt flat biome)?
Biomes don't affect the shape of the terrain -- they just control decorations and soil types.
That makes sense. In that case, does that mean that underground biomes can change the stone node without altering cave generation?

Edit: I just realized that the caves will be the same if the stone node is ground content.
Currently working on new mods.

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

> does that mean that underground biomes can change the stone node without altering cave generation?

Yes, and they do in MTGame in 2 of the desert biomes.

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

How would I appropriately use the heat, humidity, and the respective blend noises to have the blended heat/humidity map that the built in mapgens have?

Currently, I have a lua mapgen that uses a rough approximation of heat / humidity points to determine which biome to use, but the blending is far from perfect.

I've found that while the heightmap, biomemap, heatmap, and humiditymap mapgen objects are NOT available in singlenode, I can still use the "get_biome_data" function to get the biome data. This function, however, adds a WHOPPING 30 secs to each on_gen call. As such, I instead chose to use a simple if/then statement to determine the correct heat / humidity points to choose the biome. While I get the correct biome, I don't get the blended biomes that I would prefer.

If this can be solved, I'll gladly share the code that could be used by others to use any of the registered biomes on all singlenode lua mapgens. My own lib_mat / lib_eco mods do not add any significant overhead to lua mapgens, beyond the above test for heat / humidity points, which in itself is rather speedy.

Any help on deriving blended heat / humidty noises from the already included heat / humidity and their respective blend noises would be greatly appreciated.

Shad

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 feel i might have misunderstood, but ...
See https://github.com/minetest/minetest/bl ... e.cpp#L215
... for how heat and humidity for a point is calculated.

Heat is simply the value of the heat noise plus the value of the heat blend noise.
Likewise for humidity.
The 'blend' noises are small-valued and small-scaled variations added to the heat and humidity noises.
The default noise parameters are here https://github.com/minetest/minetest/bl ... ome.h#L139

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, please describe in detail the terrain you want, then i might be able to suggest a suitable core mapgen and some custom noise parameters.
'Jungle' in MTGame is a biome (but it is more correctly called 'rainforest'), but hills are not related to biomes, so MTGame does not have a 'jungle hills' biome.

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

Thanks. Hopefully in a few days i will post some parameters for you to use to customise mapgen V7.

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

Offtopic for this thread.

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

Army_bloodcore, sorry for the delay, will now work on that.
Please do not PM me without good reason, thanks, i will always see any posts in this thread.
Last edited by paramat on Tue Dec 17, 2019 22:03, edited 1 time in total.

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

Army_bloodcore,
Add these lines to your minetest.conf file and start a new mgv7 world, using MTGame of course:

Code: Select all

mgv7_spflags = nomountains,ridges,nofloatlands,caverns
mg_biome_np_heat = {
    offset      = 100,
    scale       = 0,
    spread      = (1000, 1000, 1000),
    seed        = 5349,
    octaves     = 3,
    persistence = 0.5,
    lacunarity  = 2.0,
    flags       = eased
}
mg_biome_np_humidity = {
    offset      = 100,
    scale       = 0,
    spread      = (1000, 1000, 1000),
    seed        = 842,
    octaves     = 3,
    persistence = 0.5,
    lacunarity  = 2.0,
    flags       = eased
}
mgv7_np_terrain_base = {
    offset      = 1,
    scale       = 64,
    spread      = (600, 600, 600),
    seed        = 82341,
    octaves     = 5,
    persistence = 0.6,
    lacunarity  = 2.0,
    flags       = eased
}
mgv7_np_terrain_alt = {
    offset      = -16,
    scale       = 8,
    spread      = (600, 600, 600),
    seed        = 5934,
    octaves     = 5,
    persistence = 0.6,
    lacunarity  = 2.0,
    flags       = eased
}
mgv7_np_height_select = {
    offset      = 8,
    scale       = 0,
    spread      = (500, 500, 500),
    seed        = 4213,
    octaves     = 6,
    persistence = 0.7,
    lacunarity  = 2.0,
    flags       = eased
}
Seabed varies between y = -32 and y = 0.
Jungle hill islands cover half of the world area and have a (rare) maximum height of y = 129.
Rivers, no mountains.

If you need anything adjusting let me know, i can suggest alternative vlaues.

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

Army_bloodcore, i ask again, please do not PM me without good reason, you just did it again. Any mapgen questions you have (which was the content your last PM) should be asked here.
Also, asking publicly means more people can help, and everyone sees the useful information.
Private Messages are for messages that must be private for some good reason, or to chat privately to someone you know well.

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

You can have grass and flowers in jungles, and jungle beaches, if you want. Clear the registered biomes and decorations (in a mod that depends on 'default' and 'flowers' mods), and reregister them with the desired changes (grass as top node, flowers in jungle biomes, altered y-limits for jungle and jungle ocean biomes, removal of jungle swamp biome).

Winter94
Member
Posts: 44
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

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

by Winter94 » Post

So, I apologize in advance for my extreme level of ignorance, but I'm new to lua, and I taught myself a bit of C++ when modding Dwarf Fortress. I was working on a cool idea for a mod that adds realistic ores to the game, and I've fixed many errors, but I'm stuck. I have no idea what the error is telling me, really, and if someone could take a look at this and impart their wisdom, I would be greatly appreciative.
Link to my code:https://docs.google.com/document/d/1Jcw ... sp=sharing

Here's the error:

2020-01-11 11:08:00: ERROR[Main]: ModError: Failed to load and run script from C:\Users\XA-26483\Desktop\MINETEST\minetest-5.1.0-win64\bin\..\mods\realores\init.lua:
2020-01-11 11:08:00: ERROR[Main]: ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:182: bad argument #7 to 'register_item_raw' (number expected, got string)
2020-01-11 11:08:00: ERROR[Main]: stack traceback:
2020-01-11 11:08:00: ERROR[Main]: [C]: in function 'register_item_raw'
2020-01-11 11:08:00: ERROR[Main]: ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:182: in function 'register_item'
2020-01-11 11:08:00: ERROR[Main]: ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:208: in function 'register_node'
2020-01-11 11:08:00: ERROR[Main]: ...ETEST\minetest-5.1.0-win64\bin\..\mods\realores\init.lua:1: in main chunk
2020-01-11 11:08:00: ERROR[Main]: Check debug.txt for details.
2020-01-11 11:08:00: ACTION[Main]: Server: Shutting down
2020-01-11 11:08:32: ERROR[Main]: Please choose a name!

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

What is causing your issue is this:

Code: Select all

    groups = {"cracky=3, stone=1"},
It should be without the ""

Code: Select all

    groups = {cracky=3, stone=1},
After you fix that for all your nodes the next error you will see is complaining about this:

Code: Select all

minetest.register_craftitem("chunk_bismuthinite", 
etc...
because of the missing modname preffix. Correctly should be like so:

Code: Select all

minetest.register_craftitem("realores:chunk_bismuthinite", 
etc...
and lastly as a mater of style,

Code: Select all

minetest.register_node("realores:Magnetite", {
this looks odd since it is the first time ever I have seen uppercase in a node id. Just to be clear, this string is usualy never seen by the player, instead when they hover over the item they see the string assigned to 'description'.

MitchellMarquez42
New member
Posts: 3
Joined: Mon Jan 13, 2020 00:10

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

by MitchellMarquez42 » Post

Hey,
Is there a way to make Biome dependent on the blocks generated/placed in a specific area, rather than the other way around? I'm new to coding but looking to make a 3d Terraria clone within Minetest.

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

MitchellMarquez42,

That is not possible using only the Biome API, however ...

You can generate core mapgen worlds with no biomes by setting 'nobiomes' in the mapgen flag setting called 'mg_flags' (This is either a MT 5.0.1 or 5.1.0 feature, not sure which). Then the core mapgen will create a world of stone and water only.
Then you can write a mod that adds biomes to that stone world in any way you want, with biomes dependent on terrain.

MitchellMarquez42
New member
Posts: 3
Joined: Mon Jan 13, 2020 00:10

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

by MitchellMarquez42 » Post

paramat wrote:MitchellMarquez42,

That is not possible using only the Biome API, however ...

You can generate core mapgen worlds with no biomes by setting 'nobiomes' in the mapgen flag setting called 'mg_flags' (This is either a MT 5.0.1 or 5.1.0 feature, not sure which). Then the core mapgen will create a world of stone and water only.
Then you can write a mod that adds biomes to that stone world in any way you want, with biomes dependent on terrain.
Thanks. Gotta try that...

Winter94
Member
Posts: 44
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

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

by Winter94 » Post

Not sure if this is the right place to put this or not but it involves ores generating in the world, so... I'm using a custom version of the stone layers from underchallenge, and I'm trying to set up a table for ores/minerals. What have I done wrong with my table?

Code: Select all

underforge.minerals = {}

local mineral_table = { --name, desc, strata, rarity
   {"corundum",      "Corundum",         "gneiss",         10*10*10,},
   {"corundum",      "Corundum",         "mica",            10*10*10,},
   {"corundum",      "Corundum",         "schist",         10*10*10,},
   {"corundum",      "Corundum",         "pegmatite",      10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "diorite",         10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "pegmatite",      10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "phyllite",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "andesite",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "basalt",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "gabbro",         10*10*10,},
   {"sphalerite",      "Sphalerite",      "andesite",         10*10*10,},
   {"sphalerite",      "Sphalerite",      "dolomite",         10*10*10,},
   {"sphalerite",      "Sphalerite",      "gneiss",         10*10*10,},
   {"bismuthinite",   "Bismuthinite",      "diorite",         10*10*10,},
   {"bismuthinite",   "Bismuthinite",      "granite",         10*10*10,},
   {"bismuthinite",   "Bismuthinite",      "pegmatite",      10*10*10,},
   }

for i in ipairs (mineral_table) do
    local name      = mineral_table[i][1]
    local desc      = mineral_table[i][2]
    local strata   = mineral_table[i][3]
    local rarity   = mineral_table[i][4]

minetest.register_node("underforge:"..name){
   description   = desc,
   tiles      = '"strata..".png"^"ore_"..name..".png"',
   groups      = {cracky = 3, minerals = 1},
   drop      = "underforge:"..name.."_chunk",
   sounds      = default.node_sound_stone_defaults(),
   }

minetest.register_ore("underforge:"..name){
   ore_type      = "scatter",
   ore            = "underforge:"..name.."_in_"..strata,
   wherein         = "underforge:"..strata,
   clust_scarcity   = {rarity},
   clust_size      = 5,
   clust_num_ores   = 10,
   }

minetest.register_craftitem("underforge:"..name){
      description = S("Chunk of" ..desc ),
      groups = {rocks = 1, minerals = 2},
      inventory_image = "chunk_"..name..".png",
   }
end

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

That is a general coding error, so offtopic here. You already have another thread for this, which also posts the error itself, so discussion should happen there.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests