Minetest on a spherical planet
Posted: Thu Oct 06, 2016 19:59
I have made two YouTube videos on the (im)possibility of making the minetest world look and behave somewhat like a spherical planet. I thought I might share them with you. The title says Minecraft (because that is the more commonly known game and the math applies to both games), but this is acutally minetest. Click these pictures to watch them:
Download
You can get this game from my GitHub page with additional resources in the releases section.
You can also get a precompiled Windws build.
The planet_radius setting
The planet's radius is the number of mapblocks (=16x16x16 nodes) below sea level. So if
then you can dig down to max. y = -planet_radius * 16 = -2 * 16 = -32 before falling through the center.
The planet's circumference is then calculated as ceil(planet_radius * Pi) * 16 * 2 (basically 2 * Pi * r, but rounded up to mapblocks). The flat plane is centered at the origin (x = 0, z = 0), so you the map wraps around to the other side at x/z=+/- planet_circumference / 2. For planet_radius = 2 that means you will "teleport" at ceil(2 * 3.14) * 16 * 2 / 2 = ceil(6.28) * 16 = 7 * 16 = 112.
Does the the server or the client need the planet settings?
Both server AND client need to have the SAME settings to make the planet work. Connecting with a spheretest client to a minetest server generally works, but things like active blocks and objects (other players, items, mobs) close to planet edges will be broken. This is of course far from ideal (ideally, the radius should be defined at world creation and synced from the server to the client), but that is because spheretest is only a demo.
The center of the planet and planet_keep_scale
If planet_keep_scale is true, aspect ratios of blocks are preserved. Since there is the same density of blocks close to the core like on the surface, this implies that there is no center point, there will always be a empty space underneath you.
If planet_keep_scale is false, aspect ratios are not preserved. The further down you go, the narrower the blocks get. This means there will be a center point, but the world gets very glitchy down there.
I can't see across the edges. It just teleports the player!
You are propably on a very large planet. Spheretest has only ever really been tested with planet_radius <= 5. If you can't see across planet edges, please make the planet small enough and adjust your viewing range to 500 or more (smaller planets will also work fine with smaller viewing ranges):
How do you like it?
Download
You can get this game from my GitHub page with additional resources in the releases section.
You can also get a precompiled Windws build.
The planet_radius setting
The planet's radius is the number of mapblocks (=16x16x16 nodes) below sea level. So if
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
planet_radius = 2
then you can dig down to max. y = -planet_radius * 16 = -2 * 16 = -32 before falling through the center.
The planet's circumference is then calculated as ceil(planet_radius * Pi) * 16 * 2 (basically 2 * Pi * r, but rounded up to mapblocks). The flat plane is centered at the origin (x = 0, z = 0), so you the map wraps around to the other side at x/z=+/- planet_circumference / 2. For planet_radius = 2 that means you will "teleport" at ceil(2 * 3.14) * 16 * 2 / 2 = ceil(6.28) * 16 = 7 * 16 = 112.
Does the the server or the client need the planet settings?
Both server AND client need to have the SAME settings to make the planet work. Connecting with a spheretest client to a minetest server generally works, but things like active blocks and objects (other players, items, mobs) close to planet edges will be broken. This is of course far from ideal (ideally, the radius should be defined at world creation and synced from the server to the client), but that is because spheretest is only a demo.
The center of the planet and planet_keep_scale
If planet_keep_scale is true, aspect ratios of blocks are preserved. Since there is the same density of blocks close to the core like on the surface, this implies that there is no center point, there will always be a empty space underneath you.
If planet_keep_scale is false, aspect ratios are not preserved. The further down you go, the narrower the blocks get. This means there will be a center point, but the world gets very glitchy down there.
I can't see across the edges. It just teleports the player!
You are propably on a very large planet. Spheretest has only ever really been tested with planet_radius <= 5. If you can't see across planet edges, please make the planet small enough and adjust your viewing range to 500 or more (smaller planets will also work fine with smaller viewing ranges):
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
viewing_range = 500
How do you like it?