Page 1 of 1

[Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Tue Dec 22, 2015 10:22
by emperor_genshin
Greetings Minetest Community!

This mod adds a simple coded interchangeable skybox which adds Space to a regular minetest world, adding certain realism when going into higher altitudes.


    When on earth
    Image

    When in space (Currently activates at Y = 1000)
    Image

    Screenshots were taken from one of my WIP servers, please focus on the skybox changes instead of the other things that are shown in these images.


NOTE: This mod is still work in progress, would like volunteers to help me test this mod entirely.

If you have any further Ideas for this mod feel free to share them here.

NOTE: I've tested this on one of my public minetest servers during my spare time, so far it works very well.
The skybox images that I was using as a placeholder to test the mod is from Xonotic, please give credit to Cuinn Herrick if you are using his images.

Credits: Kudos to Amaz for helping me adding a check timer code and paramat for reviewing the code.

Source Code License: WTFPL

Dependencies: None

Requires: Minetest 0.4.11 or Higher

Version: 0.2

    Version:0.1: First Release
    Version:0.2: Added Fixes + Check Timer

    TODO: Make generated debree for space.

Raw Source Code:
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
--Version 0.2

pos = {x=0, y=0, z=0}

local space = 1000 --value for space, change the value to however you like.

--The skybox for space, feel free to change it to however you like.
local spaceskybox = {
"sky_pos_y.png",
"sky_neg_y.png",
"sky_pos_z.png",
"sky_neg_z.png",
"sky_neg_x.png",
"sky_pos_x.png",
}

local time = 0

minetest.register_globalstep(function(dtime)
time = time + dtime
if time > 1 then for _, player in ipairs(minetest.get_connected_players()) do
time = 0

local name = player:get_player_name()
local pos = player:getpos()
 
   --If the player has reached Space
   if minetest.get_player_by_name(name) and pos.y >= space then
   player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity
   player:set_sky({}, "skybox", spaceskybox) -- Sets skybox

   --If the player is on Earth
   elseif minetest.get_player_by_name(name) and pos.y < space then
   player:set_physics_override(1, 1, 1) -- speed, jump, gravity [default]
   player:set_sky({}, "regular", {}) -- Sets skybox, in this case it sets the skybox to it's default setting if and only if the player's Y value is less than the value of space.
      
      end
         end
            end
               end)

minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
   
   if name then
   player:set_sky({}, "regular", {})

         end
            end)

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Tue Dec 22, 2015 14:41
by fessmK
Nice idea. You should upload the skybox images if you can. Also, make the stars more detailed, and see if you can make a second skybox with improved stars appear at night.

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Tue Dec 22, 2015 17:32
by emperor_genshin
Thank you, I'll see what I can do with the skybox images. :)

fessmK wrote:Nice idea. You should upload the skybox images if you can. Also, make the stars more detailed, and see if you can make a second skybox with improved stars appear at night.


Side note: may be adding space vaccum feature on this mod later on as well, incluiding random space debree like asteroids and such to generate.

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Wed Dec 23, 2015 05:14
by paramat
'local space = ' and 'local spaceskybox = ' should be before 'register globalstep' for speed.
Also globalstep is 10 times per second, there's no need to check the y's of all players that often, add a timer or use random to check less often, once every few seconds is enough.

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Wed Dec 23, 2015 06:02
by emperor_genshin
Thank you paramat, will make sure to fix that as soon as possible.

paramat wrote:'local space = ' and 'local spaceskybox = ' should be before 'register globalstep' for speed.
Also globalstep is 10 times per second, there's no need to check the y's of all players that often, add a timer or use random to check less often, once every few seconds is enough.

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Sun Dec 27, 2015 20:23
by DS-minetest
i like it, i always wanted such of mod

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Sat Jan 02, 2016 20:35
by davidthecreator
awesome!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Sat Jan 02, 2016 21:36
by Napiophelios
This is pretty neat for space fans.
Maybe you could expand it for several ranges:
One for space
one for surface levels
one for underground
and one for the Nether

I experimented with the underground range a little.
If you rearrange the values for -200 and use solid black textures;
caves are completely dark without any "blueskies" showing in open areas.
Image Image



regsky.png
regsky.png (241.35 KiB) Viewed 3687 times
skyext.png
skyext.png (213.12 KiB) Viewed 3687 times

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Sun Jan 03, 2016 03:43
by emperor_genshin
Already done that ;)

You could give it a try on minetest server snet1.thesentinelempire.com/30015

Also, great work with the experiment Napiophelios :)

Napiophelios wrote:This is pretty neat for space fans.
Maybe you could expand it for several ranges:
One for space
one for surface levels
one for underground
and one for the Nether

I experimented with the underground range a little.
If you rearrange the values for -200 and use solid black textures;
caves are completely dark without any "blueskies" showing in open areas.
Image Image



regsky.png
skyext.png


Edit: I still may need to work on this server before releasing it to the Public Server List.

Hmm, maybe I'll add that addition to the official mod, I just need more time to think about it feel free to help me decide, would this be a necessary addition? :)

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Fri Jan 08, 2016 01:13
by DI3HARD139
I'll help with the testing if you'd like. Both in Server and SP environments (Heavily and lightly modded).

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Fri Jan 08, 2016 01:52
by emperor_genshin
Sure, that would be great. :)

DI3HARD139 wrote:I'll help with the testing if you'd like. Both in Server and SP environments (Heavily and lightly modded).

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Mon Feb 22, 2016 18:14
by DS-minetest
TailsTheFoxDoes MT wrote:*deleted*

just copy the code in a init.lua and make textures


@emperor_genshin: can i get those textures from ur screenshots

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Tue Feb 23, 2016 03:11
by DI3HARD139
I second DS-minetest's request.

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Sat Feb 27, 2016 19:27
by emperor_genshin
The Skybox textures I used as a placeholder for this mod are from Xonotic, if you want them click this link bellow.

http://opengameart.org/content/xonotic-skyboxes

The skybox textures that you are looking for is called "polluted_earth".

DS-minetest wrote:
TailsTheFoxDoes MT wrote:*deleted*

just copy the code in a init.lua and make textures


@emperor_genshin: can i get those textures from ur screenshots


DI3HARD139 wrote:I second DS-minetest's request.


NOTE: You may want to convert these files to .png for minetest.

As a side note I will work on my own skybox textures soon.

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Sun Feb 28, 2016 08:03
by DS-minetest
emperor_genshin wrote:The Skybox textures I used as a placeholder for this mod are from Xonotic, if you want them click this link bellow.

http://opengameart.org/content/xonotic-skyboxes

The skybox textures that you are looking for is called "polluted_earth".

DS-minetest wrote:
TailsTheFoxDoes MT wrote:*deleted*

just copy the code in a init.lua and make textures


@emperor_genshin: can i get those textures from ur screenshots


DI3HARD139 wrote:I second DS-minetest's request.


NOTE: You may want to convert these files to .png for minetest.

As a side note I will work on my own skybox textures soon.


thx

(TailsTheFoxDoes MT's post disappeared)

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Fri Jun 03, 2016 23:55
by emperor_genshin
Would be great if Minetest's skybox feature had a Fade-In/Fade-Out function when applying a change to the skybox. =/

Re: [Mod][WIP] Skybox Extended [skybox_extended]

PostPosted: Tue Jun 21, 2016 03:52
by DI3HARD139
I agree with that. I was playing around with some skybox textures. Namely Outer space ones and currently have 3 layers. One at 10k, 2nd at 20k and 3rd at 30k. Kind of annoying how it just jumps between textures.