How does worldgen work?

Post Reply
Cotoffer200
New member
Posts: 4
Joined: Fri Feb 16, 2024 08:07

How does worldgen work?

by Cotoffer200 » Post

Hello, I'm making my own game but it seems that despite there being no code in my game theres a few map generators already defined?

Obviously they dont work since all the nodes they use arent defined but why are they even showing up? Shouldn't mapgens be defined per game (or mod)?

Since it appears these mapgens are defined from outside the games, where are they defined and how can i restrict them so only my own mapgens are used for my game?

Thanks in advance!

-Cotoffer200
cdb_9764b395e030

User avatar
Mantar
Member
Posts: 688
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: How does worldgen work?

by Mantar » Post

See the lua_api.md file that ships with Luanti, and look for the details on settings used in game.conf. You can configure available map generators and their available settings in there, like in Exile we have:

Code: Select all

disallowed_mapgens = v5, v6, v7, flat, fractal, singlenode
disallowed_mapgen_settings = mg_flags, mgvalleys_spflags
Basically all non-Lua mapgens are shipped as part of the engine, so they're always available to games, but you can hide the ones that are invalid for your game.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

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

Re: How does worldgen work?

by Blockhead » Post

Cotoffer200 wrote:
Mon Dec 29, 2025 17:05
Hello, I'm making my own game but it seems that despite there being no code in my game theres a few map generators already defined?

Obviously they dont work since all the nodes they use arent defined but why are they even showing up? Shouldn't mapgens be defined per game (or mod)?
Those are defined in C++ inside of the engine. They are there because games stand to benefit from having to not build their own mapgens if they don't want to. With only a a few aliases, you can have a map generator familiar to any MTG player that runs quite quickly without going to great pains for optimisation like repetitivestrain a.k.a halon had to for Mineclonia's clone of Minecraft map generation.
Cotoffer200 wrote:
Mon Dec 29, 2025 17:05
Since it appears these mapgens are defined from outside the games, where are they defined and how can i restrict them so only my own mapgens are used for my game?

Thanks in advance!

-Cotoffer200
You can allow or disallow specific mapgens with a line in game.conf; you probably want to know all the other options that file has too.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

ArceusI
Member
Posts: 165
Joined: Sat Oct 04, 2025 13:55

Re: How does worldgen work?

by ArceusI » Post

Cotoffer200 wrote:
Mon Dec 29, 2025 17:05
Hello, I'm making my own game but it seems that despite there being no code in my game theres a few map generators already defined?

Obviously they dont work since all the nodes they use arent defined but why are they even showing up? Shouldn't mapgens be defined per game (or mod)?

Since it appears these mapgens are defined from outside the games, where are they defined and how can i restrict them so only my own mapgens are used for my game?

Thanks in advance!

-Cotoffer200
If you know Minecraft's worldgen, you can easily understand how Luanti does worldgen: It uses the Seed (A number) to procedurally generate various values for noise, biomes and structure locations, among other things according to the mods you installed. Then the generator checks the flags you selected and generates those accordingly depending on the Seed & installed mods. From there decorations like ore viens will be added and then the game chooses a point where you spawn, once that's completed it places you in the generated world and you can see what the game generated. Some Luanti games like MineClonia can override the worldgen and thus might generate differently from Luanti.
cdb_3241b8795e7e

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest