[Scripts] Rain and Snow

User avatar
Gyrth
Posts: 225
Joined: Sat Sep 10, 2011 10:49 am

Re: [Scripts] Rain and Snow

Post by Gyrth » Sun Jul 28, 2013 5:23 am

Timbles wrote:Is it possible to make each rain particle make a splash effect when they reach the ground?
I'm not sure. I do know that ever drop can leave a decal. But after a few hundred decals the game begins to slow down. I tried it with blood. Looked very apocalyptic.

User avatar
last
Posts: 2154
Joined: Fri Jan 07, 2011 4:02 am
Location: Estonia

Re: [Scripts] Rain and Snow

Post by last » Sun Jul 28, 2013 5:46 am

Gyrth wrote:
Timbles wrote:Is it possible to make each rain particle make a splash effect when they reach the ground?
I'm not sure. I do know that ever drop can leave a decal. But after a few hundred decals the game begins to slow down. I tried it with blood. Looked very apocalyptic.
I tried that to, even tried rain that leaves blood lines on you when the particle hits you, it looked really cool.
Problem with decals are that we need to delete the decals over time somehow to free up some memory for better performance.
It may be possible to make splash particle appear once the rain hit the ground, but i don't know how, at least right now.

User avatar
Gyrth
Posts: 225
Joined: Sat Sep 10, 2011 10:49 am

Re: [Scripts] Rain and Snow

Post by Gyrth » Sun Jul 28, 2013 6:52 am

Timbles wrote:If I ever make a Therium-2, I'm gonna have it snow.
Or rain.
Or have it just do both.

Gyrth, can you give us an example of what 2 level scripts would look in the level .xml?
It's pretty simple. Just put two <Script></Script> in the xml file. Although the order does seem to matter. First the level script and then the rain or snow script. Only then do they both work.
rainandversus.xml
(46.94 KiB) Downloaded 97 times

User avatar
Roter_Fuchs
Posts: 5
Joined: Mon Dec 31, 2012 3:26 pm

Re: [Scripts] Rain and Snow

Post by Roter_Fuchs » Thu Aug 01, 2013 7:37 am

Gyrth wrote:
Timbles wrote:If I ever make a Therium-2, I'm gonna have it snow.
Or rain.
Or have it just do both.

Gyrth, can you give us an example of what 2 level scripts would look in the level .xml?
It's pretty simple. Just put two <Script></Script> in the xml file. Although the order does seem to matter. First the level script and then the rain or snow script. Only then do they both work.
rainandversus.xml
Not really. I've tried the rain mod in Stucco Courtyard Arena. Added the script tags to the xml file. Apart from the fact that the script does not work there because in your code you assume that the character number is 0 (it actually varies), the order is imporant, but doesn't really fix any problems. If your script comes before the test_custom_level.as it does not rain.
If your script comes after the test_custom_level.as, it rains. But the test_custom_level.as is not being loaded (thus breaking the logic).
My guess is whatever script comes last overwrites the Init, HasFocus, DrawGUI and Update functions and is the only one being executed.

A possible solution is taking the code from your update function and adding it the update function of the test_custom_level.as, but that's just messing up the core code.

I have just very recently started taking a look into modding this game, so there are probably a lot of better ways to determine the player character, but this is a quick fix I have found:

Code: Select all

int num_chars = GetNumCharacters();
for(int i=0; i<num_chars; ++i){
    MovementObject@ char = ReadCharacter(i);
        ...
}
Basically it iterates through all characters. Since I guess you only want to create the rain particles near the player (using him as the point of origin) this is definitely not an ideal solution.

/€dit: Just tested it with Grass Beach (versus). Everything is working there if you include the rain.as last. Double checked on Stucco Courtyard Arena, still broken. I really love weird and inconsistent behaviour in programming, always so fun to debug that stuff. :D

User avatar
Anton
pretty cool guy
Posts: 3328
Joined: Fri Oct 17, 2008 8:16 pm
Location: Los Angeles
Contact:

Re: [Scripts] Rain and Snow

Post by Anton » Fri Sep 20, 2013 1:05 pm

I've added these to the community content browser.

However, I did get some errors on the rain one:
Screen Shot 2013-09-20 at 12.14.06 PM.png
Screen Shot 2013-09-20 at 12.14.02 PM.png
They aren't even referring to your own scripts, so I don't know what the issue is.

Otherwise, nice work. :)

Ogaito
Posts: 16
Joined: Wed May 29, 2013 6:19 pm

Re: [Scripts] Rain and Snow

Post by Ogaito » Tue Nov 26, 2013 10:52 am

Sorry for being such a noob, but what do I exactly need to add to the .xml files? Cuz I tried adding the files but it didn't work, It's probably me doing shit though.

Ogaito
Posts: 16
Joined: Wed May 29, 2013 6:19 pm

Re: [Scripts] Rain and Snow

Post by Ogaito » Tue Nov 26, 2013 11:55 am

Ogaito wrote:Sorry for being such a noob, but what do I exactly need to add to the .xml files? Cuz I tried adding the files but it didn't work, It's probably me doing shit though.
Nevermind, I know what to do, but the rain takes out the music from the map, Is that supposed to happen?

User avatar
last
Posts: 2154
Joined: Fri Jan 07, 2011 4:02 am
Location: Estonia

Re: [Scripts] Rain and Snow

Post by last » Tue Nov 26, 2013 12:02 pm

It probably stops because your computer can't handle to play so much sound effectd at the same time

User avatar
Thomason1005
Posts: 712
Joined: Sat Apr 20, 2013 7:44 am
Location: GerMany

Re: [Scripts] Rain and Snow

Post by Thomason1005 » Tue Nov 26, 2013 12:39 pm

last wrote:It probably stops because your computer can't handle to play so much sound effectd at the same time
theres some priority thing for sounds that should avoid this, s.o. Might have to change the priority of the drop sounds
i cant help as it doesnt run at all for me.. :(

Ogaito
Posts: 16
Joined: Wed May 29, 2013 6:19 pm

Re: [Scripts] Rain and Snow

Post by Ogaito » Fri Nov 29, 2013 1:49 pm

last wrote:It probably stops because your computer can't handle to play so much sound effectd at the same time
Hmm.... If you're talking about setup, I'm pretty sure my computer is not the problem, so I have no idea how to solve this :P

User avatar
last
Posts: 2154
Joined: Fri Jan 07, 2011 4:02 am
Location: Estonia

Re: [Scripts] Rain and Snow

Post by last » Fri Nov 29, 2013 2:23 pm

Ok, i may have been wrong. It looks like when there isn't this

Code: Select all

<Script>Data/Scripts/challengelevel.as</Script>
script line in the level then there isn't any background music either.
It's explained here.
I've tried the rain mod in Stucco Courtyard Arena. Added the script tags to the xml file. Apart from the fact that the script does not work there because in your code you assume that the character number is 0 (it actually varies), the order is imporant, but doesn't really fix any problems. If your script comes before the test_custom_level.as it does not rain.
If your script comes after the test_custom_level.as, it rains. But the test_custom_level.as is not being loaded (thus breaking the logic).
My guess is whatever script comes last overwrites the Init, HasFocus, DrawGUI and Update functions and is the only one being executed.

A possible solution is taking the code from your update function and adding it the update function of the test_custom_level.as, but that's just messing up the core code
And looks like there can't be 2 different scripts running side by side.

User avatar
Constance
Overgrowth Modder Deluxe
Posts: 2394
Joined: Sat Mar 17, 2012 12:05 pm
Contact:

Re: [Scripts] Rain and Snow

Post by Constance » Sun Dec 08, 2013 3:20 am

Two ideas for this:
1. Constant loop sound effect for the rain instead of individual drops
2. Snow particles to stick on the ground for 2 seconds, then fade
Otherwise, I wonder if someone can make assets for snow to be placed (other then decals)?

User avatar
Thomason1005
Posts: 712
Joined: Sat Apr 20, 2013 7:44 am
Location: GerMany

Re: [Scripts] Rain and Snow

Post by Thomason1005 » Sun Dec 08, 2013 7:38 am

i still had errors when loading the map (compiling the glsl shader)
is it by david or you?

it used min(float, vec3) and max(float, vec3), but my graphics card or whatever doesnt allow different var types in there

i fixed it to make it work on my pc:
theoraaddsoft.zip
(696 Bytes) Downloaded 75 times
Timbles wrote:Two ideas for this:
1. Constant loop sound effect for the rain instead of individual drops
2. Snow particles to stick on the ground for 2 seconds, then fade
Otherwise, I wonder if someone can make assets for snow to be placed (other then decals)?
3. snowflakes not being circles
4. rendering more distant/more snowflakes with some kind of moving texture

i think 2. requires collision detection, if it was there, these were nice too:
5. splashes from drops hitting the ground
7. not falling through objects
6. changed albedo on wet surfaces (maybe with some kind of decal)
it should be possible, as blood basically does the same

is gyrth still working on this or is it up to us to make updates?

User avatar
akazi
Posts: 1935
Joined: Fri Dec 30, 2011 12:14 pm
Location: Montgomery, Alabama

Re: [Scripts] Rain and Snow

Post by akazi » Sun Dec 08, 2013 9:32 am

Haha! Sweet! Thanks Thomason1005 for that fix, it worked for me too. :mrgreen:

User avatar
Gyrth
Posts: 225
Joined: Sat Sep 10, 2011 10:49 am

Re: [Scripts] Rain and Snow

Post by Gyrth » Tue Dec 24, 2013 4:13 pm

Snow update 24 December 2013
When the character runs, the velocity changes the spawnpoint of the particles.
When the character falls, the spawnpoint is under the character.
1 in 2 particles leaves a decal of snow. They remove every 5 seconds.
Only controlled player characters have snow fall on them.

Post Reply