[Mod] Skylayer [0.5]

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

[Mod] Skylayer [0.5]

by xeranas » Post

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.
Last edited by xeranas on Wed Apr 22, 2020 15:37, edited 9 times in total.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Skycolor

by azekill_DIABLO » Post

yes yes yes yes yes yes and yes
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: [Mod] Skycolor

by TheReaperKing » Post

This seems like it'd be neat for storms and maybe even eventually stormclouds!
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Skycolor

by azekill_DIABLO » Post

will this be added to weather pack???
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

Re: [Mod] Skycolor [0.2]

by xeranas » Post

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.

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

Re: [Mod] Skylayer [0.4]

by xeranas » Post

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).

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Skylayer [0.4]

by texmex » Post

Can we expect support for sky gradients in the future? :)

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

Re: [Mod] Skylayer [0.4]

by xeranas » Post

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 :)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Skylayer [0.4]

by texmex » Post

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!!

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Skylayer [0.4]

by texmex » Post

I’ve been interested for a while, actually. I’m integrating the mod in the LATE effects system.

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

Re: [Mod] Skylayer [0.5]

by xeranas » Post

Mod was updated to support new Minetest sky API capabilities (sky_color, moon, sun and etc.).

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Skylayer [0.5]

by texmex » Post

Decent!!! \o/

User avatar
TestificateMods
Member
Posts: 88
Joined: Sat Apr 11, 2020 02:09
GitHub: t-affeldt
In-game: Testificate

Re: [Mod] Skylayer [0.5]

by TestificateMods » Post

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!

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Skylayer [0.5]

by texmex » Post

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?

User avatar
TestificateMods
Member
Posts: 88
Joined: Sat Apr 11, 2020 02:09
GitHub: t-affeldt
In-game: Testificate

Re: [Mod] Skylayer [0.5]

by TestificateMods » Post

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.

User avatar
Nathan.S
Member
Posts: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Skylayer [0.5]

by Nathan.S » Post

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
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

Re: [Mod] Skylayer [0.5]

by xeranas » Post

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.

User avatar
Nathan.S
Member
Posts: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Skylayer [0.5]

by Nathan.S » Post

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.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

Re: [Mod] Skylayer [0.5]

by xeranas » Post

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.

User avatar
acidzebra
Member
Posts: 75
Joined: Sun Sep 10, 2017 09:11

Re: [Mod] Skylayer [0.5]

by acidzebra » Post

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)

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

Re: [Mod] Skylayer [0.5]

by xeranas » Post

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).

User avatar
acidzebra
Member
Posts: 75
Joined: Sun Sep 10, 2017 09:11

Re: [Mod] Skylayer [0.5]

by acidzebra » Post

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!

User avatar
Wuzzy
Member
Posts: 4778
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Skylayer [0.5]

by Wuzzy » Post

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?

User avatar
xeranas
Member
Posts: 162
Joined: Fri Feb 05, 2016 11:06

Re: [Mod] Skylayer [0.5]

by xeranas » Post

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.

User avatar
TestificateMods
Member
Posts: 88
Joined: Sat Apr 11, 2020 02:09
GitHub: t-affeldt
In-game: Testificate

Re: [Mod] Skylayer [0.5]

by TestificateMods » Post

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests