RPG Template

Top  Previous  Next

Last month I have told you that we're wrapping up the RPG template, so that's what I have started to do. I have fixed a few bugs, including an embarrassing main menu bug (the player was unable to restart the game after being killed), but then it hit me: we don't have a weather effects script to go with the RPG template! This meant more work for me, but I am happy to present one of the most customizable particle effect actions that I have ever created.

 

But before we begin studying the options, here's the content of the weather script: snow, rain, wind and day / night transitions, all working in perfect harmony - you'll understand what I mean soon.

 

Let's begin with the rain effect; it looks much better in motion, of course.

 

aum108_templates1

 

As mentioned before, you have total control over lots of parameters, but let's see how the snow effect looks like for now:

 

aum108_templates2

 

What about the day / night transitions? Here's how the night looks like:

 

aum108_templates3

 

And this is a shiny day!

 

aum108_templates4

 

I have told you that we've got lots of customizable options - here they are:

 

aum108_templates5

 

To begin with, each weather effect is triggered when the player approaches an invisible entity; this way, you can have rain in an area of the level and snow in another area. The "Particle_start" skill sets the distance to the player that will trigger the weather effect;
Particle_end" stops the effect as soon as the player has moved away the specified number of quants. This means that your Particle_start values should always be smaller than Particle_end.

 

Particle_fade sets the particle fading speed; smaller values will make the particles disappear after a longer time. Particle_speed x, y, z give the horizontal (x, y) and vertical (z) particle movement speed. Particle_alpha sets the average transparency / alpha value for the particles; smaller values will make the particles more transparent.

 

You can set the Particle_size value as well, and Particle_sound sets the weather effect sound volume, no matter if we are talking about snow or rain. Particle_density should be tweaked carefully; it sets the number of generated particles per frame, so it can bring down the frame rate if you aren't careful.

 

Particle_area will generate the particles in a virtual square that has the player in its center and the specified size. Here's an example: for the default value of 1,000 quants, the weather particles are generated inside a virtual square of 2,000 x 2,000 quants that has the player in its center. Particle_height sets the height (in quants) above player's head where the particles will be generated. The smaller the value, the higher the frame rate, of course.

 

Finally, the Wind_strength skill sets the strength of the wind. And yes, the wind influences not only the direction of the particles, but also player's movement, pushing it according to the wind's direction.

 

The flags are pretty much self-explanatory; "Snow" and "Rain" generate the corresponding weather effect, and "Wind_moves" tells the code to move the player if there's wind in the level (or not). The last four flags set the direction of the wind; you can combine them as you wish, creating (let's say) a NE wind which will push the player SW. The direction of the particles will follow the same rule imposed by the wind, of course.

 

It's time to examine the weather template script; it's simple, but it does a few useful things for us:

 

aum108_templates6

 

The first option enables or disables the day / night transitions; set it to 1 if you want to enable them. The Day / Night transition interval will set the duration of the transition between day and night (as well as the night / day transition, of course). The Day / Night duration will set the length of the day and the length of the night. With the default values, a full day / night transition will last a few minutes.

 

What about Night darkness? Some people want to have a very dark night in their games; they are the ones that will set this value to 100. The others, who want to be able to see at least some of the things around them, should use smaller values here.

 

That's it! I'm pretty sure I'll wrap up the RPG template next time, provided that I don't get another set of exciting ideas.