Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,486 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Rain slowdown... #3658
05/16/01 00:02
05/16/01 00:02
Joined: Mar 2001
Posts: 1,825
London, England
Keith B [Ambit] Offline OP
Expert
Keith B [Ambit]  Offline OP
Expert

Joined: Mar 2001
Posts: 1,825
London, England
Hi, I've been working on a rain resource but unfortunately it seems to be slowing down the game massively. I was going to put the resource in the user contributions, but there's not much point if it's going to slow down frame rate... My method: I've created a largish .mdl file full of raindrops. This is then cycled down and rotated around the camera to give the illusion that there is rain everywhere (took a looong time to remember my sin and cos for that one), whilst playing a looping rain sound. The rain.mdl is 316kb - would it be the continual movement of this that is causing the slow down?

This is the code:

var x;
var y;
var hyp;
sound rainsnd=<rain.wav>;

action rain
{
//initialisation:
my.passable=on;
my.transparent=on;
play_loop(rainsnd,100);
rainfall.x=0;
rainfall.y=0;
rainfall.z = -15; //speed of rainfall...
create(<rain.mdl>,nullvector,rain_above); //this is only needed if the player can look directly up - and can slow things
hyp=my.max_x*2.5; // can change this ratio, or even just replace with an arbitrary number...
my.z=camera.z-(my.min_z/1.5); //cut this line if stationary (not to follow player)
//main loop:
while(1)
{
my.roll=10; //change to alter slant of rain
my.tilt=0; //change to alter slant of rain
x=cos(camera.pan)*hyp;
y=sin(camera.pan)*hyp;
my.x=camera.x+x;
my.y=camera.y+y;
move(my,rainfall,nullvector);
//cycle position of rain:
if (my.z+(my.max_z/1.5)<camera.z)
{my.z=camera.z-(my.min_z/1.5);}
wait(1);
}
}

Perhaps there is a better way to create rain? Like with particles? If anyone's got any ideas, I'd be really grateful...
Cheers,
Keith

P.S. "Expert"!!??? 75 posts of dumb questions does not an Expert make...


Re: Rain slowdown... #3659
05/16/01 02:18
05/16/01 02:18

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Perhaps I don't understand what you are trying to accomplish with your rain script, but it seems that using a mdl file is a bit unwieldy. I would have thought that a particle effect much like the snow in the office demo would be more effective. Am I missing the point on this one?

------------------
"The problem with the world is that everyone is a few drinks behind."

- Humphrey Bogart


Re: Rain slowdown... #3660
05/16/01 02:28
05/16/01 02:28
Joined: Mar 2001
Posts: 1,825
London, England
Keith B [Ambit] Offline OP
Expert
Keith B [Ambit]  Offline OP
Expert

Joined: Mar 2001
Posts: 1,825
London, England
No... It's more likely that I'm missing the point. I've come to GameStudio from 3D RAd, and 3D RAD has a weather resource with some great looking rain. I was basically converting that into GameStudio. But then, 3D RAD has absolutely no particle effects in it... So I think you're right, particles are the way forward. I just haven't messed around with them much - time to learn... Is that how most games generate rain?
Cheers,
Keith

Re: Rain slowdown... #3661
05/16/01 03:27
05/16/01 03:27

A
Anonymous
Unregistered
Anonymous
Unregistered
A



I'm guessing that most games use something tha at least resembles a particle system. That seems to be the most practical method.

John


Re: Rain slowdown... #3662
05/16/01 03:31
05/16/01 03:31

A
Anonymous
Unregistered
Anonymous
Unregistered
A



I saw your post and modified one of the templates to look a little more like rain. Perhaps you can improve this effect.
code:

/////////////////////////////////////////////////////////////////
BMAP rain_map,<rain.pcx>;
var rain_mode = 0;
var rain_pos;
var rain_rate = 60; // raindrops per second
var rain_counter;

// start rainfall around the player
// original idea by Harald Schmidt
function rainfall()
{
if(player == NULL) { END; }

rain_mode = 1;
while(rain_mode > 0)
{
// all raindrops will start 50 quants above the player
rain_pos.Z = player.Z + player.MAX_Z + 50;

// depending on the frame rate, create several raindrops at the same time
rain_counter = rain_rate * TIME;
while(rain_counter > 0)
{
// place raindrop somewhere near the player
rain_pos.X = player.X + RANDOM(500) - 250;
rain_pos.Y = player.Y + RANDOM(500) - 250;
// now create one drop (emit 1) at this position
emit(1,rain_pos,rain_particle);
rain_counter -= 1;
}
wait(1);
}
}


function rain_particle()
{
// just born?
if(MY_AGE == 0)
{ // this simple rain should do nothing more than fall to earth
MY_SPEED.X = 0;
MY_SPEED.Y = 1;
MY_SPEED.Z = -5; // experiment with this value

// Set the size and color you want (or maybe a bitmap)
MY_SIZE = 20;
// MY_COLOR.RED = 255;
// MY_COLOR.GREEN = 255;
// MY_COLOR.BLUE = 255;

my_map = rain_map;
my_transparent = on;
END;
}

// remove raindrop if below player's feet
if((player == NULL) | | (MY_POS.Z < player.Z - 100))
{
MY_ACTION = NULL;
}
}

ON_R rainfall;


It would nice to figure out how to keep it from raining indoors and how to make puddles on the ground and such.

Here is the particle I used if you want it:

www.spiritshock.com/downloads/rain.zip

[This message has been edited by Eldurin (edited 15 May 2001).]


Re: Rain slowdown... #3663
05/16/01 03:51
05/16/01 03:51

A
Anonymous
Unregistered
Anonymous
Unregistered
A



or probe that

ACTION particle_rain
{
// just born?
IF (MY_AGE ==0)
{ // this simple snow should do nothing more than fall to earth
MY_SPEED.X = 0;
MY_SPEED.Y = 2;
MY_SPEED.Z = -6; // experiment with this value

// set the size and colour you want (or maybe a bitmap)
MY_SIZE = 20;
MY_COLOR.RED = 150;
MY_COLOR.GREEN = 150;
MY_COLOR.BLUE = 150;
END;
}


Re: Rain slowdown... #3664
05/16/01 04:39
05/16/01 04:39

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Ambit,

I would recommend using 2 or 3 layers of animated sprite billboards that surround the camera in a box. Plan them like a cloud layer, where the different depths move at different speeds.

I havent tried this theory, but I would expect it to render much faster than a model of rain.

On the other hand, particles may be the way to go, depending on how well A5 handles them.

Just my 2 cents...

-Aaron Sallade

------------------
"Dare to Do, what others Dare to Dream..."

Currently Recruiting for a Commercial CRPG Project based on a Published Pen & Paper Game:
www.talislanta.com
www.tamerlin.com
www.talislanta.com/talislanta/images/talpromo-56.ram
See our thread in 'User Projects' Forum


Re: Rain slowdown... #3665
05/16/01 05:14
05/16/01 05:14

A
Anonymous
Unregistered
Anonymous
Unregistered
A



The particles work well for me, I used the snow template and nearly doubled the amount of particles, then added in Neutron Blue's lightning script and my fog script and still had great results!

------------------
"The problem with the world is that everyone is a few drinks behind."

- Humphrey Bogart


Re: Rain slowdown... #3666
05/16/01 06:58
05/16/01 06:58

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Just a few ideas:

1. Assign a random falling speed so all the drops dont fall at the same rate.

2. At a random interval make the raindrops float up a little bit, done right this will give the illusion of wind.

Just some ideas...

Brandon


Re: Rain slowdown... #3667
05/16/01 07:08
05/16/01 07:08

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Good thoughts, Brandon. Do you have any idea how to keep it from raining or snowing indoors?

Page 1 of 3 1 2 3

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1