Hi,

I am trying to realize a rain effect. First I tried to accieve this with particle effects. See here: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=402970&page=2

But the particels stay allways in direction of the cameraview. That isnt very realistic. So I trying to get a better raineffect with entityraindrops, so no particles.

The problem with my code is, that the fps is down very fast. Does anybody have an idea, what I could do, to increase the performance? By the way, this raincode is taken and rewritten form the "amazing weather script": http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=341869&page=1

Quote:

function toggle_rain()
{
rain_on += 1;
rain_on %= 2;

VECTOR rain_origin;
var i_temp;

if (rain_on)
rain_handle = snd_loop(rain_wav, 50, 0);
else
snd_stop(rain_handle);


while (rain_on)
{
for(you_temp_1 = ent_next(NULL); you_temp_1; you_temp_1 = ent_next(you_temp_1))
if(you_temp_1.rain == 1)
if(you_temp_1.z <= 0)
ent_remove(you_temp_1);

//rain area 1
i_temp = 0;
while (i_temp < 90) // that's a "while without wait" loop
{
rain_origin.x = camera.x + 1000 - random(2000);
rain_origin.y = camera.y + 1000 - random(2000);
rain_origin.z = camera.z + 500;

rain_pointer=ent_create(rain_tga, rain_origin, NULL);
rain_pointer.rain = 1;
i_temp += 1;

set(rain_pointer, PASSABLE | TRANSLUCENT | BRIGHT /*| UNLIT*/ ) ; // remove the comment to increase the brightness of the rain sprites
rain_pointer.alpha = 20 + random(75);
rain_pointer.ambient = 40 + random(60);
}

//rain area 2
i_temp = 0;
while (i_temp < 20) // that's a "while without wait" loop
{
rain_origin.x = camera.x + 400 - random(800);
rain_origin.y = camera.y + 400 - random(800);
rain_origin.z = camera.z + 600;

rain_pointer=ent_create(rain_tga, rain_origin, NULL);
rain_pointer.rain = 1;
i_temp += 1;

set(rain_pointer, PASSABLE | TRANSLUCENT | BRIGHT /*| UNLIT*/ ) ; // remove the comment to increase the brightness of the rain sprites
rain_pointer.alpha = 20 + random(75);
rain_pointer.ambient = 40 + random(60);
}




//if (c_content(my.x, 0) == CONTENT_SOLID)
//{
//my.alpha = 0;
//}

for(you_temp_1 = ent_next(NULL); you_temp_1; you_temp_1 = ent_next(you_temp_1))
if(you_temp_1.rain == 1)
{
you_temp_1.z -= (25 + random(30)) * time_step;

//Winddirection
//you_temp_1.x += (2 + random(10)) * time_step;
//you_temp_1.y += (2 + random(10)) * time_step;
}

wait (1);
}
}


thanks


Version: A8 free
OS: Windows 10