[Mod] Snow, rain, clouds (with sound) [snowdrift]

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

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by paramat » Post

Update.

Version 0.6.4.

Through my work on the new 'weather' mod for MTGame i realised that the method for getting OS time in 'snowdrift' was wrong, now improved. This may have been partly or entirely the cause of precipitation timing issues that have been mentioned.

I have also added a per-server-session random time offset to the time value, so that each server session in a world no longer has identical precipitation timing.
Essentially, the timing code from the MTGame 'weather' is now used.

Here's a TODO:

No idea if or when i will code this, but useful information for those who have forked this.
The new 'get heat/humidity at point' API of MT 5.x.x should be used in this mod instead of the calculation of heat and humidity noises using hardcoded default noise parameters.
However of course, the mod would then no longer be usable with MT 0.4.x.

Astrobe
Member
Posts: 325
Joined: Sun Apr 01, 2018 10:46

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by Astrobe » Post

paramat wrote:
No idea if or when i will code this, but useful information for those who have forked this.
The new 'get heat/humidity at point' API of MT 5.x.x should be used in this mod instead of the calculation of heat and humidity noises using hardcoded default noise parameters.
However of course, the mod would then no longer be usable with MT 0.4.x.
I did a straightforward replacement by minetest.get_biome_data() when 5.0 came out. Works fine AFAICT.

I am also experimenting with using a particle spawner for rain. It seems to work fine, though I know that with my current implementation I have to spawn particles in a wide area because the spawner is updated every cycle instead of being attached to the player; and the radius depends on the max speed of players.

Code: Select all

					local xyz0={x=0, y=0, z=0}
					minetest.add_particlespawner
					{
						amount=DROPS*math.ceil(d*25), -- where d is in [0,1]. DROPS is 16 in my config
						time=GSCYCLE, -- GSCYCLE is 1 in my config
						minpos={x=pposx-15, y=pposy+10, z=pposz-15},
						maxpos={x=pposx+15, y=pposy+10, z=pposz+15},
						minvel={x=0,y=-10,z=0},
						maxvel={x=0,y=-15,z=0},
						minacc=xyz0,
						maxacc=xyz0,
						minsize=2.8,
						maxsize=2.8,
						minexptime=GSCYCLE,
						maxexptime=GSCYCLE,
						collisiondetection=true,
						collision_removal=true,
						texture="snowdrift_raindrop.png",
						playername=player:get_player_name(),
						vertical=true,
						glow=1,
					}
The 'd' parameter is there to vary the effect from light rain to heavy rain depending on the specific weather conditions. Similar to what Kestrel's fork does.

It is probably less good at preventing "rain under water", but it is an acceptable trade off to me.

Merak
Member
Posts: 96
Joined: Sat Nov 05, 2016 20:34

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by Merak » Post

How does this compare to the current Weather mod of MTG?
Is more functionality of SnowDrift going to be integrated into Weather?

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

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by paramat » Post

This mod is completely different to MTG 'weather' mod.

The use of particles in 'snowdrift' is network-intensive, particle-intensive and a little problematic, so i am not sure it is suitable to use 'snowdrift' features in MTG.
We are somewhat waiting for engine improvements. Particles are currently intensive for the client.

thomz92
Member
Posts: 34
Joined: Fri May 15, 2020 03:08

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by thomz92 » Post

Paramat - this mod is great! Thanks for all the work you do to provide this awesome game as well.

Is it possible to make the rain sounds fade in and out (vs. sudden on/off)? This is especially noticable when walking under trees. Maybe keep the rain sounds constant, but mute them slightly when "indoors"?

If not as a mod update, could you guide me in doing this myself?

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

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by TestificateMods » Post

thomz92 wrote:
Sat May 16, 2020 03:24
Is it possible to make the rain sounds fade in and out (vs. sudden on/off)? This is especially noticable when walking under trees. Maybe keep the rain sounds constant, but mute them slightly when "indoors"?

If not as a mod update, could you guide me in doing this myself?
While working on my own weather mod, I have implemented that behaviour myself. It's totally possible to get it working in snowdrift as well. This utility class that I wrote should get you started. It's not coupled to my weather mod but instead provides an API to toggle sounds on and off that will then fade in or out over a specified amount of seconds. Feel free to use that or take it as inspiration.
Astrobe wrote:
Sun Mar 01, 2020 11:31
I am also experimenting with using a particle spawner for rain. It seems to work fine, though I know that with my current implementation I have to spawn particles in a wide area because the spawner is updated every cycle instead of being attached to the player; and the radius depends on the max speed of players.
Sprinting outside the particle box is a common issue. Instead of increasing the particle radius for fast players you could also adjust the spawn position in order to spawn them in front of the player as he is running. For example, this code from my mod adds the player's velocity to the spawn position. That way, particles are spawned where the player will be in 1s instead of where they are right now. The effect is barely noticeable if you're moving slowly but helps when moving fast without an impact on FPS.

Code: Select all

local velocity = player:get_player_velocity()
config.minpos = vector.add(config.minpos, velocity)
config.maxpos = vector.add(config.maxpos, velocity)

thomz92
Member
Posts: 34
Joined: Fri May 15, 2020 03:08

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by thomz92 » Post

TestificateMods wrote:
Sat May 16, 2020 04:15
While working on my own weather mod, I have implemented that behaviour myself. It's totally possible to get it working in snowdrift as well. This utility class that I wrote should get you started. It's not coupled to my weather mod but instead provides an API to toggle sounds on and off that will then fade in or out over a specified amount of seconds. Feel free to use that or take it as inspiration.
Thanks TestificateMods. I honestly don't know what a utility class is or how to implement it. I know the super basics of programming. My original idea was to modify the rainfall sound file with audacity to have extra sound files such as:

1. Fade in to loud from silence
2. Fade in to muted from silence
3. Fade from muted to loud
4. Fade from loud to muted
5. Fade out from loud to silence
6. Fade out from muted to silence.

Then if I could just understand enough of the init.lua to play them in the right spots, I'd be able to do it myself.

No such luck so far, though

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

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by paramat » Post

thomz92, thanks. I have little time to work on this mod so it is usually a good idea to fork my mod and alter it yourself.

thomz92
Member
Posts: 34
Joined: Fri May 15, 2020 03:08

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by thomz92 » Post

No problem! It's good for me to learn a little more of this programming stuff, because there are a few other mods I want to alter too.

User avatar
FreeGamers
Member
Posts: 651
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by FreeGamers » Post

the fork of this I use that was forked by piezo has sound detection I believe.

It used to have a rare crash when doing a light check that returned nil, but I fixed that with some ghetto patch that seems to work well.

I've edited his version to be significantly better on network performance. It also has denser rain fall that falls faster to keep the particles on screen reduced. Snow fall is tweaks too. I think the particles need a bit more tuning for very low end devices (even though i turned this with various intel integrated GPU), but network IO works well on a live server environment.

https://www.notabug.org/FreeGamers/sara ... /snowdrift

Keep in mind that if you enable the abm's in the abm.lua file, they will crash. that is not fixed yet.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on the forum is now MeseCraft

thomz92
Member
Posts: 34
Joined: Fri May 15, 2020 03:08

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by thomz92 » Post

Thanks FreeGamers, I'll have to check it out!

HubsChromeFreeze
New member
Posts: 1
Joined: Fri Jul 24, 2020 20:45
In-game: HubsChromeFreeze

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by HubsChromeFreeze » Post

Bug: It seems in (at least 5.1.1) that the gradient and shade change isn't working properly. It will quickly display the shaded skies and go back to normal, but remain raining....

Nice mod though. Would be nice to have some lightning compatibility.

User avatar
runs
Member
Posts: 1908
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: [Mod] Snow, rain, clouds (with sound) [snowdrift]

by runs » Post

HubsChromeFreeze wrote:
Fri Jul 24, 2020 23:55
Bug: It seems in (at least 5.1.1) that the gradient and shade change isn't working properly. It will quickly display the shaded skies and go back to normal, but remain raining....

Nice mod though. Would be nice to have some lightning compatibility.
Remove the weather mod of MTG.
Day 42 of the quarantine

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests