PLUGIN: Snow/Rain 2.02

Started by Scorpiorus, Mon 03/02/2003 18:43:02

Previous topic - Next topic

Scorpiorus

#20
I see what you're asking for. Currently, drops/flakes are seen through the standart camera. It's usually enough as most background images for AGS games are drawn in a similar perspective but there are exceptions (like a top-down view) or a free camera view (like in Alone in the Dark).
So, I thought about having a way to change the camera position/orientation for a future version.

EDIT:

p.s. Are you after some starfield simulation or what? :)

skw

Hi, great plugin I must say!

Does it always works with both snow and rain, or can you choose between rain and snow? Let's say I want only the rain, but have foggiest idea about scripting. What should I do? ;)
a.k.a. johnnyspade

Cyberion

well you have script commands, which need to be run. Plugin has two seperate commands for snow and rain effect. Just check with the readme file.

And ya, Scorpiorus is an amazing coder ;)

GarageGothic

Quote from: Scorpiorus on Sat 28/05/2005 15:46:26
I see what you're asking for. Currently, drops/flakes are seen through the standart camera. It's usually enough as most background images for AGS games are drawn in a similar perspective but there are exceptions (like a top-down view) or a free camera view (like in Alone in the Dark).
So, I thought about having a way to change the camera position/orientation for a future version.

EDIT:

p.s. Are you after some starfield simulation or what? :)

Sorry, I didn't notice this before now. Thanks for the reply Scorpiorus. Well, yeah, technically I suppose it would work like a starfield simulation :) except that scaling/rotation of raindrops would be a bitch, so I'm not really asking for that. In my case, I'd probably put the center of gravity well below the screen area itself, just to make it fit the perspective and avoid the "curtain" look that it sometime has now, falling straight down.

Jade

#24
Ehmmm...this plugin seems very interesting....but i've difficulties making it work in my game....

I've read the attached file with the instructions...but i dont know how to do the script in a certain room. :-[ Sorry if my question is banal...but i really need to put every rain/snow setting in the room script or what?

For examble...if i want to see begin to rain in a certain room....what main function i've to use?

EDIT: ignore the message above...i solved the problem myself...i've only another question:

If i put this script...

srChangeRainAmount(100); wait(50);
srChangeRainAmount(200); wait(50);
srChangeRainAmount(300); wait(50);


...inside the "if" where timer is expired, every time that rain change amount my game goes in cutscene mode for few seconds...why?

Oh...btw...this plugin is really awesome!  ;D

Jade

Quote from: Scorpiorus on Fri 16/05/2003 22:04:36
No, not for everyone drop. :) Actually if you would play a sound for every drop you don't hear much because of limited number of sound channels. But having a function that returns is there specified amount of drops have fallen could help to organize sounds. Like srIsDropsFallen(int amount) returns 1 if there is 'amount' of drops or less have fallen right now. So you could check it repeatedly to change the sound to play:

repreatedly_execute() {

if (srIsDropsFallen(30) )
Ã,  Ã, PlaySound(1); // for about 30 drops
}
else if (srIsDropsFallen(200) )
Ã,  Ã, PlaySound(2); // for about 200 drops
}
etc.

or maybe using an interval as usual: srIsDropsFallen(int min_amount, int max_amount). :P yep, that's probably better.


Hey Scopiorus....i was thinking to arrange the sounds effect testing the rain amount...

for example:

in my case i set rain amount randomly...so...i've this script:

int ran=random(400);
if (isTimerExpired(i)){
srChangeRainAmount(ran);
if (ran > 100) {
PlayAmbientSound(1, 6, 50,0,0);
}
if (ran > 200){
PlayAmbientSound(1,6,100,0,0);
}
if (ran > 300){
PlayAmbietSound(1,6,200,0,0);
}
settimer(1,1000);
}


In this way i got a nice and credible sound effect that only increase volume with the rain amount.Ã,  :)

Scorpiorus

#26
Quote from: Xarkh on Sat 11/06/2005 17:12:22Does it always works with both snow and rain, or can you choose between rain and snow? Let's say I want only the rain, but have foggiest idea about scripting. What should I do? ;)

You can have it only rain, snow or both at the same time -- there is different functions for rain and snow, look them up in the plugin reference file.

As for an example, the plugin demo game provides with some basic script code to make it work. You can comment out (remove) parts of it responsible for the snow, such as srSetSnowAmount(...) or srChangeSnowAmount(...).


Quote from: Jade on Wed 06/07/2005 09:10:22Sorry if my question is banal...but i really need to put every rain/snow setting in the room script or what?

For examble...if i want to see begin to rain in a certain room....what main function i've to use?
QuoteEDIT: ignore the message above...i solved the problem myself...

I'm glad you solved it; still to mention for anyone may having the same question: typically, you should invoke the initialization functions (such as srSetSnowView, srSetSnowTransparency, srSetSnowFallSpeed etc...) when game starts, that is within the body of the game_start() script function;
and whenever you are going to actually start snow/rain just call srSetSnowAmount or srChangeSnowAmount. You can of course change weather properties at anytime of game's running -- just invoke the init functions again whenever you need.


QuoteIf i put this script...

srChangeRainAmount(100); wait(50);
srChangeRainAmount(200); wait(50);
srChangeRainAmount(300); wait(50);


...inside the "if" where timer is expired, every time that rain change amount my game goes in cutscene mode for few seconds...why?

That's due to how Wait() works -- it actually blocks the script from executing further for the specified amount of time.

What you need is to restrain from using Wait() in that particular case, for example:

at the top of room (or global) script:
Code: ags
int weatherTimer = 15; // any number available within 1..20
int rainAmount = 0; // amount to begin with


room (or global) repeatedly execute:
Code: ags

if (IsTimerExpired(weatherTimer))
{
Ã,  Ã,  if (rainAmount < 300)
Ã,  Ã, {
Ã,  Ã,  Ã,  Ã,  rainAmount = rainAmount + 100;
Ã,  Ã,  Ã,  Ã,  srChangeRainAmount(rainAmount);
Ã,  Ã,  Ã,  Ã,  SetTimer(weatherTimer, 200);
Ã,  Ã, }
}


some event function (to start the timer ticking for the first time):
Code: ags
SetTimer(weatherTimer, 200);



Quotei was thinking to arrange the sounds effect testing the rain amount
Yeah, that should make it. :)

Trisk

Does the Snow/Rain plugin no longer work with AGS 2.71 RC3? It looked great in 2.7, but now that I've ported up I can't see my rain anymore...?

Has anyone else had this problem?

SSH

Yes, this is known. Scorpiorus will have to fix this and he's not aroudn at the moment. However, there is the SimpleSnow moudle by me and Akumayos' weather module
12

Scorpiorus

Oops, seems like the plugin has some sort of a conflict with the new version of allegro that comes along with AGS 2.71, as I see. It's probably some special functionality I used that hadn't been available via the plugin API at the time I wrote it.

Sorry about that, I'll get it fixed (will probably manage to reduce its size a lot as well).

Klytos

Seems to work great now, well done. Thanks.

Scorpiorus

No problem, thanks for letting me know that it works now.

Just want to point it out once more that the last version of plugin doesn't require the "alleg40.dll" file so you may safely remove it from your game's folder *unless*, of course, there is another plugin using that library.

Radiant

#32
Using the R&S plugin with the current v2.72 beta produces a lot of warning messages like this one:

(in room 42): RawDrawImage: Sprite 155 colour depth 16-bit not same as background depth 32-bit

(where the background color depth is in fact 16-bit, just like everything else in the game).

Scorpiorus

I just tried the plugin's demo game (it uses 16bit sprites on a 16bit background) with the currently latest AGS v2.72 beta7 and it works fine.

Are you sure it is plugin-related? Because this kind of warning message is usually common for the RawDrawImage() ags script function. The plugin doesn't produce any warnings explicitly. It may be a result of calling into some plugin API function but I'm not quite sure it's the reason.

Don't you have a RawDrawImage call in your room 42 by any chance, do you?

Goldmund

#34
Are you still working on this?

I'd like to use this great plugin in my game, but are you planning to make it possible to set horizontal boundaries like you can do with vertical? It would be perfect, because using guis to cover "dry" areas makes it impossible for other animations to display correctly (they get covered with guis as well).

Scorpiorus

You mean some sort of a viewport functionality? Yeah, that definitely would be possible, and handy. I made a special version of the plugin for someone in the past to support that. It's kind of an unofficial one though, I doubt it's compatible with the latest version of AGS and I don't have the source code for that branched out version anymore.

I'll see about adding it into the official version, as time permits.

tiagocorreia

I've tried the plugin, and then I open the demo game included, but I got this error and testing the game. I thought the alegro.dll has not needed.

Before I got this illegal exception, I got an error saying that alleg40.dll has not found.

---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x004341A6 ; program pointer is +9016, ACI version 2.72.915, gtags (0,0)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.

Gilbert

Quote from: Scorpiorus on Mon 03/02/2003 18:43:02
A word about installation:
The plugin uses Allegro library which I included to zip file. To use the plugin you have to copy file alleg40.dll to your Windows folder. However I strongly recommened copy this file to the COMPILED folder of every game that uses SnowRain plugin because it must be included in the final game pack!


Did you read this?

SSH

#38
Gilbert, did you read this:  ;) ::) :P

Quote from: Scorpiorus on Sat 04/02/2006 06:29:12
Just want to point it out once more that the last version of plugin doesn't require the "alleg40.dll" file so you may safely remove it from your game's folder *unless*, of course, there is another plugin using that library.

12

Gilbert

Maybe he's still using V2.0 then?

SMF spam blocked by CleanTalk