Page 1 of 2

[Mod] Skylayer [0.5]

Posted: Sat Oct 22, 2016 21:14
by xeranas
Minetest utility mod to help manage player sky.

Mod dependencies: <none>
Download and details on: https://gitlab.com/rautars/skylayer
Licensing:
- Code: MIT
Tested on: Minetest 0.5.2

Features:
* Smooth transition between base colors for sky and clouds.
* Remembers multiple sky/clouds settings per player and automatically loads last active

Check out readme and demo for usage samples (some demos will work only for 5.2+ versions). Demos by default disabled remove comment on init file to enable them.

Re: [Mod] Skycolor

Posted: Sun Oct 23, 2016 16:54
by azekill_DIABLO
yes yes yes yes yes yes and yes

Re: [Mod] Skycolor

Posted: Sun Oct 23, 2016 17:07
by TheReaperKing
This seems like it'd be neat for storms and maybe even eventually stormclouds!

Re: [Mod] Skycolor

Posted: Sun Oct 23, 2016 18:29
by azekill_DIABLO
will this be added to weather pack???

Re: [Mod] Skycolor [0.2]

Posted: Sat Nov 12, 2016 21:14
by xeranas
Skycolor was update to support multiple sky color definitions. E.g. if your worlds sky is green then some temporal event sets sky red and after its over sky come back to green. Thats actual main point of mod to help manage such changes.
azekill_DIABLO wrote:will this be added to weather pack???
Yes, its already updated. However due strange minetest behavior (unpredictable rgb colors) when getting 'regular' type sky colors weather pack cannot take advantage of smooth transition on weather initialization. However once weather initialized it sky color should change according day time.

Please note that api was changed. I update description.

Re: [Mod] Skylayer [0.4]

Posted: Sat Apr 14, 2018 13:44
by xeranas
Skylayer version 0.4 released:
* Added minetest clouds api support (color transitions can be applied for clouds too).

New skylayer version is not backwards compatible!, minor changes needs to done for skylayer definitions (see demo and readme files for reference).

Re: [Mod] Skylayer [0.4]

Posted: Fri Mar 13, 2020 10:08
by texmex
Can we expect support for sky gradients in the future? :)

Re: [Mod] Skylayer [0.4]

Posted: Fri Mar 13, 2020 19:00
by xeranas
texmex wrote:Can we expect support for sky gradients in the future? :)
Hi, thanks for interest :)
I was unaware of new set sky API changes which expands capabilities. Yes, I will test new capabilities and update mod accordingly :)

Re: [Mod] Skylayer [0.4]

Posted: Sat Mar 14, 2020 08:15
by texmex
xeranas wrote:
texmex wrote:Can we expect support for sky gradients in the future? :)
Hi, thanks for interest :)
I was unaware of new set sky API changes which expands capabilities. Yes, I will test new capabilities and update mod accordingly :)
Thank you!!

Re: [Mod] Skylayer [0.4]

Posted: Sat Mar 14, 2020 08:40
by texmex
I’ve been interested for a while, actually. I’m integrating the mod in the LATE effects system.

Re: [Mod] Skylayer [0.5]

Posted: Sun Mar 22, 2020 15:08
by xeranas
Mod was updated to support new Minetest sky API capabilities (sky_color, moon, sun and etc.).

Re: [Mod] Skylayer [0.5]

Posted: Mon Mar 23, 2020 07:17
by texmex
Decent!!! \o/

Re: [Mod] Skylayer [0.5]

Posted: Sat Apr 11, 2020 20:48
by TestificateMods
Thank you! This is a great idea to prevent mods from conflicting with each other.
I have included it as an optional dependency in my Moon Phases mod and hope that other mod makers will follow. Keep doing that good work!

Re: [Mod] Skylayer [0.5]

Posted: Sun Apr 12, 2020 20:51
by texmex
I'm not sure I get the correct visuals from the demo skies. I was wondering if I can get screenshots of them for comparison?

Re: [Mod] Skylayer [0.5]

Posted: Mon Apr 13, 2020 00:13
by TestificateMods
texmex wrote:I'm not sure I get the correct visuals from the demo skies. I was wondering if I can get screenshots of them for comparison?
I've had the same problem until I updated my game. If you're running anything below 5.2.0 then some of the demos will not work.

Re: [Mod] Skylayer [0.5]

Posted: Wed Apr 22, 2020 13:23
by Nathan.S
I'm probably just missing something obvious, but is it possible to turn off the sunrise and sunset gradients. I have some space layers in my game and don't want to have those showing. I can't seem to find an option for it in the readme or demos. Thanks

Re: [Mod] Skylayer [0.5]

Posted: Wed Apr 22, 2020 15:55
by xeranas
I'm probably just missing something obvious, but is it possible to turn off the sunrise and sunset gradients. I have some space layers in my game and don't want to have those showing. I can't seem to find an option for it in the readme or demos. Thanks
Yes, the sunrise without sun was a strange effect, I updated the demo. :)

You can set sunrise_visible to false in sun_data block. Blocks sun_data and moon_data are wrappers without skylayer specifics yet, they should accept the same parameters as minetest player set_sun / set_moon methods.

Code: Select all

sun_data = {
  visible = false,
  sunrise_visible = false
}
It seems that demo was enabled by accident so I disabled again (probably should create a separate mod for demo alone). A demo can be enabled by uncommenting the last line in init.lua.

Re: [Mod] Skylayer [0.5]

Posted: Thu Apr 23, 2020 01:01
by Nathan.S
Perfect, thank you so much.

It looks like the clouds may be broken. If I turn on the demo without clouds, and then go back to the one with clouds, they never appear.

Re: [Mod] Skylayer [0.5]

Posted: Sun Apr 26, 2020 09:15
by xeranas
Nathan.S wrote:It looks like the clouds may be broken. If I turn on the demo without clouds, and then go back to the one with clouds, they never appear.
Thanks for the report, this bug should be fixed by now.

Re: [Mod] Skylayer [0.5]

Posted: Sun May 03, 2020 10:13
by acidzebra
This is an awesome mod and super worth getting the hang of.

still having some issues with clouds. Moving between a layer with

Code: Select all

	sl.sky_data = {
		clouds = false
and one that has clouds = true, it still doesn't turn on the clouds (downloaded latest version of mod yesterday + minetest 5.2.0). What does work is calling

Code: Select all

player:set_sky( nil, "plain", nil, true)
in between applying layers but that's obviously undesirable.

Second cloud-related issue, I can't for the life of me get messing with colors and ambient to actually change the colors of the clouds to work, but that seems to be a problem I'm having with player:set_clouds too, maybe I just don't understand the value ranges, I thought it was just HEX RGB + transparancy.

Code: Select all

	sl.clouds_data = {
			color = "#50005040",
			ambient = "#000000",
Just leads to the same old grey clouds. What does work for me is playing with

Code: Select all

    gradient_colors = GradientSpec
    gradient_ambient_colors = GradientSpec
And I can set clouds to any color I like this way, but once applied it will cause the server to eventually crash with:

Code: Select all

2020-05-03 11:55:55: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'skylayer' in callback environment_Step(): ...2.0-win64\bin\..\games\cloudlands\mods\skylayer/core.lua:164: attempt to index local 'c2' (a nil value)
2020-05-03 11:55:55: ERROR[Main]: stack traceback:
2020-05-03 11:55:55: ERROR[Main]: 	...2.0-win64\bin\..\games\cloudlands\mods\skylayer/core.lua:164: in function 'calculate_current_gradient_color'
2020-05-03 11:55:55: ERROR[Main]: 	...2.0-win64\bin\..\games\cloudlands\mods\skylayer/core.lua:191: in function 'calculate_color_hex_value'
2020-05-03 11:55:55: ERROR[Main]: 	...2.0-win64\bin\..\games\cloudlands\mods\skylayer/core.lua:235: in function 'resolve_sky_color'
2020-05-03 11:55:55: ERROR[Main]: 	...2.0-win64\bin\..\games\cloudlands\mods\skylayer/core.lua:296: in function 'update_sky_details'
2020-05-03 11:55:55: ERROR[Main]: 	...2.0-win64\bin\..\games\cloudlands\mods\skylayer/core.lua:385: in function 'update_sky'
2020-05-03 11:55:55: ERROR[Main]: 	...2.0-win64\bin\..\games\cloudlands\mods\skylayer/core.lua:434: in function <...2.0-win64\bin\..\games\cloudlands\mods\skylayer/core.lua:421>
2020-05-03 11:55:55: ERROR[Main]: 	...ds\minetest-5.2.0-win64\bin\..\builtin\game\register.lua:429: in function <...ds\minetest-5.2.0-win64\bin\..\builtin\game\register.lua:413>
2020-05-03 11:55:55: ERROR[Main]: stack traceback:
(this is based on a custom game I'm testing, but all the mods from default are there and unaltered except 'weather' which obviously interferes with the clouds and was removed)

Re: [Mod] Skylayer [0.5]

Posted: Sun May 03, 2020 19:17
by xeranas
Thanks for reporting. I push some fixes to address the mentioned issues (didn't spend much on testing, so let me know if there still something off).

Not sure about the ambient format, but if gradient version works it must be a formatting issue, as in the end, gradient value is converted and used into player:set_clouds. At this point, gradient version colors do not support transparency (added into TODO list) so converted color output, for example, is #733A93. Minetest Lua API docs say that the alpha (transparency) channel is ignored for clouds ambient color (#000000 is probably the default, you should try different colors and see if there is a difference at night).

Also, please note that gradient_ambient_color was changed to gradient_ambient_colors (to match readme).

Re: [Mod] Skylayer [0.5]

Posted: Mon May 04, 2020 13:27
by acidzebra
Thanks for the quick fix!

From testing, both the crash and the cloud issues seem to be remedied, will test for another few hours as I'm noodling with the various settings.

Great stuff!

Re: [Mod] Skylayer [0.5]

Posted: Sat Jun 06, 2020 16:11
by Wuzzy
Minetest 5.2.0 has a completely reworked Sky API, and is also able to smoothly transition sky colors between night and day. This greatly reduces the number of set_sky calls you need, which is important because of potential lag.

Would be correct to say that this mod is now obsolete? Or are there still use cases for this mod that aren't solved by Minetest 5.2.0?

Re: [Mod] Skylayer [0.5]

Posted: Sat Jun 06, 2020 20:34
by xeranas
Initial purpose for this mod is to manage multiple skies for player in cross mod way. One mod sets weather sky and few moments later different mod adds some temporal effect and after some time it removes effect and weather sky re-aplies without weather mod knowing.

I'm not sure what now best practices for multiple mods change skies without permanent overriding other mod sky.

Re: [Mod] Skylayer [0.5]

Posted: Sat Jun 06, 2020 21:39
by TestificateMods
The question is also: What even is the best way to achieve compatibility between muliple mods that change the sky? Constructing a stack of weather effects and applying what is on the top is one way to do it. It works really well for temporal effects that change the sky dramatically.

If you have multiple mods that change different aspects (let's say one changes the sky's color and the other one the moon texture) then it might be best to use the default behaviour of applying both effects.

I had a similar issue when developing my weather mod. What I settled for was a mix of both. I gave the effects a priority value and tried to merge all of the sky changes. If in conflict, the effect with the higher priority would then determine that specific value. This way, one effect can control cloud movement while another controls cloud size and sky color at the same time.

The priority I used is of course only a work-around to determine which sky effect is more important. Ideally, you would find a way to merge them as well (where appropriate) in a better way. But that would require better understanding of the intention behind that change. Does the mod author want to change the base color as a new default? Does the mod author want to darken the color to simulate a lighting change? Does the mod author want to override the color with the specified tone (e.g. make everything black for a blindness effect)?

Simply using a priority does not seem ideal but it's better than what we have right now. Ideally, we would need additional functions to specifiy the intention of the change. Then a compatibility mod could determine whether to override, ignore, or integrate the change into the current sky.