Idea: Split cave generation from mapgen

Post Reply
User avatar
Hume2
Member
Posts: 710
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Idea: Split cave generation from mapgen

by Hume2 » Post

It seems me like the algorithm for generating caves is mostly the same across all mapgens. So it would be nice to split it from mapgen completely. It would work like this:
  • Mapgen creates the terrain.
  • Mapgen calls the used cavegen in the appropriate place in the code. Some mapgens (like singlenode) don't do well with caves so they could skip this step.
  • Mapgen populates the terrain.
Actually, it already works this way but the cavegen is fixed for each mapgen. What I'm suggesting is that the user could choose mapgen and cavegen independently. Currently, two cavegens could be offered: "default" and "no caves". That would allow us to make more caavegens in the future.

What do you think?
If you lack the reality, go on a trip or find a job.

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

Re: Idea: Split cave generation from mapgen

by duane » Post

<deleted>
Believe in people and you don't need to believe anything else.

Sokomine
Member
Posts: 4290
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Idea: Split cave generation from mapgen

by Sokomine » Post

I don't know how well that would work and which effect it might have on mapgen speed. mg_villages has to go to some trouble to repair cavegen griefing. It's almost always an issue unless you can guarantee that none of the nodes of your structures are is_ground_content.
A list of my mods can be found here.

User avatar
Hume2
Member
Posts: 710
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: Idea: Split cave generation from mapgen

by Hume2 » Post

The speed would be almost the same because the only difference would be that the mapgen would have to decide which cavegen to use. So it will be slowed down only by one evaluation of switch statement per generated mapblock. So it will slow down by a few nanoseconds maximum, that's nothing compared to how long the mapgen takes.

Splitting cavegen from mapgen would actually help mg_villages because one could make/choose a cavegen which doesn't grief the villages.
If you lack the reality, go on a trip or find a job.

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests