Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: jerakeen on Mon 26/01/2009 19:57:29

Title: MODULE: ParticleSystemManager v1.01
Post by: jerakeen on Mon 26/01/2009 19:57:29
Hi, for the last weeks i been working on it and now i share for you.

This module has been built to simulate effects like rain, waterfall, fire, smoke,
snow and others.

We can have some particle systems at the same time.
We can define some forces wich modifies particles velocity and position.
We can change color, transparency and scale of particles.
And we can choose between draw a particle system in the background of a room,
in a sprite or using an overlay.

Requires AGS V3.0.0 or later

Screenshots

Here is the module (Vers 1.00):
 
  Module ParticleSystemManager v1.00
   (http://duals.agser.me/Modules/ParticleSystemManager_v1.0.rar)
And a demo (in AGS v3.1.1)

  ParticleSystemManager Demogame (http://www.2dadventure.com/ags/ParticleSystemManagerDEMOsource.zip)

  ParticleSystemManager Exe (http://www.2dadventure.com/ags/ParticleSystemManager-DEMO-exe.zip)


Edit by Dualnames: Removed links that don't work

In the demo game you can do player walk around to see how slow or fast the game is using particle system.

When drawing particle system in a sprite, you can use this sprite in a room's object and do the player walk around and interact with it.

Remember that too many particles will slow down the game.

NOTE: There are some problems drawing transparent particle system in sprites


EDIT:

There is a new release of the module.
These are the changes:

<11-JAN-09> Jerakeen,

      Created original version

<08-APR-09> Jerakeen,

      Replaced RawSaveScreen by DrawingSurface functions.

<17-APR-09> abstauber,

      Add emitter_set_certain_sprites function and changes to manage
      the sprites of the first particles in the system.

<20-APR-09> Jerakeen,

      Add emitter_set_sprites_indexes function and changes to manage
      sprites with non consecutive index.

And here is the module:


   Module ParticleSystemManager v1.01   (http://www.2dadventure.com/ags/ParticleSystemManager-V0101.zip)


Edit by Dualnames: Removed links that don't work


  Thanks to abstauber by the function emitter_set_certain_sprites and code modifications.

Enjoy it
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: GarageGothic on Mon 26/01/2009 20:04:41
Looks very nice. However, I get 0 byte files when trying to download the demo and the demo source files :(
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: on Mon 26/01/2009 20:22:29
Download works okay for me, and the module defenitely looks interesting. Thanks for sharing!
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: jerakeen on Mon 26/01/2009 20:23:23
Try again the same links, it should work
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: GarageGothic on Mon 26/01/2009 20:49:07
Yup, now it works. But I swear, I tried downloading each file four times earlier, both through direct click and right-click-save-as, and I all I got was "download finished" with a 0 byte file.

Great work jerakeen! The demo is very convincing.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: jerakeen on Mon 26/01/2009 21:07:57
Sorry, the links were broken and i upload the files again, then Ghost could download ok and you too.

I hope you found this module useful.

i'm sure i'll add some improvements in the future.

thanks
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: Khris on Tue 27/01/2009 15:05:26
Nice work!
It looks like the snow and rain particles accelerate their fall though; this isn't true in real life and thus looks weird.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: jerakeen on Tue 27/01/2009 18:17:50
Quote from: KhrisMUC on Tue 27/01/2009 15:05:26
Nice work!
It looks like the snow and rain particles accelerate their fall though; this isn't true in real life and thus looks weird.

Thank you. This is only a demo. If you take a look to the code int Room1, you will see than changing initial velocity (emitter_set_velocity) and removing the force (action_add_force)  in y negative you'll achieve what you want.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: Khris on Tue 27/01/2009 19:13:12
Ah, ok, I didn't look at the source code yet.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: Dualnames on Wed 28/01/2009 15:08:39
Looks awesome..
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: Rocco on Thu 29/01/2009 12:22:52
great work,  :)
covered nearly all circumstances.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: Joe on Fri 27/02/2009 00:23:11
This is INCREDIBLE!!! :o

I'm really really impressed. CONGRATULATIONS!!!
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: redspark on Sat 04/04/2009 13:48:00
I'm using AGS 3.1.2 SP1 and I get errors for RawScreenSave() and RawScreenRestore() in my project which was created in 3.1.2 SP1 but I don't get the errors when I compile the demo in this version of AGS.  According to the documentation, those functions are obsolete now.  I'm going to replace them with DrawingSurface functions but I'm pretty new to AGS and I'm not sure what I'm doing. ;)  Is there a better way to do this?  Thanks.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: jerakeen on Mon 06/04/2009 13:36:28
Quote from: redspark on Sat 04/04/2009 13:48:00
I'm using AGS 3.1.2 SP1 and I get errors for RawScreenSave() and RawScreenRestore() in my project which was created in 3.1.2 SP1 but I don't get the errors when I compile the demo in this version of AGS.  According to the documentation, those functions are obsolete now.  I'm going to replace them with DrawingSurface functions but I'm pretty new to AGS and I'm not sure what I'm doing. ;)  Is there a better way to do this?  Thanks.

Hi, you can compile it changing some parameters in "General Settings" pane, in Scripting section there are 2 options: "Enforce new-style strings" and "Enforce object-based scripting". If you set both of them to false im sure it will compile using RawScreenSave() function.

I'll change this function in the future.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: redspark on Mon 06/04/2009 13:44:16
Ok.  I'll give that a try.  Thanks.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: Dualnames on Wed 08/04/2009 08:37:42
It works brilliantly, just wanting you to know that. It's fairly more customizable and user-friendly than Akumayo's Particle Engine. Not to mention its also faster. Akumayo's needed at least 2Ghz to work in a smooth way.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: jerakeen on Thu 09/04/2009 12:00:30
Thanks Dualnames. But i think my module is sill sloooow.

Im trying to change some thing to improve it.
Title: Re: MODULE: ParticleSystemManager v1.0
Post by: Dualnames on Thu 09/04/2009 15:31:53
Quote from: jerakeen on Thu 09/04/2009 12:00:30
Thanks Dualnames. But i think my module is sill sloooow.

Im trying to change some thing to improve it.

Check Akumayos. That's slow. Mostly because of the rawdraw.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: jerakeen on Mon 04/05/2009 18:27:04
Hi, there is a new version of the module, with minor changes.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: redspark on Mon 04/05/2009 19:00:06
Thank you!  I'm going to download this and give it a try.  Thanks again.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: abstauber on Mon 04/05/2009 21:18:03
Thanks for this new release (and mentioning me  := )!

I'm sure, there are a lot projects which will love your module. Any chance, you make something else this fancy?  ;D
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: jerakeen on Wed 06/05/2009 20:47:06
i'm afraid not. I had no time to implement further changes right now.

I was thinking on implement something like rules, so when a condition is meet then an action or change on particles is done.

Something like if particle's age is greater than 12 change sprite, or if there are 20 particles on the system change the force.

i thing this will useful to make the system change, for example change fire into smoke.

But this will be to many code and i got no time by now.

Title: Re: MODULE: ParticleSystemManager v1.01
Post by: DavidCB on Wed 10/06/2009 08:30:12
There is a small problem in this new version of AGS, RawSaveScreen and RawRestoreScreen are unknown commands.
If you want to replace with DrawingSurface, you need global variables.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: jerakeen on Thu 11/06/2009 11:03:39
Quote from: DavidCB on Wed 10/06/2009 08:30:12
There is a small problem in this new version of AGS, RawSaveScreen and RawRestoreScreen are unknown commands.
If you want to replace with DrawingSurface, you need global variables.

I know, because of this, there is a new version of the module, in the original post there is a new link to the "release" ModuleParticleSystemManager v1.01
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: R4L on Mon 28/12/2009 14:51:07
Hello, I don't mean to bump an old topic, but could you help me please?

I'm using AGS 3.1, and I'm trying to set up some rain to fall in a room. I'm following the readme, but I keep getting a parse error. I haven't scripted anything in a while, so it could be that I'm placing things in the wrong spots, or just flat out doing it wrong.

Here's my room script:

// room script file

int num_systems;

function CreateSystem (int 25, bool keep_track = false, enDrawType draw_type = dtBackground, int width = 640 , int height = 480);

function emitter_creation_mode (int system, enRepeatMode rmAllways, int max_rep, int 40, int 2);


I know something is wrong, I just can't figure it out. Any help is greatly appreciated. :)
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Dualnames on Mon 28/12/2009 20:29:26
Quote from: R4L on Mon 28/12/2009 14:51:07
Hello, I don't mean to bump an old topic, but could you help me please?

I'm using AGS 3.1, and I'm trying to set up some rain to fall in a room. I'm following the readme, but I keep getting a parse error. I haven't scripted anything in a while, so it could be that I'm placing things in the wrong spots, or just flat out doing it wrong.

Here's my room script:

// room script file

int num_systems;

function CreateSystem (int 25, bool keep_track = false, enDrawType draw_type = dtBackground, int width = 640 , int height = 480);

function emitter_creation_mode (int system, enRepeatMode rmAllways, int max_rep, int 40, int 2);


I know something is wrong, I just can't figure it out. Any help is greatly appreciated. :)

Here's what I'm using for Hitchhiker's



//I use the following part into a module.

ParticleSystemManager PS;
int wind_force_index;
float wind_force;



function ParticleEffects(int effect) {
if (effect==1) {//Smoke Effect
int s;   
s = PS.CreateSystem(240, false, dtBackground);
PS.emitter_creation_mode(s, rmAllways, 0, 1, 25);
PS.emitter_set_position(s, ptPoint,16.5, 41.0);
PS.emitter_set_sprite (s, 931, 941);
PS.emitter_set_velocity (s, 10, 30, 270, 310);
PS.emitter_set_transparency (s, 71, 99);
PS.emitter_set_age (s, 100, 200);
wind_force = 1.5;
wind_force_index = PS.action_add_force (s, ftConstant, wind_force, 0.0);
PS.action_add_force (s, ftRandom, -2.0, 0.0, 2.0, 0.0);
PS.action_set_transparency_evolution (s, 100, 7);
PS.action_set_bound_box (s, 0, 0, 320, 120);
}
if (effect==2) {//Wind Effect
int s;
s = PS.CreateSystem(100, false, dtBackground);
PS.emitter_set_sprite (s, 432, 435);
PS.action_set_bound_box (s, 0, 0, 320, 200);
PS.emitter_creation_mode (s, rmAllways, 0, 1, 10);
PS.emitter_set_velocity (s, 15, 20, 290, 320);
PS.action_add_force (s, ftConstant, 9.8, 0.0);
PS.emitter_set_position (s, ptBox, 0.0, 0.0, 320.0, 240.0);
PS.emitter_set_transparency (s, 45, 99);
PS.emitter_set_age (s, 0, 60);
}
if (effect==3) {//Explosion
int s;
s = PS.CreateSystem(350, false, dtBackground);
PS.emitter_set_sprite (s, 386, 388);
PS.emitter_creation_mode (s, rmNumberOfTimes, 1, 1, 350);
PS.action_set_bound_box (s, 0, 0, 640, 480);
PS.emitter_set_position (s, ptPoint, 80.0, 105.0);
PS.emitter_set_velocity (s, 10, 70, 0, 360);
PS.emitter_set_transparency (s, 20, 90);
PS.emitter_set_age (s, 200, 300);
PS.action_add_force (s, ftConstant, 0.0, 8.0);
}
}


//Inside a room's script I do this:

function room_Load() {
ParticleEffect(1);//Just once because the effect is already set to run constantly
}

//I use the following part of code to auto-remove particles when a room changes.
function on_event (EventType event, int data) {
if (event==eEventLeaveRoom) {
if ((data==11) || (data==23)|| (data==26)|| (data==36)|| (data==35)|| (data==34) || (data==28) || (data==19)) {// Rooms
while (PS.num_systems) {
PS.DeleteLastSystem();
}
}



Hope that helps a little.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: R4L on Wed 30/12/2009 06:04:49
Thanks Dualnames. I'd rather not copy the code, because I'd like to figure it out myself and get back into coding, but it's confusing me too much. :)

Thanks again.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: FrancoFranchi on Sun 20/06/2010 17:37:23
Sorry for bumping an old thread, but does anyone have a mirror of this file (and the demo)?  Didn't realise AGS could do this and its given me some new inspirations.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Dualnames on Sun 20/06/2010 21:52:09
Not sure if I changed the demo or not. But here it as officially distributed:

http://www.mediafire.com/file/z3mtmy1wzhw/ParticleSystemManager.zip

EDIT: This is version 1.00 and not the last that Jerakeen distributed.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: cubehouse on Mon 28/06/2010 17:57:49
I don't know what is up with this 2dadventures website, it's destroyed a load of plugins and modules.

Has anybody got the latest version? Or at least a clue how to fix the RawRestoreScreen() problem?
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Calin Leafshade on Mon 28/06/2010 18:16:06
i think you can actually just delete that line and everything still works
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: cubehouse on Tue 29/06/2010 00:00:12
Quote from: Calin Leafshade on Mon 28/06/2010 18:16:06
i think you can actually just delete that line and everything still works

nah, it leaves trails of the particles behind - it needs to reload the original background before it redraws the particles on it (looks cool, but not my intended effect ;) )
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: cubehouse on Tue 29/06/2010 00:18:05
Ok, gave editing it a shot to update it to (I'm using 3.2, so can't confirm for other versions).

Basically, in the script, add this variable (below line "int num_systems;"):

DrawingSurface *orig;


Replace:

RawRestoreScreen ( );

With:

DrawingSurface *back = Room.GetDrawingSurfaceForBackground();
back.DrawSurface(orig);


Replace:

RawSaveScreen();

With:

orig = Room.GetDrawingSurfaceForBackground();
orig = orig.CreateCopy();
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: tzachs on Mon 26/07/2010 22:34:57
Hi, this is an awesome module, with many functions, unfortunately it slowed down my character walk speed immensely so I won't be able to use it for my current game.

Anyways, just wanted to report what I believe to be a small bug.
In ParticlesSystem::Delete (), the following line should be added:
  num_sprites -= this.num_spr;

This will avoid crashing the game if it runs a lot of particle effects througout the game...
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Joe on Wed 28/07/2010 13:24:56
Quote from: tzachs on Mon 26/07/2010 22:34:57
unfortunately it slowed down my character walk speed immensely so I won't be able to use it for my current game.

I think if you activate the 'split resource files' option then your game won't slow that much.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: tzachs on Wed 28/07/2010 20:24:45
Thanks for the suggestion, I tried 1Mb split, it may have improved a bit, I'm not quite sure, but it's still too slow...
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: AGD2 on Mon 20/01/2014 10:23:25
Sorry for the bump, but I was wondering if anyone knows how to get this module working so that the particle system gets drawn on to a dynamic sprite/drawing surface, which could then be displayed on a room object (so you could set baselines and have the particles disappear behind walkbehinds etc.)?

Sadly, even after implementing cubehouse's code in the above post, using s = PS.CreateSystem(300, false, dtSprite); will result in no particles showing up in the game. Any ideas? Thanks!
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: jerakeen on Tue 21/01/2014 18:33:55
Hi, Right now i can't help with this. I don't remember  anything  about the module :sad:

in fact i hadn't read the whole post and i don't know if the old link is working, so here is the link to the last version i had.

Particle System Manager v0101 (https://www.mediafire.com/?kg0u5c22o6545al)

I hope it will useful to you.

i'm sorry i can't help.

bye
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: jerakeen on Tue 21/01/2014 18:35:54
Pd. Give me some time, please, to upload again the examples and other files, and read and study them to see if i can help.
There was some time since i was in AGS world ...
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: AGD2 on Wed 22/01/2014 11:56:01
Excellent, thanks for the updated module, jerakeen! :)

Running this under the latest AGS 3.3.0 beta, there was an issue with all the particles being drawn as blue cups (default sprite) and it was also very slow. It was possible to work around this by replacing this line:

AllParticlesSystems[num_system].num_spr = max_slot - min_slot + 1;

With these two lines:

  AllParticlesSystems[num_system].num_spr = max_slot - min_slot;
  AllParticlesSystems[num_system].num_spr ++;


The included readme.txt file also brought my attention to the existence of this function:

QuoteDynamicSprite *GetSystemSprite (int system);

    Returns the sprite of the system if we draw on sprite or Overlay.
    We can use later this sprite in a Room's object so player can walk behind and
    in front of the system.

However, I can't figure out how to get that dynamic sprite showing on a room object. If I do this:

object[4].Graphic=PS.GetSystemSprite(s);

... it obviously doesn't work, so if you get a chance to look over it, that would be highly appreciated!

PS. The readme.txt also says " NOTE: Drawing particles transparent on a sprite or overlay doesn't work properly", but even if I set it to draw on dtSprite and set the particles transparency to 0, the particle system still doesn't visibly show in the game.

Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Monsieur OUXX on Tue 25/03/2014 18:13:49
I also found another bug. There seems to be an issue with function DrawingSurface.DrawImage(...) when the transparency given in parameter is 0. It crashes the game brutally, even in Debug mode.

The issue happens at this script line of the module :

Spoiler

Code (ags) Select

surface.DrawImage (FloatToInt ( AllParticles[i].x ), FloatToInt ( AllParticles[i].y ), sprite.Graphic, AllParticles[i].transparency, width, height);

[close]

If you want to avoid the error, then simply make sure that the transparency is never exactly zero.
For example you can add those two lines of script just before the line causing the error :


Spoiler

Code (ags) Select

if (AllParticles[i].transparency ==0)
    AllParticles[i].transparency = 1;

surface.DrawImage (FloatToInt ( AllParticles[i].x ), FloatToInt ( AllParticles[i].y ), sprite.Graphic, AllParticles[i].transparency, width, height);

[close]


==========

However the issue mentionned by AGD2 remains : Sprites are drawn as blue cups.



the issue was found, it's not caused by the module.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Crimson Wizard on Tue 25/03/2014 22:09:32
Quote from: Monsieur OUXX on Tue 25/03/2014 18:13:49
However the issue mentionned by AGD2 remains : Sprites are drawn as blue cups.


I do not observe this effect, particles are drawn as normal sprites for me.

My code:
Code (ags) Select


function room_AfterFadeIn()
{
  ParticleSystemManager pm;
  int psys = pm.CreateSystem(100, false, dtOverlay);
  pm.emitter_creation_mode(psys, rmAllways, 100, 100, 5);
  pm.emitter_set_position(psys, ptCirle, 100.0, 50.0, 150.0);
  pm.emitter_set_sprite(psys, 0,  10);
  pm.emitter_set_age(psys, 100, 5000);
}


Also I have no problem with transparency being 0... In fact transparency = 0 is default value for DrawImage function.
Does it happen to you if you call DrawImage yourself?

Can you post example of initialization code that causes such effect?
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Monsieur OUXX on Wed 26/03/2014 18:18:49
In the meantime I found the cause and it's really really stupid : DrawImage fails on backgrounds (with weird side effects) when you didn't explicitly set a background image for your room. I assumed the engine would just generate a black image. It doesn't. Any attempt to use the result of Room.GetDrawingSurfaceFromBackground() creates unpredictable effects.





==============
On a different topic :
Reupload of version 1.1 : http://www.adventuregamestudio.co.uk/forums/index.php?topic=50356.msg636486336#msg636486336


Title: Re: MODULE: ParticleSystemManager v1.01
Post by: xil on Thu 30/04/2015 16:43:50
Hey!

Just a quick question (it might be about dynamic sprites in general but I'm not sure).

I'm running a 320x180 game and want to generate particles onto a 640x360 dynamic sprite - is this possible? I can only seem to get it to generate particles in a 320x180 bounding box, no matter what values I change :(

It's almost like the particles can only ever generate within a box set to the 320x180 resolution? E.g If I start generating particles on my 640x360 sprite and then move it 100 pixels to the left, the particles will disappear 100 pixels before reaching the right side of the screen.

Code:
Code (ags) Select

ParticleSystemManager PS;
DynamicSprite *sprStars;

function room_Load(){
  sprStars = DynamicSprite.Create(640, 360, true);
 
  s = PS.CreateSystem(300, false, dtSprite, 640, 360);
 
  PS.emitter_creation_mode (s, rmAllways, 0, 1, 1);
  PS.emitter_set_position (s, ptPoint, 160.0, 180.0);
  PS.emitter_set_velocity (s, 1, 3, 0, 360);
  PS.emitter_set_transparency (s, 0, 0);
  PS.emitter_set_age (s, 900, 900);
  PS.emitter_set_sprite (s, 11, 11);
  PS.emitter_set_scale (s, 100, 100);
 
  PS.action_set_bound_box (s, 0, 0, 320, 360);
  PS.action_add_force (s, ftParticleDirection, 0.3, 0.3);
  PS.action_set_scale_evolution (s, 100, 1);
}

function room_RepExec(){
  sprStars = PS.GetSystemSprite(0);
  oStars.Graphic = sprStars.Graphic;
}


Any ideas? I'm happy to provide a test game if anyone would be so kind as to have a look :)
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: xil on Sun 03/05/2015 22:06:26
I finally got a bit of time to investigate this properly and it seems as though it's just hard-coded into the module. On the off-chance that anyone else needs something similar to this weird behaviour, I have explained below where to edit/patch.

Line 784-787:

Code (ags) Select

// if particle is on screen
if (FloatToInt (AllParticles[i].x) >= 0 && FloatToInt (AllParticles[i].x) < Room.Width &&
    FloatToInt (AllParticles[i].y) >= 0 && FloatToInt (AllParticles[i].y) < Room.Height)
{


For my purposes I just changed Room.Width and Room.Height to what I needed and voila, particles can be generated off screen so that when I move my object that I am rendering onto, they are shown without an issue. :)
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: MyEakinBack on Mon 04/05/2015 01:13:13
I'm so glad you figured this out. I'm have a feeling this is going to come in handy sometime.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Monsieur OUXX on Mon 04/05/2015 09:59:41
Yes, this module has issues with scrolling backgrounds or anything bigger than 320x200, because it's hard-coded. Xil, it's a pity I saw your posts too late because I had corrected the issues in the version of this module that I use in my own game. I made other changes too, but xil if you have the opportunity you should upload your version of the module.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: cat on Tue 12/04/2016 21:59:24
Hi!

I've tried this awesome module in Cogliostro's version (http://www.adventuregamestudio.co.uk/forums/index.php?topic=50356.msg636486336#msg636486336) and the effect looks awesome!

I just don't know how to stop if afterwards. I start the effect like this:

Code (ags) Select

int s;    // system identifier
s = PS.CreateSystem(140, false, dtBackground);

PS.emitter_creation_mode (s, rmAllways, 0, 2, 1);
PS.emitter_set_position (s, ptPoint, 315.0, 95.0);
PS.emitter_set_velocity (s, 90, 140, 240, 300);
PS.emitter_set_age (s, 130, 140);
PS.emitter_set_sprite (s, 1, 1);
PS.emitter_set_scale(s, 50, 100);

PS.action_set_bound_box (s, 0, 0, 640, 270);
PS.action_add_force (s, ftConstant, 0.0, 9.8); 

WaitSeconds(4.0);

while (PS.num_systems)
{
   PS.DeleteLastSystem();
}


The problem is, that all sprites stay stuck on screen after the effect is ended. How can I remove them?

Edit:

Ok, I've added
Code (ags) Select

PS.emitter_set_age (s, 0, 0);     
WaitSeconds(3.0);

before the cleanup. It looks better, but there is now still one sprite flickering at the origin. Is ist possible, to just turn it off and wait, until all sprites are gone?
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Vincent on Tue 12/04/2016 22:39:37
Hi, I am not sure if this could be helpful but you could try to check the particle transparency so far.

Code (ags) Select

PS.emitter_set_transparency (s, 100, 100);



Code (ags) Select

PS.action_set_transparency_evolution (s, 100, 5);


I hope it helps :)
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: cat on Wed 13/04/2016 08:13:41
Ah, good idea, I'll try that.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: cat on Wed 13/04/2016 19:13:47
Quote from: Vincent on Tue 12/04/2016 22:39:37
Code (ags) Select

PS.emitter_set_transparency (s, 100, 100);


Thanks, this did the trick! :)
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Vincent on Thu 14/04/2016 01:14:58
I am glad to hear that you've solved it. :)
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Monsieur OUXX on Sat 16/04/2016 15:06:50
If I recall, this module is not compatible with scrolling backgrounds, but it's rather easy to tweak to make it work, provided you know AGS well. It would be a good idea to post an update version. Also it's useful to replace the hard-coded width and height with System.ViewportWidth or such (forgot the exact name)
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: cat on Sat 17/12/2016 17:13:07
This module has problems with multiple backgrounds. To solve this, you have to change the module script:

Replace every occurrence of
Code (ags) Select

Room.GetDrawingSurfaceForBackground();

with
Code (ags) Select

Room.GetDrawingSurfaceForBackground(GetBackgroundFrame());


I am setting the frame of the background in room_Load, which seems to happen after event == eEventEnterRoomBeforeFadein in the module. So, the frame was not set yet.
What I did to solve this, is adding the following function to the module:
Code (ags) Select

function ParticleSystemManager::RefreshBackground ()
{
   orig = Room.GetDrawingSurfaceForBackground(GetBackgroundFrame());
   orig = orig.CreateCopy();
}

I call this after setting the background frame of the room.
Title: Re: MODULE: ParticleSystemManager v1.01
Post by: Vincent on Sun 22/01/2017 16:15:18
:@cat:

I had this issue for a long time but I never mentioned about it on this thread before.
I followed your instructions and it works wonderfully fine.
Thank you so much, I appreciated it very much.

The only thing that now remains to be pointed out is the fact that you can not change the background (repeatedly) without that all the particles remain on the screen... or probably somehow there could be a workaround to do that...