understanding spawn

User avatar
LocaL_ALchemisT
Member
 
Posts: 56
Joined: Thu Jul 19, 2012 16:21
Location: Asia Tenggara

understanding spawn

by LocaL_ALchemisT » Tue Dec 16, 2014 00:38

how does the game determine the spawn point?
how can we set our own random teleport point so that people wouldn't end up high above the sky or buried beneath the earth?

many thanks in advance
Built Telegate v1.0, Workers v2.0, Broadcast v0.0 & Weeping Angel v0.1
Having A Buzy Week
From 0.4.10 with love~
 

User avatar
Don
Member
 
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: understanding spawn

by Don » Tue Dec 16, 2014 01:46

Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
paramat
Developer
 
Posts: 3560
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: understanding spawn

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).
 

User avatar
ArguablySane
Member
 
Posts: 116
Joined: Sun Oct 12, 2014 21:29

Re: understanding spawn

by ArguablySane » Tue Dec 16, 2014 08:53

Is there a standard way to make the player spawn at ground level when the entire mapgen is being done by a mod? Moving the player after they spawn seems like it would work, but it isn't the most elegant solution.
The above post and any ideas expressed therein are released to the public domain under a Creative Commons CC0 license.
 

User avatar
paramat
Developer
 
Posts: 3560
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: understanding spawn

by paramat » Tue Dec 16, 2014 15:18

No standard way, my recent mapgens have spawnplayer functions that work in a slightly similar way to the core version: pre-calculate terrain from noise to find a suitable spawnpoint. But i need to change my functions to not depend on a chunk size of 80 nodes, i need to move towards the core method.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 1 guest