Page 2 of 3

Re: [Scripts] Rain and Snow

Posted: Sun Jul 28, 2013 5:23 am
by Gyrth
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.

Re: [Scripts] Rain and Snow

Posted: Sun Jul 28, 2013 5:46 am
by last
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.

Re: [Scripts] Rain and Snow

Posted: Sun Jul 28, 2013 6:52 am
by Gyrth
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

Re: [Scripts] Rain and Snow

Posted: Thu Aug 01, 2013 7:37 am
by Roter_Fuchs
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

Re: [Scripts] Rain and Snow

Posted: Fri Sep 20, 2013 1:05 pm
by Anton
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. :)

Re: [Scripts] Rain and Snow

Posted: Tue Nov 26, 2013 10:52 am
by Ogaito
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.

Re: [Scripts] Rain and Snow

Posted: Tue Nov 26, 2013 11:55 am
by Ogaito
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?

Re: [Scripts] Rain and Snow

Posted: Tue Nov 26, 2013 12:02 pm
by last
It probably stops because your computer can't handle to play so much sound effectd at the same time

Re: [Scripts] Rain and Snow

Posted: Tue Nov 26, 2013 12:39 pm
by Thomason1005
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.. :(

Re: [Scripts] Rain and Snow

Posted: Fri Nov 29, 2013 1:49 pm
by Ogaito
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

Re: [Scripts] Rain and Snow

Posted: Fri Nov 29, 2013 2:23 pm
by last
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.

Re: [Scripts] Rain and Snow

Posted: Sun Dec 08, 2013 3:20 am
by Constance
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)?

Re: [Scripts] Rain and Snow

Posted: Sun Dec 08, 2013 7:38 am
by Thomason1005
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?

Re: [Scripts] Rain and Snow

Posted: Sun Dec 08, 2013 9:32 am
by akazi
Haha! Sweet! Thanks Thomason1005 for that fix, it worked for me too. :mrgreen:

Re: [Scripts] Rain and Snow

Posted: Tue Dec 24, 2013 4:13 pm
by Gyrth
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.