Page 1 of 1

Map generation algorithms

PostPosted: Mon Aug 08, 2016 13:48
by galok
We all know about minecraft decompiled sources, so called "Mod Coder Pack". So I want to ask, is MineTest map generation algorithms (v5, v6, v7) are based on decompiled Minecraft map generation algorithms or they are done from scratch?

Re: Map generation algorithms

PostPosted: Mon Aug 08, 2016 13:57
by rubenwardy
Done from scratch, I'm pretty sure

Re: Map generation algorithms

PostPosted: Mon Aug 08, 2016 19:46
by lightonflux
No MC code is in MT. No MT code is derived from MC code.

Re: Map generation algorithms

PostPosted: Mon Aug 08, 2016 20:39
by galok
Okay, I get it about the code. Tell me then, is there any point to read MC code after MT code (map generation), just how different they are? besides MC lack of comments and variable names. I mean, the result look quite similiar.

Re: Map generation algorithms

PostPosted: Mon Aug 08, 2016 22:56
by qwertymine3
galok wrote:Okay, I get it about the code. Tell me then, is there any point to read MC code after MT code (map generation), just how different they are? besides MC lack of comments and variable names. I mean, the result look quite similiar.

The biome placement code is very different to Minetest, however you don't need to read the code for this, this page covers it very well (look for the "grown biomes" section) http://mc-server.xoft.cz/docs/Generator.html.

Re: Map generation algorithms

PostPosted: Mon Aug 08, 2016 23:36
by galok
qwertymine3, thank you! This seems to be a very informative article. It's already answered a few questions for me.

Re: Map generation algorithms

PostPosted: Tue Aug 09, 2016 04:52
by paramat
I can confirm no core mapgens are derived from MC.

Re: Map generation algorithms

PostPosted: Wed Aug 10, 2016 00:19
by galok
have one more question on this topic. the point of generation algorithm is to generate exactly the same blocks in exact same chunk by demand, this also mean that order in which chunks are generated should not affect blocks that generated in specific chunks. Please, correct me if I'm wrong on this one, but else, if I get it right, then tell me: is use of a global random does kinda mess up this system? I mean this code in mapgen_v6.cpp:960
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
      // Put trees in random places on part of division
      for (u32 i = 0; i < tree_count; i++) {
         s16 x = myrand_range(p2d_min.X, p2d_max.X); // this one
         s16 z = myrand_range(p2d_min.Y, p2d_max.Y); // this one too

Position of trees would be different every time they will be generated for this chunk, right? (Implied that full chunk will be re-generated)

Re: Map generation algorithms

PostPosted: Wed Aug 10, 2016 10:09
by paramat
Most mapgens use pseudorandom randoms so will be deterministic, but for minor things like leaf randomness the random may not be deterministic.

Re: Map generation algorithms

PostPosted: Wed Aug 10, 2016 11:29
by galok
paramat, is there a particular reason for that?

Re: Map generation algorithms

PostPosted: Thu Aug 11, 2016 14:39
by paramat
I'm not sure which are deterministic and which are not, but it's possible some are not because they are so trivial, such as the randomness of leaves on a tree. Also mgv6 may be less deterministic because it's older code, newer mapgens have higher quality standards (thanks to hmmmm).

Re: Map generation algorithms

PostPosted: Fri Aug 12, 2016 23:56
by galok
paramat, okay, thank you, I think I got it. But which of the mapgens is a newest one? Judging from github it's a mapgen_v5.cpp, which was added at Nov 9, 2014. But a whole countdown thing from v6 and v7 is a bit tricky to understand. So which one is it?

Re: Map generation algorithms

PostPosted: Sat Aug 13, 2016 01:32
by twoelk
Legendary past

then

-v5 was made
-v6 was created and made default, v5 was dumped
-v7 was made and released before finished, v6 stayed default
-v5 was recreated from scratch and readded, v7 was made better, v6 optimised and stayed default
-valleys was created as lua mapgen and then rewritten and added to Mintest core as new mapgen, v6 was further optimized and stayed default
-more mapgens where added such as fractals (forgot when mathgen was dumped)
-mgflat was extended and is somewhat of a complete mapgen now

new-v5, default-v6, prereleased-v7, valleys and many others are all alive and kicking
most games run with v6, some recommend or even need v7, some subgames don't care, others use singlenode and apply their own on top

I may have missed some or mixed up some of the timeline but it should give a general idea

Re: Map generation algorithms

PostPosted: Sat Aug 13, 2016 07:07
by paramat
^ That.

Newest is mgflat.

Re: Map generation algorithms

PostPosted: Sat Aug 13, 2016 18:28
by galok
twoelk, thank you, you're most certainly brought order into this matter.