New rain script

Started by Diarandor, November 10, 2017, 09:40:39 AM

Previous topic - Next topic
You can download from here an updated version of my rain script:
https://github.com/solarus-games/children-of-solarus/tree/master/data/scripts/weather

This new version does not use custom entities anymore. It draws all rain drops on a surface, and only 1 single sprite is used for all the rain. There is also the storm mode, which is more spectacular. And the best of all is that the transition between the 3 modes ("rain", "storm" and nil) is smooth.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Just a testing video:
https://youtu.be/Fbd4etGLC74

The script allows to modify the rain mode of the current map, and also to attach a rain mode to certain world (the rain is automatically started when the hero enters that world). Note that there may be future changes and improvements for the code of the script.

Planned features:
-We will have a snow script too, maybe for next winter holidays. ;D
-I am considering to make a "frog" mode where it rains with frogs too. Maybe for April.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Some issues have been fixed for the rain script. I think it works fine now.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

This looks awesome !

Some suggestions :
- use (semi-transparent?) white rain drops instead of blue ones. Water isn't blue. This is a misconception. In reality, water reflects the colour of the environment. So the only place where you'll find "blue water" is blue is in swimming pools  ;)
- For lightning strokes, I suggest you to use white instead of yellow, or a very pale yellow, close to white. Then draw this surface with a special blend mode like "add" (not multiply), to change colors while keeping shapes.
- Using semi-transparent dark grey/blue as a surface, in "multiply" mode. Make the transparency vary a bit, to simulte a dark cloudy atmsophere.

Quote from: Neovyse on November 11, 2017, 05:25:41 PM
This looks awesome !

Some suggestions :
- use (semi-transparent?) white rain drops instead of blue ones. Water isn't blue. This is a misconception. In reality, water reflects the colour of the environment. So the only place where you'll find "blue water" is blue is in swimming pools  ;)
- For lightning strokes, I suggest you to use white instead of yellow, or a very pale yellow, close to white. Then draw this surface with a special blend mode like "add" (not multiply), to change colors while keeping shapes.
- Using semi-transparent dark grey/blue as a surface, in "multiply" mode. Make the transparency vary a bit, to simulte a dark cloudy atmsophere.

@Neovyse: Thanks a lot for the feedback! I have updated the files to add all your suggestions.
-Water and lightnings are now white, and water has more transparency.
-Storms add a dark surface drawn with "multiply" blend mode. Smooth transition when it appears/disappears.
-The "add" blend mode for lightnings make them look great (much better now!).

One of the annoying parts was to make the smooth transition for the darkness surface for storms, because the "multiply" blend mode does not use the alpha channel, which means that using opacity/transparency on the surface was useless. >:( But I made it in a different way, just by scaling the (r, g, b) coordinates (the color {(255, 255, 255)} seems to be transparent for "multiply" blend mode.)
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

November 12, 2017, 07:10:34 PM #5 Last Edit: November 12, 2017, 07:21:33 PM by MetalZelda
Oh wow, definately gonna use it for my project, this is gonna serve environment purpose I've tough some time ago
Wonder if other effects can be achieved just by modifying your script (snow)

Gonna look around if this script can fit in my Day / Night script

Yes, snow should not be harder than this. But better to make it in a different script because the rain script is already very complex due to the smooth transition between different rain modes (the rain drop number and their properties, and the darkness value, vary very smoothly). If you can wait for Christmas holidays, I will probably make the snow script for then.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

November 14, 2017, 04:26:24 PM #7 Last Edit: November 14, 2017, 04:30:56 PM by MetalZelda
Quote from: Diarandor on November 12, 2017, 08:37:17 PM
Yes, snow should not be harder than this. But better to make it in a different script because the rain script is already very complex due to the smooth transition between different rain modes (the rain drop number and their properties, and the darkness value, vary very smoothly). If you can wait for Christmas holidays, I will probably make the snow script for then.

Snow can be easy to make, just by editing the rain script, it tooks me around 5 minutes to make sprites and edit stuffs and the result is ok (if you take out the green terrain which don't fit the snow weather)
The snow effect is better with the drop deviation variable

Great thing is, it is really easy to include the weather script with my day / night cycle, I don't see any problem so far



Keep track of the last changes (and future ones) here:
https://github.com/solarus-games/children-of-solarus/issues/60
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Testing the new scrolling between maps feature:
https://youtu.be/ZU-7zRnUJcw
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

I think all problems are now fixed. And more customization has been added. Current version may be the last one.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Ahoy there @everybody! There is already a usable version of a SNOW manager too! The code has been adapted from the last version of the rain manager. It is not the final version yet (it will be updated): there are things to do, like adding transparencies to the snow flakes that vary with the time, and also for when they have fallen to the ground (they should disappear smoothly). And maybe other small details.

Note that the current version of the snow manager is already far superior to the one of RPGshit RPGmaker.
I would like you to test it and give me some feedback. ;D
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

The snow script is now finished!!! ;D
-It adds now dynamic transparencies to the snowflakes.
-I have also fixed some minor issues with the rain and snow scripts.

See the script in action:
https://youtu.be/TFIt7Quk4k0

Feedback is welcome (and mandatory!).
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Hail script coming soon! ;D
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

It is much better now, this is awesome, thanks for this awesome script !