[Mod] Asteroid and comet realm [0.5.1] [asteroid]

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

by paramat » Post

Version 0.4.0 LVM/PM version, fast generation but no craters yet. Requires 0.4.7dev.
http://www.mediafire.com/download/83g9s ... aramat.zip
The previously posted 'asteroidlvm' 0.1.1 download had misnamed textures.
This will be pushed to the github repo when 0.4.8 is out, until then i will continue to work on pre-LVM 0.3.
Last edited by paramat on Mon Nov 18, 2013 07:04, edited 1 time in total.

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

by mauvebic » Post

An update on the shadow issue,

Code: Select all

    vm:calc_lighting()
what we started with, gives a few large shadows at random places

____________________________

Code: Select all

minetest.register_on_mapgen_init(function(mgparams)
    minetest.set_mapgen_params({mgname="singlenode", flags="nolight", flagmask="nolight"})
end)
made everything pitch black

____________________________

Code: Select all

    vm:set_lighting({day=0, night=0})
caused crash:

Code: Select all

ERROR[EmergeThread0]: ERROR: An unhandled exception occurred: LuaError: error: attempt to index a nil value

____________________________

a combination of #1 and #2 gave the same result as #2. In all cases the problems occur at y < 0. :/
Last edited by mauvebic on Wed Nov 20, 2013 08:41, 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

:/
Last edited by paramat on Wed Nov 20, 2013 08:58, edited 1 time in total.

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

by mauvebic » Post

I didn't expect 1 and 2 to work in tandem but i had to try after all else. Regarding #3, that may be a bug considering others are getting the same crash [post here and the one below].

I think minetest assumes y < 0 to be underground, which would explain why nolight would give pitch black and calc_lighting would fix most but not all of the shadows (calc_lighting giving the correct result if the chunk above was generated first).
Last edited by mauvebic on Wed Nov 20, 2013 11:12, 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

I just tried a singlenode mapgen with nolight flag, and ran pre-LVM asteroid mod, all nodes were dark and the player's hand went black below y = 14? 8/

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

by mauvebic » Post

So it is 1 and 2. Problem is, I did it exactly in that order :/ Tried it again, here's the code and result:

Code: Select all

minetest.register_on_mapgen_init(function(mgparams)
    minetest.set_mapgen_params({mgname="singlenode", flags="nolight", flagmask="nolight"})
end)

minetest.register_on_generated(function(minp, maxp, seed)

    local x1 = maxp.x
    local y1 = maxp.y
    local z1 = maxp.z
    local x0 = minp.x
    local y0 = minp.y
    local z0 = minp.z
    local sidelen = x1 - x0 + 1 -- chunk side length

    local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
    local area = VoxelArea:new{MinEdge=emin,MaxEdge=emax}
    local data = vm:get_data()    

    local perlin1 = minetest.get_perlin_map(
        {offset=0, scale=1, spread={x=perl1.SCAL1, y=perl1.VSCAL1, z=perl1.SCAL1}, seed=perl1.SEED1, octaves=perl1.OCTA1, persist=perl1.PERS1},
        {x=sidelen, y=sidelen, z=sidelen}
        )
    local perlin3 = minetest.get_perlin_map(
        {offset=0, scale=1, spread={x=perl3.SCAL3, y=perl3.SCAL3, z=perl3.SCAL3}, seed=perl3.SEED3, octaves=perl3.OCTA3, persist=perl3.PERS3},
        {x=sidelen, y=sidelen, z=sidelen}
        )
    local perlin4 = minetest.get_perlin_map(
        {offset=0, scale=1, spread={x=perl4.SCAL4, y=perl4.VSCAL4, z=perl4.SCAL4}, seed=perl4.SEED4, octaves=perl4.OCTA4, persist=perl4.PERS4},
        {x=sidelen, y=sidelen, z=sidelen}
        )
    local perlin5 = minetest.get_perlin_map(
        {offset=0, scale=1, spread={x=perl5.SCAL5, y=perl5.SCAL5, z=perl5.SCAL5}, seed=perl5.SEED5, octaves=perl5.OCTA5, persist=perl5.PERS5},
        {x=sidelen, y=sidelen, z=sidelen}
        )
    local perlin6 = minetest.get_perlin_map(
        {offset=0, scale=1, spread={x=perl6.SCAL6, y=perl6.VSCAL6, z=perl6.SCAL6}, seed=perl6.SEED6, octaves=perl6.OCTA6, persist=perl6.PERS6},
        {x=sidelen, y=sidelen, z=sidelen}
        )
    local perlin7 = minetest.get_perlin_map(
        {offset=0, scale=1, spread={x=perl7.SCAL7, y=perl7.VSCAL7, z=perl7.SCAL7}, seed=perl7.SEED7, octaves=perl7.OCTA7, persist=perl7.PERS7},
        {x=sidelen, y=sidelen, z=sidelen}
        )
    
    local nvals1 = perlin1:get3dMap_flat({x=minp.x, y=minp.y, z=minp.z})
    local nvals3 = perlin3:get3dMap_flat({x=minp.x, y=minp.y, z=minp.z})
    local nvals4 = perlin4:get3dMap_flat({x=minp.x, y=minp.y, z=minp.z})
    local nvals5 = perlin5:get3dMap_flat({x=minp.x, y=minp.y, z=minp.z})
    local nvals6 = perlin6:get3dMap_flat({x=minp.x, y=minp.y, z=minp.z})
    local nvals7 = perlin7:get3dMap_flat({x=minp.x, y=minp.y, z=minp.z})
    
    local ni = 1
    for z = z0, z1 do -- for each plane do
    for y = y0, y1 do -- for each column do
    for x = x0, x1 do -- for each node do
        local vi = area:index(x, y, z) -- LVM index for node
        local noise1abs = math.abs(nvals1[ni]) 
        local noise4abs = math.abs(nvals4[ni]) 
        local comet = false
        if nvals6[ni] < -(ASCOT) or (nvals7[ni] < -(SASCOT) and nvals1[ni] < ASCOT) then 
            comet = true -- comet biome
        end
        if noise1abs > ASCOT or noise4abs > SASCOT then -- if below surface then
            local noise1dep = noise1abs - ASCOT -- noise1dep zero at surface, positive beneath
            if math.abs(nvals3[ni]) > FISTS + noise1dep * FISEXP then -- if no fissure then
                local noise4dep = noise4abs - SASCOT -- noise4dep zero at surface, positive beneath
                if not comet or (comet and (noise1dep > math.random() + 0.05 or noise4dep > math.random() + 0.05)) then
                    -- asteroid or asteroid materials in comet
                    if noise1dep >= STOT or noise4dep >= STOT then
                        -- stone/ores
                        if math.random(ORECHA) == 2 then
                            if nvals5[ni] > 0.6 then
                                data[vi] = nodeid.mercassium
                            elseif nvals5[ni] > 0.4 then
                                data[vi] = nodeid.cortenide
                            elseif nvals5[ni] > 0.2 then
                                data[vi] = nodeid.dilithium
                            elseif nvals5[ni] < -0.6 then
                                data[vi] = nodeid.tetraburnium
                            elseif nvals5[ni] < -0.4 then
                                data[vi] = nodeid.boridium
                            elseif nvals5[ni] < -0.2 then
                                data[vi] = nodeid.duranium
                            else
                                data[vi] = nodeid.tritanium
                            end
                        else
                            data[vi] = nodeid.stone
                        end
                    else
                        data[vi] = nodeid.dust
                    end
                else -- comet materials
                    if noise1dep >= ICET or noise4dep >= ICET then
                        data[vi] = nodeid.waterice
                    else
                        data[vi] = nodeid.snode
                    end
                end
            end
        end
        ni = ni + 1
    end
    end
    end
    vm:set_data(data)
    vm:calc_lighting()
    vm:write_to_map(data)
end)
Image

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

by paramat » Post

Yeah i did think you had the right order there.
The 'nolight' thing i suggested because i saw it in Nore's mg LVM mapgen, however with a singlenode mapgen i get the feeling it is not needed, perhaps then it would be worth trying this:

Code: Select all

minetest.register_on_mapgen_init(function(mgparams)
    minetest.set_mapgen_params({mgname="singlenode"})
end)
Also i noticed that in a nolight world, enabling 'fly' turns the skybox blue but in normal gaming the skybox is black. I then placed some torches on asteroids and created my own light in the darkness, struck me as possibly suitable for a deep space realm.
Last edited by paramat on Thu Nov 21, 2013 12:42, edited 1 time in total.

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

by mauvebic » Post

singlenode with just calc_lighting is what I started with :p Do you think i'd get the same result with the now working set_lighting()? I can't really accept having a map split down the middle by two different light levels :/ I could also file a GH issue if that helps.
Last edited by mauvebic on Thu Nov 21, 2013 10:21, edited 1 time in total.

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

by mauvebic » Post

I've filed an issue here regarding the disparity in light levels.

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

by paramat » Post

Fast generating lua voxel maniplator / perlin map version for 0.4.8 is now at github, chunk generation time is roughly 1-2 seconds per chunk on my medium speed laptop. New screeshot and map in first post.
Last edited by paramat on Mon Dec 09, 2013 20:41, 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

Version 0.4.4 at github.
Two more lua code optimisations so should be very slightly faster.
The optional craters have obsidian buried under the dust, formed by impact energy. By default craters are off, increase CPCHU to 1 or higher to enable, high values of 'craters per chunk' are fun for ultra-eroded shapes. The random crater sizes are biased towards small craters, large are more rare.

mauvebic ... if you don't want the crater code that can be simply deleted.
Last edited by paramat on Mon Dec 09, 2013 23:01, edited 1 time in total.

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

Re: [Mod] Asteroid and comet realm [0.5.1] [asteroid]

by paramat » Post

Updated, see the edited first post, new screenshots.
Noise memory use optimisations have been applied for a huge reduction in memory use, 2 unnecessary 3D noises have also been removed, hopefully now less chance of OOM errors.
many bugs fixed, features added.

///////////////
Apply noise memory use optimisations. Fix code style. Nodes not ground content (fixes missing nodes). Don't use alpha. Re-enable craters. Fix nodename error. Use default ice / snow textures. Update to MIT license

Remove 'small' noises. Use eased 3D noise for smooth atmospheres. Add skybox, physics and light overrides in space. Improve crater code. More craters

User avatar
j0j0n4th4n
Member
Posts: 256
Joined: Tue Jan 26, 2021 06:45

Re: [Mod] Asteroid and comet realm [0.5.1] [asteroid]

by j0j0n4th4n » Post

Is this mod similar to asteroids and planets mod?
The pictures here have broken links
cdb_894a100ddd76

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests