[Mod] Moon realm [0.11.0] [moonrealm]

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

[Mod] Moon realm [0.11.0] [moonrealm]

by paramat » Post

Image


Image


Image

^ Both rover and players leave tracks in the dust


For Minetest 0.4.15 or later
Depends default
Licenses: Code LGPL 2.1. Media CC BY-SA 3.0

Download and rename folder to 'moonrealm'
https://github.com/paramat/moonrealm/archive/master.zip
Browse code
https://github.com/paramat/moonrealm

Note this mod is in development.

The mod will automatically select mgv7 and will customise it to become moon terrain.
Uses a custom skybox and has altered gravity and jump strength.
You will spawn on the bright side of the moon, with the sun and the crescent of the normal realm overhead.

You will be provided with a spacesuit and initial equipment that is not very usable at the moment.
Uses the custom player hand feature to give a player a suitable space glove.
Players leave footprints in the moon dust.
The rover leaves a track and jumps when hitting a slope, due to low gravity it can jump fairly high. Beware that acceleration, braking and turning only work when it is in contact with the ground. The rover needs motion in order to turn, to be more realistic.
Attachments
screenshot_20170417_175559.png
screenshot_20170417_175559.png (846.15 KiB) Viewed 2439 times
screenshot_20170312_224247.png
screenshot_20170312_224247.png (225.4 KiB) Viewed 2439 times
screenshot_20160620_000810.png
screenshot_20160620_000810.png (17.81 KiB) Viewed 2439 times
Last edited by paramat on Thu May 18, 2017 08:31, edited 50 times in total.

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

Your mods are amazing, as always... A problem with the tint is the transition between the different levels of tint, and the fact that the sky will change whenever we are above/below ground. Moreover, you should add a function that places tint again when a node is dug.

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

by paramat » Post

Nore wrote:Moreover, you should add a function that places tint again when a node is dug.
Aha yes good idea.
And yeah the tint transition should be smoother, next version.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

How about some alien ruins for this alien world? They could be made out of some kind of metal that is found in the fissures and have glass domes that are made out of the sand.

Will there be meseors here?
Last edited by Inocudom on Fri Jun 21, 2013 15:07, edited 1 time in total.

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

by paramat » Post

Yeah meseors.
Alien ruins is a good idea i'm interested in architecture generation.

The tinted atmosphere was a crazy experiment but problematic, i have now removed that and doubled the scale of the surface to 2 chunks. A few other things i want to do before the next version.

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

You should also modify the replace code, or add lua code that checks if every node has been replaced, because there are still lots of air bubbles in the stone (perhaps register_ore 16 times instead of 8 will be enough)

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

paramat, you should try to use the new functions to set multiple nodes that were added today: it is now insanely fast (less than a few seconds for a full chunck). I am doing a mod that creates multiple realms at y=20000, and it went at least 100 times faster with the new version. Here is the code: (it is WTFPL, and if there are unused variabled, it is because it is base on your code ;) )

Code: Select all

local ONGEN = true -- (true / false) -- Enable / disable moonrealm generation.
local YMIN = 19000 -- Approx bottom.
local YMAX = 20000 -- Approx top.
local GRAD = 40 -- 40 -- Surface generating noise gradient. Controls height of hills.
local STOTHR = 0.15 -- 0.15 -- Stone noise threshold. Controls maximum depth of dust.

local DUSDIS = 40 -- 40 -- Dust thinning distance in nodes.
local DUSAVY = 20 -- 20 -- Average y where dust starts to thin, relative to minp.y.
local DUSAMP = 20 -- 20 -- Amplitude of that thinning level.
local DUSRAN = 2 -- 2 -- +- Randomness of that thinning level.

local CAVOFF = 0.015 -- 0.015 -- Cave offset. Size of underground caves.
local CAVDIS = 56 -- 56 -- Cave thinning distance in nodes.

local ATMALP = 32 -- 32 -- Alpha of above ground atmosphere
local ATMTHR3 = 0.1 -- 0.1 -- Atmosphere noise thresholds. Controls smooth transition from orange tinted air to normal air underground -- .
local ATMTHR4 = 0.2 -- 0.2 --
local ATMTHR5 = 0.3 -- 0.3 --

local DEBUG = true

-- Perlin noise for terrain.
local SEEDDIFF1 = 46894686546
local OCTAVES1 = 6 -- 6 -- Add 1 to this if you increase scale, add another 1 each time scale has doubled.
local PERSISTENCE1 = 0.55 -- 0.55 --
local SCALE1 = 256 -- 256 -- Largest scale of noise pattern.

-- Perlin noise for caves.
local SEEDDIFF2 = 9294207
local OCTAVES2 = 6 -- 6 -- Add 1 to this if you increase scale, add another 1 each time scale has doubled.
local PERSISTENCE2 = 0.5 -- 0.5 --
local SCALE2 = 256 -- 256 -- Largest scale of noise pattern.

-- Perlin noise for dust thinning line.
local SEEDDIFF3 = 93561
local OCTAVES3 = 4 -- 4 -- Add 1 to this if you increase scale, add another 1 each time scale has doubled.
local PERSISTENCE3 = 0.5 -- 0.5 --
local SCALE3 = 256 -- 256 -- Largest scale of noise pattern.

local yminq = (80 * math.floor((YMIN + 32) / 80)) - 32
local ymaxq = (80 * math.floor((YMAX + 32) / 80)) + 47

minetest.register_node("realms:barrier", {
    drawtype = "normal",
    tiles = {"realms_barrier"},
    paramtype = "light",
    sunlight_propagates = true,
    pointable = false,
    diggable = false,
})

local function replace(old, new)
    for i=1,16 do
        minetest.register_ore({
            ore_type       = "scatter",
            ore            = new,
            wherein        = old,
            clust_scarcity = 1,
            clust_num_ores = 1,
            clust_size     = 1,
            height_min     = yminq,
            height_max     = ymaxq - 80,
        })
    end
end

if ONGEN then
    replace("air", "default:stone")
end

-- On generated function.

function ces()
    local s={}
    for i=1,80 do
        s[i]={}
        for j=1,80 do
            s[i][j]={}
            for k=1,80 do
                s[i][j][k]={name="air"}
            end
        end
    end
    return s    
end

function flatten(scm)
    local s2={}
    local s2i=1
    for _,a in ipairs(scm) do
    for __,b in ipairs(a) do
    for ___,c in ipairs(b) do
        s2[s2i]=c
        s2i=s2i+1
    end
    end
    end
    return s2
end

function add_to_scm(scm, pos, s)
    for p, node in pairs(s) do
        if p.x+pos.x>=1 and p.x+pos.x<=80 and p.y+pos.y>=1 and p.y+pos.y<=80 and p.z+pos.z>=1 and p.z+pos.z<=80 then
            scm[p.z+pos.z][p.y+pos.y][p.x+pos.x]=node
        end
    end
end

treeschm = {[{x=0,y=0,z=0}]={name="default:tree"},
        [{x=0,y=1,z=0}]={name="default:tree"},
        [{x=0,y=2,z=0}]={name="default:tree"},
        [{x=0,y=3,z=0}]={name="default:tree"},
        [{x=0,y=4,z=0}]={name="default:tree"},
        [{x=1,y=5,z=0}]={name="default:leaves"},
        [{x=-1,y=5,z=0}]={name="default:leaves"},
        [{x=1,y=5,z=1}]={name="default:leaves"},
        [{x=1,y=5,z=-1}]={name="default:leaves"},
        [{x=-1,y=5,z=1}]={name="default:leaves"},
        [{x=-1,y=5,z=-1}]={name="default:leaves"},
        [{x=0,y=5,z=0}]={name="default:leaves"},
        [{x=0,y=5,z=1}]={name="default:leaves"},
        [{x=0,y=5,z=-1}]={name="default:leaves"},
        [{x=1,y=6,z=0}]={name="default:leaves"},
        [{x=-1,y=6,z=0}]={name="default:leaves"},
        [{x=0,y=6,z=1}]={name="default:leaves"},
        [{x=0,y=6,z=-1}]={name="default:leaves"},
        [{x=0,y=6,z=0}]={name="default:leaves"},
        }

for y=2,4 do
for x=-2,2 do
for z=-2,2 do
    if x~=0 or z~=0 then
        treeschm[{x=x,y=y,z=z}]={name="default:leaves"}
    end
end
end
end

if ONGEN then
    minetest.register_on_generated(function(minp, maxp, seed)
        minetest.place_schematic(minp, {size={x=1,y=1,z=1},data={{name="default:mese"}}})
        local env = minetest.env
        local scm = ces()
        if maxp.y == ymaxq then
            math.randomseed(seed)
            --local pr=PseudoRandom(seed)
            local perlin1 = env:get_perlin(SEEDDIFF1, OCTAVES1, PERSISTENCE1, SCALE1)
            local perlin2 = env:get_perlin(SEEDDIFF2, OCTAVES2, PERSISTENCE2, SCALE2)
            --local perlin3 = env:get_perlin(pr:next(1,1000), pr:next(2,6), pr:next(1,1000)/500, pr:next(50,1000))
            local water_level = math.random(20,60)
            local sea,treeproba
            if math.random()<=0.05 then
                sea="default:lava_source"
                treeproba=0
            else
                sea="default:water_source"
                treeproba = (math.exp(2*math.random())-1)/50
            end
            for x=1,79 do
            print(x)
            for z=1,79 do
                local surf=math.floor(40+25*perlin1:get2d({x=minp.x+x,y=minp.z+z}))
                local top=math.floor(3+2*perlin2:get2d({x=minp.x+x,y=minp.z+z}))
                if top>=surf then top=surf-1 end
                if surf>80 then surf=80 end
                for y=1, surf-top do
                    --minetest.set_node({x=x,y=y,z=z},{name="default:stone"})
                    scm[z][y][x]={name="default:stone"}
                end
                for y=surf-top, surf-1 do
                    --minetest.set_node({x=x,y=y,z=z},{name="default:dirt"})
                    scm[z][y][x]={name="default:dirt"}
                end
                --minetest.set_node({x=x,y=surf,z=z},{name="default:dirt_with_grass"})
                scm[z][surf][x]={name="default:dirt_with_grass"}
                if surf<water_level then
                    for yw=surf+1,water_level do
                        --minetest.set_node({x=x,y=yw,z=z},{name=sea})
                        scm[z][yw][x]={name=sea}
                    end
                else
                    if math.random()<=treeproba then
                        add_to_scm(scm, {x=x,y=surf+1,z=z}, treeschm)
                    end
                end
            end
            end
            
            for y=1,80 do
                for x=1,80 do
                    --minetest.set_node({x=x,y=y,z=minp.z},{name="realms:barrier"})
                    --minetest.set_node({x=x,y=y,z=maxp.z},{name="realms:barrier"})
                    scm[1][y][x]={name="realms:barrier"}
                    scm[80][y][x]={name="realms:barrier"}
                end
                for z=2,79 do
                    --minetest.set_node({x=minp.x,y=y,z=z},{name="realms:barrier"})
                    --minetest.set_node({x=maxp.x,y=y,z=z},{name="realms:barrier"})
                    scm[z][y][1]={name="realms:barrier"}
                    scm[z][y][80]={name="realms:barrier"}
                end
            end
            minetest.place_schematic(minp, {size={x=80,y=80,z=80},data=flatten(scm)})

        elseif minp.y>=yminq and maxp.y<ymaxq then
            for y=minp.y,maxp.y do
                for x=minp.x,maxp.x do
                    minetest.set_node({x=x,y=y,z=minp.z},{name="realms:barrier"})
                    minetest.set_node({x=x,y=y,z=maxp.z},{name="realms:barrier"})
                end
                for z=minp.z+1,maxp.z-1 do
                    minetest.set_node({x=minp.x,y=y,z=z},{name="realms:barrier"})
                    minetest.set_node({x=maxp.x,y=y,z=z},{name="realms:barrier"})
                end
            end
        end
    end)
end
Last edited by Nore on Thu Jun 27, 2013 09:26, edited 1 time in total.

mauvebic
Member
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Post

Keep up the good work, you're one of the rare (imaginative) ones.

I played around with it, pretty cool. Though the atmosphere nodes were preventing me from placing doors (since they look for air). I also found that w/o atmosphere, the realm generates 2-3x faster on my (newest/average) rig. I was also slightly confused why Mars would be called moonrealm :P but i hacked around and added a moon layer.

Tweaked moonrealm : moon @ y= 10K, mars @ y= 20K

I think the next step might be to add realm-specific ores/resources to give the players a reason to reach the other realms.

ex. moon realm with little base:
Image
Last edited by mauvebic on Sat Jun 22, 2013 22:11, edited 1 time in total.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

Nore wrote:paramat, you should try to use the new functions to set multiple nodes that were added today: it is now insanely fast (less than a few seconds for a full chunck). I am doing a mod that creates multiple realms at y=20000, and it went at least 100 times faster with the new version. Here is the code: (it is WTFPL, and if there are unused variabled, it is because it is base on your code ;
Were these new functions added to Minetest itself recently? It is a great day for this game if they were.

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

by paramat » Post

Nore ...
Yeah i noticed the air bubbles and discovered they are due to the number of 'register ore's. Trying to get a balance between speed and lack of bubbles i decided Pilzadam's value of 8 is reasonable, the bubbles are only a problem if they make fissure walls excessively pitted.
Thanks for posting the code with the new functions, this is exciting news and i look forward to using them in 0.4.8 (yeah i only use stable releases so i'lll have to wait).

mauvebic, thanks :) Yeah one of the many reasons i removed the atmosphere nodes was generation speed.
EDIT I like that moonbase.
Last edited by paramat on Sun Jun 23, 2013 05:40, edited 1 time in total.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

mauvebic wrote:Keep up the good work, you're one of the rare (imaginative) ones.

I played around with it, pretty cool. Though the atmosphere nodes were preventing me from placing doors (since they look for air). I also found that w/o atmosphere, the realm generates 2-3x faster on my (newest/average) rig. I was also slightly confused why Mars would be called moonrealm :P but i hacked around and added a moon layer.

Tweaked moonrealm : moon @ y= 10K, mars @ y= 20K

I think the next step might be to add realm-specific ores/resources to give the players a reason to reach the other realms.

ex. moon realm with little base:
Image
Making use of your mods and nodes again, Mauvebic? I once asked Starseed to do a review of your MM6 modpack, but he hasn't been doing any videos lately.

User avatar
prof-turbo
Member
Posts: 516
Joined: Mon May 07, 2012 17:02
Location: MinetestForFun or Teeworlds master server list

by prof-turbo » Post

AMAZING!
You should take a look at http://www.xorhub.com

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

by paramat » Post

Version 0.2.0, first post rewritten, new screenshots.
I think this mod was initially partially inspired by the photograph of the surface of Titan, a moon of Saturn.
Image
Last edited by paramat on Thu Jun 27, 2013 01:58, edited 1 time in total.

User avatar
Inocudom
Member
Posts: 3121
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Post

The mod below is a good basis for creating alien ruins above ground and below ground.
http://forum.minetest.net/viewtopic.php?id=5524

mauvebic
Member
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Post

Inocudom wrote: Making use of your mods and nodes again, Mauvebic? I once asked Starseed to do a review of your MM6 modpack, but he hasn't been doing any videos lately.
The irony is i don't remember building that base (national holiday, 3 day weekend ;), it's even got a beer brewery in the basement lol

But yes, i still use my stuff, i just don't publish, so your friend would be better off reviewing something else :p

Paramat: how easy would it be to convert all the air nodes of these realm(s) into something else like vacuum? Would be cool if oxygen farming was a necessity for survival :-)

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

It would be quite easy... (2 lines code, very fast to execute with minetest.register_ore) The hard part is to add air physics after that.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Nore wrote:It would be quite easy... (2 lines code, very fast to execute with minetest.register_ore) The hard part is to add air physics after that.
I guess you are using the same register_ore() hack I use in my nether mod?
Last edited by PilzAdam on Mon Jun 24, 2013 18:25, edited 1 time in total.

mauvebic
Member
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Post

Im not familiar with on_generated at all - how would one use register_ore to fill air with vacuum?

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

mauvebic wrote:Im not familiar with on_generated at all - how would one use register_ore to fill air with vacuum?
I already said that its originally used in my nether mod. You can look it up there.

mauvebic
Member
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Post

PilzAdam wrote:
mauvebic wrote:Im not familiar with on_generated at all - how would one use register_ore to fill air with vacuum?
I already said that its originally used in my nether mod. You can look it up there.
I was asking Nore. I thought LKjoel wrote the nether mod?
Last edited by mauvebic on Mon Jun 24, 2013 18:50, edited 1 time in total.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

mauvebic wrote:
PilzAdam wrote:
mauvebic wrote:Im not familiar with on_generated at all - how would one use register_ore to fill air with vacuum?
I already said that its originally used in my nether mod. You can look it up there.
I was asking Nore. I thought LKjoel wrote the nether mod?
You can use PM to ask people personal questions, otherwise you have to expect anwers from others.

I wrote a nether mod myself that completly differs from the other nether mod.

mauvebic
Member
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Post

PilzAdam wrote:
mauvebic wrote:
PilzAdam wrote: I already said that its originally used in my nether mod. You can look it up there.
I was asking Nore. I thought LKjoel wrote the nether mod?
You can use PM to ask people personal questions, otherwise you have to expect anwers from others.

I wrote a nether mod myself that completly differs from the other nether mod.
Well when you have a clear answer let me know (hint, RTFM and such answers wont do).

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

This code will replace all air between heights ymin and ymax with void. Notes:
- Not perfect, still little holes. You can register 2 times more ores, and they will disappear.
- You need to add it *after* the code of paramat, and *not* in an on_generated function. Else, his replacing of air with stone will not work since it will have already been replaced with void
- You need to change the fissure creating code so it places void instead of doing remove_node.

Code: Select all

for i=1,8 do
    minetest.register_ore({
        ore_type       = "scatter",
        ore            = "void",
        wherein        = "air",
        clust_scarcity = 1,
        clust_num_ores = 1,
        clust_size     = 1,
        height_min     = ymin,
        height_max     = ymax,
    })
end

mauvebic
Member
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Post

Thank you Nore :-)

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

by paramat » Post

mauvebic wrote:Paramat: how easy would it be to convert all the air nodes of these realm(s) into something else like vacuum? Would be cool if oxygen farming was a necessity for survival :-)
Well version 0.1.0 replaced all air nodes with tinted atmosphere nodes so yo could work from that, however as you know that slows generation a lot so ...
Use the register ore hack to replace air with void between 'ymaxq' and 'ymaxq - 159', edit the code so the 'register ores' section looks like this:

Code: Select all

-- Register ores. The air is very rich in stone.
if ONGEN then
    minetest.register_ore({
        ore_type       = "scatter",
        ore            = "moonrealm:luxore",
        wherein        = "air",
        clust_scarcity = LUXCHUN,
        clust_num_ores = 1,
        clust_size     = 1,
        height_min     = yminq,
        height_max     = ymaxq - 160,
    })
    for i=1,8 do
        minetest.register_ore({
            ore_type       = "scatter",
            ore            = "moonrealm:moonstone",
            wherein        = "air",
            clust_scarcity = 1,
            clust_num_ores = 1,
            clust_size     = 1,
            height_min     = yminq,
            height_max     = ymaxq - 160,
        })
    end
    for i=1, 10 do
        minetest.register_ore({
            ore_type       = "scatter",
            ore            = "void",
            wherein        = "air",
            clust_scarcity = 1,
            clust_num_ores = 1,
            clust_size     = 1,
            height_min     = ymaxq - 159,
            height_max     = ATMTOP,
        })
    end
end
And add another parameter

Code: Select all

local ATMTOP = 30000
Then as Nore said in the fissure code add void instead of 'remove node' (line 209 version 0.2.0).
There may be bubbles of air left over here and there but at least they'll be invisible, if they are a problem then increase 'i' for more iterations.
Nore wrote:You need to add it *after* the code of paramat, and *not* in an on_generated function. Else, his replacing of air with stone will not work since it will have already been replaced with void
Luckily not a problem since there are 2 parts to this realm: 'underground' yminq to ymaxq -160, and 'surface chunks' from ymaxq - 159 to ymaxq.
Last edited by paramat on Tue Jun 25, 2013 04:32, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests