by paramat » Tue Dec 16, 2014 05:52
Before any mapgen occurs Minetest picks random locations, starting at (x=0, z=0) and working outwards.
For each random location mapgen parameters and perlin noise are used to pre-calculate the ground level at that location, if that level is suitable (not underwater and not at high altitude) the player is then spawned in empty space at that (x, z) and with y = calculated ground level. Only then does the mapgen start generating terrain around the player.
If the random location is not suitable for spawn a new random location is chosen to be tested for suitability.
This means if the terrain is suitable at (x=0, z=0) the player will spawn there, but if there will be a mountain or ocean there the random locations gradually move outwards until a suitable altitude is found.
This way the player is always spawned at the closest suitable location to (x=0, z=0).