Jibble

Author Topic: MODULE: Yet another weather module  (Read 9775 times)

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
MODULE: Yet another weather module
« on: 19 Dec 2008, 17:40 »
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):



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

Demogame (including the old module)
www.sonores.de/blog/wp-content/uploads/2008/12/weatherquest.zip
« Last Edit: 03 Jul 2013, 15:02 by abstauber »

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #1 on: 19 Dec 2008, 18:23 »
Man, you got the scripting germ..
No more military army stuff. I'm alive and back.

Re: MODULE: Yet another weather module
« Reply #2 on: 27 Jan 2013, 10:56 »
the links are broken.


Re: MODULE: Yet another weather module
« Reply #4 on: 27 Jan 2013, 13:23 »
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

Re: MODULE: Yet another weather module
« Reply #5 on: 27 Jan 2013, 13:25 »
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.

Re: MODULE: Yet another weather module
« Reply #6 on: 27 Jan 2013, 13:43 »
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.

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #7 on: 28 Jan 2013, 09:27 »
OMG, users after 4 years!!  8-0
Hooray!

@MurrayL: Thanks for fixing the links - I've updated the first post.

Re: MODULE: Yet another weather module
« Reply #8 on: 30 Jan 2013, 03:56 »
The warnings.log file in the demo zip shows 25 warnings about dynamic sprites not being deleted.
Could this affect performance?

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #9 on: 03 Jul 2013, 00:05 »
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)
 

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #10 on: 03 Jul 2013, 09:44 »
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.

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #11 on: 03 Jul 2013, 14:56 »
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

 

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #12 on: 03 Jul 2013, 15:10 »
Quote
Is 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

Re: MODULE: Yet another weather module
« Reply #13 on: 03 Jul 2013, 15:19 »
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: ShowHide

sadly that version is still pre-alpha and has several weird bugs


abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #14 on: 03 Jul 2013, 15:21 »
hehe, you rock  :=

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #15 on: 03 Jul 2013, 15:35 »
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)
 

Alen101

  • Look behind you! A three-headed monkey!
Re: MODULE: Yet another weather module
« Reply #16 on: 20 Dec 2015, 23:28 »
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: Adventure Game Studio
  1. WeatherModule.Init(16); // Setup 16 sprites
  2. WeatherModule.Start(-1, 2, false,true,false, 0, 320, 0, 144); // Starts with falling speed 4 and windspeed 1
  3. 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: Adventure Game Studio
  1.  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: Adventure Game Studio
  1. Weather_sprites.Tint(0, 0, 10, 100, 100);
« Last Edit: 21 Dec 2015, 00:11 by Alen101 »

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #17 on: 21 Dec 2015, 15:56 »
Code: Adventure Game Studio
  1. 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: Adventure Game Studio
  1.  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: Adventure Game Studio
  1. WeatherModule.SetSprite(1, 9);
  2. WeatherModule.SetSprite(2, 9);
  3. WeatherModule.SetSprite(3, 9);
  4. WeatherModule.SetSprite(4, 9);
  5. WeatherModule.SetSprite(5, 9);
  6.  
Or you use a variable and save a few lines of code. The result is the same.
Code: Adventure Game Studio
  1. int i = 1;
  2. while (i < 6) {
  3.     WeatherModule.SetSprite(i, 9);
  4.     i = i + 1;
  5. }
  6.  
In this example the sprite_slot 9 (your graphic) are being assigned to the weather particles 1 to 5.

Alen101

  • Look behind you! A three-headed monkey!
Re: MODULE: Yet another weather module
« Reply #18 on: 21 Dec 2015, 21:52 »
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.

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: Yet another weather module
« Reply #19 on: 22 Dec 2015, 12:02 »
Take a look at the Start function
Code: [Select]
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.