Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: abstauber on Fri 19/12/2008 17:40:51

Title: MODULE: Yet another weather module
Post by: abstauber on Fri 19/12/2008 17:40:51
Hi,
I make it quick: I've forked akumayos weather module and this is, what came out.
It can do rain, snow, leaves, landslides, bubbles, insects and so on. It also works fine with SSHs SimpleSnow, so you can combine two effects if you like.

Demogame with source included.
Screenshots (although you won't see much on these):
(http://blog.sonores.de/wp-content/uploads/2008/12/weatherquest.PNG)
(http://blog.sonores.de/wp-content/uploads/2008/12/weatherquest2.PNG)

Module:
V2.0 by Monsieur Ouxx:
https://www.dropbox.com/s/vk8o5zwki1vqj7d/weatherquest%202.0.zip
V1.0 from 2008
www.sonores.de/blog/wp-content/uploads/2008/12/weathermod.scm (http://blog.sonores.de/wp-content/uploads/2008/12/weathermod.scm)

Demogame (including the old module)
www.sonores.de/blog/wp-content/uploads/2008/12/weatherquest.zip (http://blog.sonores.de/wp-content/uploads/2008/12/weatherquest.zip)
Title: Re: MODULE: Yet another weather module
Post by: Dualnames on Fri 19/12/2008 18:23:04
Man, you got the scripting germ..
Title: Re: MODULE: Yet another weather module
Post by: pixg on Sun 27/01/2013 10:56:51
the links are broken.
Title: Re: MODULE: Yet another weather module
Post by: MurrayL on Sun 27/01/2013 12:40:50
Screenshots:
(http://blog.sonores.de/wp-content/uploads/2008/12/weatherquest.PNG)

(http://blog.sonores.de/wp-content/uploads/2008/12/weatherquest2.PNG)

Module:
http://blog.sonores.de/wp-content/uploads/2008/12/weathermod.scm

Demogame:
http://blog.sonores.de/wp-content/uploads/2008/12/weatherquest.zip
Title: Re: MODULE: Yet another weather module
Post by: pixg on Sun 27/01/2013 13:23:40
first link is a HTML page with the following...(save as target just saves the html page)

AGSScriptModuleAbstauber, AkumayoWeatherMachine2.07'// Main script for module 'Environment Effects' WeatherModule weather; int WeatherModule::RandomBoundries(int min, int max) { int temp_rand; if ((max-min) < 0) temp_rand = (max-min) *(-1); else temp_rand = max-min; return (Random(temp_rand) + min); } static function WeatherModule::Init(int spritecount, int x_offset, int y_offset) { weather.spritecount = spritecount; Weather_sprites = new DynamicSprite[weather.spritecount]; Weather_enveffect = new Overlay[weather.spritecount]; Weather_slots = new int[weather.spritecount]; weather.x_offset = x_offset; weather.y_offset = y_offset; } static function WeatherModule::SetSprite(int slot, int sprite) { if (slot <= weather.spritecount) Weather_slots[slot] = sprite; else Display("%d",weather.spritecount); } static function WeatherModule::SetOffset(int x_offset, int y_offset) { weather.x_offset = x_offset; weather.y_offset = y_offset; } static function WeatherModule::SetBorders(int x_min, int x_max, int y_top, int y_bottom) { weather.x_min = x_min; weather.x_max = x_max; weather.y_top = y_top; weather.y_bottom = y_bottom; } static function WeatherModule::Start(int envfallingspeed, int envwindspeed, bool pixel_only, int x_jitter, int y_jitter, int x_min, int x_max, int y_top, int y_bottom) { int i; weather.fallingspeed = envfallingspeed; weather.windspeed = envwindspeed; weather.weathergoing = true; weather.pixel_only = pixel_only; weather.x_jitter = x_jitter; weather.y_jitter = y_jitter; weather.y_top = y_top; weather.y_bottom = y_bottom; weather.x_min = x_min; weather.x_max = x_max; int temp_x, temp_y; if (envfallingspeed == 0 && envwindspeed==0) { Display ("Speed values can't be 0 at the same time"); return false; } // make it rain, if no sprites have been supplied if (Weather_slots[0]==0 && weather.pixel_only==false) { weather.pixel_only = true; i=0; while (i 0) { i = 0; while (i < weather.spritecount ) { temp_x = weather.RandomBoundries(weather.x_min, weather.x_max); if (i%2
Title: Re: MODULE: Yet another weather module
Post by: MurrayL on Sun 27/01/2013 13:25:36
Your browser is obviously opening the scm file as a text file for some reason. Right click the link and 'Save Link As', or 'Save Target As', or whatever your browser calls it.
Title: Re: MODULE: Yet another weather module
Post by: pixg on Sun 27/01/2013 13:43:11
ok basicaly after save target i had to rename the file it was going to save from .htm to .srm

I've imported the script, now I just need to figure how to use it, it seems very complicated.
the demo is great, would have been nice to have a help file or tutorial.
Title: Re: MODULE: Yet another weather module
Post by: abstauber on Mon 28/01/2013 09:27:59
OMG, users after 4 years!!  8-0
Hooray!

@MurrayL: Thanks for fixing the links - I've updated the first post.
Title: Re: MODULE: Yet another weather module
Post by: StillInThe90s on Wed 30/01/2013 03:56:55
The warnings.log file in the demo zip shows 25 warnings about dynamic sprites not being deleted.
Could this affect performance?
Title: Re: MODULE: Yet another weather module
Post by: Monsieur OUXX on Wed 03/07/2013 00:05:35
Hi abstauber,

correct me if I'm wrong but this module creates one overlay per particle, therefore there is an upper limit of 20 particles or so? (because of AGS built-in limitations)
Title: Re: MODULE: Yet another weather module
Post by: abstauber on Wed 03/07/2013 09:44:45
I'm afraid that's correct. I wrote it in a time where I didn't know about dynamic sprites and such other wizardry :)

Personally I use the way more advanced (but complicated) Particle System Manager from jarakeen.
Title: Re: MODULE: Yet another weather module
Post by: Monsieur OUXX on Wed 03/07/2013 14:56:35
Quote from: abstauber on Wed 03/07/2013 09:44:45
I use the way more advanced (but complicated) Particle System Manager from jarakeen.
Is it the one that has a flock of bats in its demo? Damn, I was looking for it.

Anyway:
I created a version that uses a single overlay, which allows to go above the "20 particles" upper limit.
You module remains 99% unchanged -- the end-user simply has to pass a boolean in Weather.Init to tell if he wants to use that feature.

I suggest you update the first post of this thread.

Version 2.0
(https://www.dropbox.com/s/vk8o5zwki1vqj7d/weatherquest%202.0.zip)
Title: Re: MODULE: Yet another weather module
Post by: abstauber on Wed 03/07/2013 15:10:19
QuoteIs it the one that has a flock of bats in its demo? Damn, I was looking for it.
It had bats? Are you sure we're talking about the same module? ;D
This is the one I use: http://www.adventuregamestudio.co.uk/forums/index.php?topic=36706.0
Title: Re: MODULE: Yet another weather module
Post by: Crimson Wizard on Wed 03/07/2013 15:19:37
Quote from: Monsieur OUXX on Wed 03/07/2013 00:05:35
correct me if I'm wrong but this module creates one overlay per particle, therefore there is an upper limit of 20 particles or so? (because of AGS built-in limitations)
Too hard to resist ^_^
https://github.com/adventuregamestudio/ags/commit/b12d3aedd6bd388cd8c540987751087098925b46

Spoiler

sadly that version is still pre-alpha and has several weird bugs
[close]
Title: Re: MODULE: Yet another weather module
Post by: abstauber on Wed 03/07/2013 15:21:06
hehe, you rock  :=
Title: Re: MODULE: Yet another weather module
Post by: Monsieur OUXX on Wed 03/07/2013 15:35:24
Quote from: abstauber on Wed 03/07/2013 15:10:19
This is the one I use: http://www.adventuregamestudio.co.uk/forums/index.php?topic=36706.0

I've seen that one but the download link(s) is (are) broken.
Also CW I do know you're on the verge of breaking all the built-in limits (that's great!), but I can't wait, and 3.3.0 is still way too buggy to work with it in my case.

Anyway the update I've posted above works BUT don't you beloved scripters forget that it still doesn't work with sprites that have an alpha channel, because of the well-known limitations to DrawImage (here we draw the particles onto a transparent sprite => no go)
Title: Re: MODULE: Yet another weather module
Post by: Alen101 on Sun 20/12/2015 23:28:09
Im trying to use this module but i want to change the sprite. Instead of a blue pixel, some other sprite.
(Heres is the code im using, its very simple i just want a rain but with my own raindrops.)

Code (ags) Select
WeatherModule.Init(16); // Setup 16 sprites
WeatherModule.Start(-1, 2, false,true,false, 0, 320, 0, 144); // Starts with falling speed 4 and windspeed 1
WeatherModule.SetSprite(Here i dont know what to put to make some other sprite instead of the blue pixel to appear.)


Any ideas?

I downloaded the module and the game and look into the code but it gets complicated,For example he use this
Code (ags) Select
WeatherModule.SetSprite(i, 9);

So that (i), I dont know what the int slot is.

Ive tryed at least to tint the particles with this but i cant make it work.
Code (ags) Select
Weather_sprites.Tint(0, 0, 10, 100, 100);
Title: Re: MODULE: Yet another weather module
Post by: abstauber on Mon 21/12/2015 15:56:22
Quote from: Alen101 on Sun 20/12/2015 23:28:09
Code (ags) Select

WeatherModule.SetSprite(Here i dont know what to put to make some other sprite instead of the blue pixel to appear.)

I downloaded the module and the game and look into the code but it gets complicated,For example he use this
Code (ags) Select
WeatherModule.SetSprite(i, 9);

So that (i), I dont know what the int slot is.

It's been ages since I've used this one. The i is just a counter variable to save some time.

For example you can do this and setup each sprite slot manually
Code (ags) Select

WeatherModule.SetSprite(1, 9);
WeatherModule.SetSprite(2, 9);
WeatherModule.SetSprite(3, 9);
WeatherModule.SetSprite(4, 9);
WeatherModule.SetSprite(5, 9);

Or you use a variable and save a few lines of code. The result is the same.
Code (ags) Select

int i = 1;
while (i < 6) {
    WeatherModule.SetSprite(i, 9);
    i = i + 1;
}

In this example the sprite_slot 9 (your graphic) are being assigned to the weather particles 1 to 5.
Title: Re: MODULE: Yet another weather module
Post by: Alen101 on Mon 21/12/2015 21:52:44
Ah I understand now!
I used this:
WeatherModule.SetSprite(1, 2000);
So the first drop of rain (in my case) should be the default character front view of the presseted game.

but i just see blue 1x1 pixels.
What i am doing wrong?
Is there a setting im not putting in?
like for example i found looking on the autocomplete
Weather_sprites.Tint(10, 20, 30, 100, 100);
this should change at least the color of the blue pixel
but nothing happens.
Title: Re: MODULE: Yet another weather module
Post by: abstauber on Tue 22/12/2015 12:02:29
Take a look at the Start function
WeatherModule.Start(int envfallingspeed = 1, int envwindspeed = 0, bool pixel_only = false,  int x_jitter = false, int y_jitter = false,
                        int x_min = 0,  int x_max = 320, int y_top = -100, int y_bottom = 200);


There is the parameter pixel_only this needs to be set to false in case you want to use sprites. If it is set to true, the second parameter will be interpreted as a color instead of a sprite slot.
Title: Re: MODULE: Yet another weather module
Post by: Alen101 on Tue 22/12/2015 23:57:55
:sad: I understand what you say, but even if i set the parameter to false, i still just see 1x1 blue pixels.
And if i set it to true, i see 1x1 black pixels) I add this because it can give some clue of what could be happening).
here is my code:
Code (ags) Select
WeatherModule.Init(16);
WeatherModule.Start(-1, 2, false,true,true, 0, 320, 0, 144);
WeatherModule.SetSprite(0, 2041);
WeatherModule.SetSprite(1, 2041);
WeatherModule.SetSprite(2, 2041);
WeatherModule.SetSprite(3, 2041);
WeatherModule.SetSprite(4, 2041);
WeatherModule.SetSprite(5, 2041);
WeatherModule.SetSprite(6, 2041);
WeatherModule.SetSprite(7, 2041);
WeatherModule.SetSprite(8, 2041);
WeatherModule.SetSprite(9, 2041);
WeatherModule.SetSprite(10, 2041);
WeatherModule.SetSprite(11, 2041);
WeatherModule.SetSprite(12, 2041);
WeatherModule.SetSprite(13, 2041);
WeatherModule.SetSprite(14, 2041);
WeatherModule.SetSprite(15, 2041);

Maybe other module is mixing with this module or something like that?
(Even if i change the colour parameter you said, i still get only black pixels.)
Title: Re: MODULE: Yet another weather module
Post by: Monsieur OUXX on Sun 20/11/2016 18:25:37
sorry for necroposting but I found something interesting about that module.

If you set a sprite of just one pixel, and then use the settings below, then it looks like a cloud of agitated firebugs flying around rather than atmospheric effects.
Think Monkey island when guybrush walks in the dark forrest, or think flies in a swamp, etc.

Code (ags) Select

    int VERTICAL_SPEED = 1;
    int HORIZONTAL_SPEED = 0;   
   
    int box_top = 0;
    int box_bottom=36;
    int box_left=146;
    int box_right=176;
   
    WeatherModule.Start(VERTICAL_SPEED,   HORIZONTAL_SPEED, false,  2, 2, box_left, box_right, box_top, box_bottom);