Author Topic: New rain script  (Read 272 times)

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
New rain script
« on: November 10, 2017, 09:40:39 am »
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.

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #1 on: November 11, 2017, 07:21:03 am »
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.

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #2 on: November 11, 2017, 03:36:29 pm »
Some issues have been fixed for the rain script. I think it works fine now.

Neovyse

  • Administrator
  • Jr. Member
  • *****
  • Posts: 91
    • View Profile
Re: New rain script
« Reply #3 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.

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #4 on: November 12, 2017, 11:07:59 am »
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.)

MetalZelda

  • Hero Member
  • *****
  • Posts: 511
    • View Profile
Re: New rain script
« Reply #5 on: November 12, 2017, 07:10:34 pm »
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
« Last Edit: November 12, 2017, 07:21:33 pm by MetalZelda »

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #6 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.

MetalZelda

  • Hero Member
  • *****
  • Posts: 511
    • View Profile
Re: New rain script
« Reply #7 on: November 14, 2017, 04:26:24 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


« Last Edit: November 14, 2017, 04:30:56 pm by MetalZelda »

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #8 on: November 15, 2017, 12:27:04 pm »
Keep track of the last changes (and future ones) here:
https://github.com/solarus-games/children-of-solarus/issues/60

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #9 on: November 15, 2017, 02:00:55 pm »
Testing the new scrolling between maps feature:
https://youtu.be/ZU-7zRnUJcw

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #10 on: November 15, 2017, 03:49:05 pm »
I think all problems are now fixed. And more customization has been added. Current version may be the last one.

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #11 on: November 16, 2017, 03:11:26 pm »
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

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #12 on: November 16, 2017, 11:41:17 pm »
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!).

Diarandor

  • Hero Member
  • *****
  • Posts: 805
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #13 on: November 17, 2017, 03:20:35 pm »
Hail script coming soon! ;D

MetalZelda

  • Hero Member
  • *****
  • Posts: 511
    • View Profile
Re: New rain script
« Reply #14 on: November 18, 2017, 01:14:59 pm »
It is much better now, this is awesome, thanks for this awesome script !