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

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

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

by Stix » Post

paramat wrote:Version 0.6.0 released.

Inspired by the ideas of others who have worked on this, i have removed the weird behaviour of precipitation stopping when the player is undercover.
I have made each particle check being under open sky (light == 15) to spawn, and collision detection is on. Now particles don't pass through objects and precipitation continues outside when the player is undercover.
It's a big improvement, more intensive but worth it.

Also included is more parameters and player position prediction from a pull request by lhofhansl.

Image
Cool! Any chance of this getting merged into default?

*EDIT: what about little particles that are spawned when raindrops hit the ground to simulate splashes? Right now it looks like the rain just falls into the ground, which is weird imo.
Hey, what can i say? I'm the bad guy.

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

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

by Astrobe » Post

I have made snowdrift and lightning mod work together by letting the lightning mod peek at the table that memorizes if the raining sound is playing or not. It would be nice to export a function that tells what the whether currently is for a given player (or an arbitrary location?) in order to facilitate mod interop (an extra "storm" whether would be welcome too).

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

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

by Astrobe » Post

Also decreasing luminosity (I'm thinking set_day_night ratio) when raining/snowing would be a nice effect and would have the side effect of slowing down plant growth (wheat, cotton and saplings).

Oh and while you are at it ;-) an Under Sky -like function would be nice because mods that change the sky often conflict with each other.

Well if you like the ideas but have no time for them I can try to do them myself and send you the result.

User avatar
AccidentallyRhine
Member
Posts: 252
Joined: Sun Aug 02, 2015 05:43

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

by AccidentallyRhine » Post

0.6.0 is too intensive to be used on my test server. Too bad there isn't some engine API to speed things up a bit.

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

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

by paramat » Post

Too intensive for the clients? FPS too low? How do you know it is too intensive for the server, what happened?
There are parameters in the init.lua to reduce the amount of particles spawned (which also reduces server load). Reduce FLAKPOS, DROPPOS, they are set quite high by default.
But certainly the perfectionism of the method now used comes at a cost and doesn't allow very many particles.
I also have an idea of how to possibly reduce light checks.

User avatar
Fixer
Member
Posts: 904
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer
Location: Ukraine

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

by Fixer » Post

>weird behaviour of precipitation stopping when the player is undercover.

Nice, looks much better now. Too bad https://github.com/minetest/minetest/pull/6540 or alternatives are not merged to increase particle count.

User avatar
Fixer
Member
Posts: 904
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer
Location: Ukraine

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

by Fixer » Post

>0.6.0 is too intensive to be used on my test server. Too bad there isn't some engine API to speed things up a bit.

Here is some profiling: https://pastebin.com/raw/ZaHvdJfE

User avatar
AccidentallyRhine
Member
Posts: 252
Joined: Sun Aug 02, 2015 05:43

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

by AccidentallyRhine » Post

Server platform is Bulldozer gen1 at 2.4Ghz, more than enough memory and network bandwidth. The new snowdrift works okay for a minute or two after connecting but then the server soft-disconnects (client is still "in world" and able to do things but only client side, not synced with server). The issue disappears with snowdrift disabled.

User avatar
SAMIAMNOT
Member
Posts: 416
Joined: Wed Sep 03, 2014 00:51
In-game: notanewbie
Location: Desert

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

by SAMIAMNOT » Post

Just curious, does this mod have snow accumulation?
I test mines.

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

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

by paramat » Post

Hmm maybe the server is sending too many particle creation requests to the clients? By default it's 192 every 0.5s per-player.
See if reducing the parameter DROPPOS to a very low number helps.

SAMIAMNOT no not yet, i have thought about it though to add snow to player builds.

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

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

by Astrobe » Post

The snow "dust" (as it is called in the biomes definitions) is a somewhat questionable feature to me. For me, it screws a lot of things (rounded tree trunks, mob spawning, buildings generation, it can let you hop from tree to tree even though you made leaves not walkable...) unless I explicitly account for it and in particular, disable it in the biomes definitions where it is problematic. I would be careful with that imho somewhat questionable feature.

User avatar
Fixer
Member
Posts: 904
Joined: Sun Jul 31, 2011 11:23
IRC: Fixer
In-game: Fixer
Location: Ukraine

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

by Fixer » Post

I love how it is done in minecraft, easy and simple.

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

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

by paramat » Post

Updated to fix a few things and improve:

Tune parameters. Remove broken PRECOFF and replace with a fixed noise threshold. Improve comments. Use clouds bool in set_sky() to remove clouds from overcast sky.

There was a bug in the previous version which caused constant precipitation, now fixed. Now it precipitates roughly 1/3rd of the time. Time scale for precipitation is 5 mins so you may need to wait 5-10 mins to see rain or snow.

Now this is for MT 0.4.16 and later, although it may still work in 0.4.15.

Rochambeau
Member
Posts: 119
Joined: Tue Sep 23, 2014 11:37

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

by Rochambeau » Post

Simply beautiful. My favourite weather mod!

Is it somehow possible to check if it's raining on a player?

I imagine a mod where you catch a cold if you get wet too long. Something like this or that, just with rain.

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

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

by Astrobe » Post

See my comments on July 26th and 27th. I'd like to know if they have been ignored or overlooked.

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

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

by paramat » Post

Neither, i have read them and considered but am currently not interested in doing any of those. I recommend forking the mod and seeing what you can do.
While i am very interested in what improvements people make to this mod (please link me to your code) note that i almost never merge pull requests to snowdrift.

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

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

by paramat » Post

I tried using the Lua voxel manipulator to bulk-read the light values of the area above the player, instead of individual uses of 'get node light', however the LVM turned out to be a little slower for a typical 128-192 light samples.

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

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

by paramat » Post

New version 0.6.2 is at Github.

This adds the ability to spawn multiple raindrops per light-tested position. Each raindrop at a position is given a random spawning height. This enables reducing the number of light-tests while maintaining the visual density of raindrops.
This seems to work best with 2 raindrops per position and this is how the parameters are currently set, this has enabled the number of light-tested positions to be halved to 64 per step. This should make it more lightweight for the server (it will be the same intensity for the client).

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

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

by Astrobe » Post

The code around the day/night ratio is so FUBAR. I took a look at the engine to see how the current light level is computed, expecting a sinus function somewhere. But no... And then someone submits a pull request to "smooth" the transitions that expands this... thing... even more.

Code: Select all

				local r=(1-math.cos(time*2*math.pi))/2 -- YMMV
				if precip then r=r*0.8 end
				player:override_day_night_ratio(r)
				local clouds=player:get_clouds()
				clouds.density=(1 - nval_prec)/2
				player:set_clouds(clouds)

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

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

by Astrobe » Post

This is what I came up with - see attachment. Sorry, no git server link; it is based on an older version of the mod because the latest improvements of Snowdrift are less interesting to me, so I didn't update.

Instead of changing the skybox I use the cloud layer properties - nearly all of them - to make it match the current weather trend. There's lightning strikes to in case of heavy rain (courtesy of the lightning mod).

I also use override_day_night_ratio() to match the luminosity with the current could density. Because it's a per-player property, it doesn't affect any light-based process (plant growth, mobs spawning with Mob Redo).

I've also added a little glow effect to the particles for better effect at night.

There might be other small modifications here and there, I've hacked this mod for so long but didn't keep track.
Attachments
snowdrift.zip
(338.23 KiB) Downloaded 72 times

kestral
Member
Posts: 96
Joined: Mon Mar 27, 2017 21:56
GitHub: kestral246

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

by kestral » Post

Very interesting Astrobe. I didn't know that you could do that with clouds, but then again, I just learned a week or two ago that they removed the cloud height setting and now you need to use a mod for that.

I left your mod running, waiting for rain, and the first time it crashed. You need to add lightning as a dependency. The second time I left it running, I died. If the lightning mod is that annoying, then maybe you should make it an optional dependency.

I need to play with your version some more, it might work nicely with some updates to snowdrift that I'm working on.

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

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

by Astrobe » Post

Oh, sorry, I forgot to mention that it is demo code. I wanted to attach just init.lua at first, but the forum software wouldn't let me, so I zipped the whole thing I am using for my game. I don't intend to fork the mod unless there is a massive demand.

As for the lightning strike, I think you were just unlucky; however I remember tweaking this mod more than a bit, so maybe you need to adjust some of its parameters if it hurts too often.

EDIT: Oh, I understand what happened. The lightning mod has an annoying usability problem: if you don't give lightning.strike() a parameter, it chooses a player randomly; which is not what you want here as players may be under different weather conditions. I hacked it so that it strikes randomly near the position you give it, not at[/it] the position you give it. So if you use the normal mod, it strikes your arse directly. That's why your character died.

kestral
Member
Posts: 96
Joined: Mon Mar 27, 2017 21:56
GitHub: kestral246

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

by kestral » Post

paramat,
You said you were interested in seeing what improvements people could make to this mod—here are mine.

https://github.com/kestral246/snowdrift

Features
  • Instead of two precipitation levels, off and on, plus a randomly delayed overcast sky,
    I have five levels at 25% intervals with corresponding cloud density levels. I do use
    original overcast sky for the highest level.
  • Non-precipitation cloud density is a function of the local humidity level.
  • I also use these five precipitation levels when crossing into dry deserts, but instead
    of one line on the heat-humidity plane, I have multiple parallel lines.
  • Instead of two freeze levels, snow and rain, I again have five levels, where snow and
    rain can also be mixed at 25%, 50%, and 75% proportions based on local temperature.
  • Finally, I have also added initial support for valleys mapgen, with options to use
    altitude_chill and altitude_dry equations for heat and humidity.
This is demo code. It will need manual tuning of parameters, just like the original version.

Note that I have included all my debugging code. If enabled it displays a HUD with:
heat, humidity, ground altitude, freeze level (0-4), precip level / max precip level,
cloud density, and a list of nearest biome names.

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

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

by paramat » Post

Thanks.
//////////////////

I'm currently thinking about the current light-tested position method.
The problem is that at 64 light test positions per 0.5s cycle, 2 raindrops per position, this is 256 'add particle' events per second sent to the client, which is a high rate. Perhaps this has caused problems on some servers, in single player with 1 local client of course this is less of a problem. Normally we are supposed to use a particle spawner instead of many individual 'add particle's.

I could send particle spawners instead and spawn 2 raindrops per light-tested position, this would reduce the particle sends to 128 per second, still high.
Perhaps i might sacrifice some light-test accuracy in order to send fewer spawners and have more particles per spawner, with each spawner covering a slightly larger area like 2x2 or 3x3 nodes. I could add parameters to make this adjustable.

Ideally we would have an ability in particle spawners to send a list of positions for a number of particles, instead of positions being random. This might be worth considering for the API.

User avatar
b3nz0l
Member
Posts: 14
Joined: Wed Mar 28, 2018 22:41

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

by b3nz0l » Post

Raindrops disappear at -1 height, so in an open pit that goes below 0 the ground "stays dry"?

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 4 guests