Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: Kweepa on Wed 05/05/2004 23:31:53

Title: PLUGIN: Fire plugin (2005-06-05)
Post by: Kweepa on Wed 05/05/2004 23:31:53
An image is worth a thousand words:
(http://kweepa.com/step/ags/images/effectsfire.gif)
On the left, a "seed" sprite for a flame.
On the right, an object with a plasma flame.

Another example:
(http://kweepa.com/step/ags/images/effectsfire2.gif)

Download here (http://kweepa.com/step/ags/plugins/AGS_Fire.zip)
Mirror (http://www.2dadventure.com/ags/ags_fire-20050605.zip) (Thanks Neole!)

Changelog:
- Changed to zip, added documentation]
- Fixed a bug involving leaving the room then returning
- Change to naming convention; Works in 8, 16, 32 bit
- Added flame modification functions
- Works properly with save and load - doh!

To use, the following functions are available:


int FireAddObject(int object, int seedSprite, int paletteSprite);
int FirePreHeat(int object);
int FireDisableSeeding(int object);
int FireEnableSeeding(int object);
int FireSetStrength(int object, int strength);
int FireRemoveObject(int object);
int FireUpdate();
int FireStop();


Call FireAddObject (in the player enters room) with an object number, a seed sprite number, and a palette sprite number. The seed sprite should be black or transparent where there is no flammable material, and white or grey where flames should start. It should also be tall and wide enough to encompass any flames, or they might get cut off. You may have to play with the sprite a bit to get the effect you want.
There is a palette and documentation included in the zip.

Call FireUpdate in the room's repeatedly_execute_always.

Have fun!
Steve

CJ - I'm using two dynamic sprites for now because of that issue with not being able to flag sprites as changed...
Title: Re: Fire plugin
Post by: Scorpiorus on Thu 06/05/2004 00:20:12
What a cool effect!! Really great work Steve. Thanks for this plugin! :)

*Scorpiorus went off to experiment with drawing fire masks in paint

~Cheers
Title: Re: Fire plugin
Post by: Moox on Thu 06/05/2004 02:26:54
I look forward to trying this out, any chance of smoke?
Title: Re: Fire plugin
Post by: Kweepa on Thu 06/05/2004 08:14:17
I was thinking about smoke (on a semi-transparent object) but it would really look best at 32 bit. I'll be playing with a 16 bit version. If it looks good I'll add it to the plugin or create a new plugin.

Also, a water reflecting and rippling effect. But I wasn't quite sure how to get the reflecting water to work. If it was at the bottom of the screen, no problem, but if the player can walk either side then it would have to ignore the player and other objects. I guess I answered my own question.
It could be real slow too...
Title: Re: Fire plugin
Post by: Ishmael on Thu 06/05/2004 09:02:34
Whee, sounds interesting, should be useful! :)
Title: Re: Fire plugin
Post by: Pet Terry on Thu 06/05/2004 09:56:45
Hey, this'll be useful!

/me downloads.
Title: Re: Fire plugin
Post by: Scorpiorus on Thu 06/05/2004 15:54:35
QuoteAlso, a water reflecting and rippling effect. But I wasn't quite sure how to get the reflecting water to work. If it was at the bottom of the screen, no problem, but if the player can walk either side then it would have to ignore the player and other objects. I guess I answered my own question.
It could be real slow too...
What about a fire-like mask to define where the water is. Further, there could be a "baseline" so that the top part a the screen get inversed, next is used along with the plasma effects to make all that beauty and, finally, blitted (optional with translucency) at baseline y co-ordinate?
Title: Re: Fire plugin
Post by: Kweepa on Thu 06/05/2004 16:02:34
That was kind of the idea - except rather than plasma, I was thinking it would be more like one of those "lake" applets.
I'll try it out when Alf is over.

Edit:

The water will be an object, so it can be sorted.
Title: Re: Fire plugin
Post by: Scorpiorus on Thu 06/05/2004 16:08:17
What ever applet you like. As for characters and objects, they should be probably processed individually (to check thier baselines etc.) Just a thought.

p.s. have a nice tv watching :)
Title: Re: Fire plugin
Post by: Kweepa on Thu 06/05/2004 16:38:41
Quote from: Scorpiorus on Thu 06/05/2004 16:08:17
As for characters and objects, they should be probably processed individually (to check thier baselines etc.) Just a thought.
Just a thought for you, but a lot of work for me! :)
Sounds like a good idea.
It'd be a lot easier if I was linking to the allegro NULL driver.
Title: Re: Fire plugin
Post by: Ashen on Thu 06/05/2004 18:00:58
As everyone else says, pretty sweet plugin.
Title: Re: Fire plugin
Post by: on Thu 06/05/2004 18:08:32
As for the fire plugin... too bad I'm working on a 265 color game right now. ;)  I'll definitely use it if I ever get back to Mask:Adventure (which I do intend to.) 

Any chance of getting an animated preview posted?  How well does it work with moving objects, and can the "direction of flow" be changed?  (Meaning, could I turn it upside down if the source was moving upward rapidly, or sideways if the wind was blowing?)
Title: Re: Fire plugin
Post by: Kweepa on Thu 06/05/2004 20:37:53
Making an animated preview is (for me) a real pain. It would be much quicker to make a demo game, but I don't have much space to host it.

If you move the flames around, they don't react dynamically unfortunately. I'd have to keep growing the sprites or allocate them full screen to begin with, and I don't know if it's worth it. I've got a game to write!
Changing the direction of flow would be pretty easy, but I'd probably only do it if requested. It requires specific code for each direction.
Title: Re: Fire plugin
Post by: Moox on Thu 06/05/2004 21:00:27
hmm i havent tested it yet, but does it light the areas around it?
Title: Re: Fire plugin
Post by: Kweepa on Thu 06/05/2004 21:43:22
NO! ;D
And there's no lens flare either.
Title: Re: Fire plugin
Post by: Isegrim on Thu 06/05/2004 21:50:07
Hi,
I'm having a small problem with the Fire: The flame grows from the seed sprite, just as it should, but it seems to me, that the older sprites are not deleted when the effect updates, which results in a massive orange rectangle after some seconds... Know what I mean?

Here's a screenshot after one second:
(http://www.2dadventure.com/ags/flame1sec.JPG)
and here after ten seconds:
(http://www.2dadventure.com/ags/flam10sec.JPG)

I just called the EffectsAddBurnObject once and then the EffectsUpdate every cycle...
Maybe I'm just too stupid to understand the instructions  ::)

Edit:

Thanks, now it works! Really great!
Title: Re: Fire plugin
Post by: Kweepa on Thu 06/05/2004 23:13:02
I think the problem is you need to clear the bottom line of the seed sprite.
Title: Re: Fire plugin
Post by: Hollister Man on Fri 07/05/2004 02:35:39
Albeit I have a 2.3 G P4 and 512 MB ram, it ran perfectly as a full screen sprite.  :)

My suggestion would be to make a way to "flicker" it, or add randomness, since right now if you have a large flaming area, it glops up and ends up looking cheezy.  On the other hand, using low levels of gray makes an awesome sparking effect for something like lava or coals. :)
Title: Re: Fire plugin
Post by: Kweepa on Fri 07/05/2004 09:37:15
You should be able to draw some horizontal stripes randomly on the seed sprite, maybe 7 pixels thick at the bottom, 6 or 5 pixels thick higher up, and cover the screen in flames.

(http://kweepa.com/step/ags/images/fullscreenfire.gif)

It's not perfect but you get the idea.
Or you could add five full screen width objects that overlap vertically.
Title: Re: Fire plugin
Post by: Gilbert on Fri 07/05/2004 09:47:07
Though I'm never interested in plugins (so I won't use it anyways), but I think this plugin made some neat effects.
Actually I think you can add the ability to create "flame" of colours other than yellow/orange (if it's not possible currently), that can make it even more useful sometimes.
Title: Re: Fire plugin
Post by: Pumaman on Fri 07/05/2004 21:23:16
Sounds cool, good work! It would be nifty if there was a demo game to demonstrate how it looks, good idea :)
Title: Re: Fire plugin
Post by: LordHart on Sat 08/05/2004 02:16:21
This is a great plugin... definately going to be winner of best plugin or whatever the award is at this years AGS Awards... ;)

Title: Re: Fire plugin (UPDATED!)
Post by: Kweepa on Sat 08/05/2004 14:06:04
Bump to advertise updated plugin, with:
- 8, 16, and 32 bit support.
- supply a palette for green flames, smoke, whatever
- naming convention changed to fit in with upcoming plugins from me

Gilbot,
The colours are changeable. You just need to create a 256x1 sprite for a palette. Look at the docs in the zip for details.

Have fun!
Steve
Title: Re: Fire plugin (UPDATED!)
Post by: Hollister Man on Sat 08/05/2004 14:59:01
Variably transparent fire in 32 bit?  (I think just making values of red into values of alpha as well should work fine, IMO)
Title: Re: Fire plugin (UPDATED!)
Post by: Kweepa on Sat 08/05/2004 15:33:35
Hmm, I don't know why that doesn't work, but it doesn't seem to.
I'm guessing it's because the dynamic sprites I create aren't marked as being alpha blended, but I don't see any way of doing that. Anyone?

Edit: Thanks, CJ!
Title: Re: Fire plugin (UPDATED!)
Post by: Pumaman on Sat 08/05/2004 16:38:44
It's not currently possible to create an alpha-blended dynamic sprite, I'll add it to my to-do list.
Title: Re: Fire plugin (UPDATED!)
Post by: Kweepa on Sat 08/05/2004 22:54:37
Added new flame manipulation functions:
FireDisableSeeding - turns off flame generation but allows the existing flames to continue
FireEnableSeeding - turns flame generation back on
FireSetStrength - a value between 0 and 100 (object starts at 100) to turn down the size of the flames
See the docs in the zip.

Last update before alpha blending!
Title: Re: Fire plugin (UPDATED!)
Post by: Scorpiorus on Mon 10/05/2004 19:55:35
Steve, the plugin supports 16bit mode but does it support 15bit as well? I just want to verify because some video cards use 15bit in hi-color mode.
Title: Re: Fire plugin (UPDATED!)
Post by: Pumaman on Mon 10/05/2004 22:53:06
There is a way you can test 15-bit support if your graphics card normally uses 16.

Set your desktop colour depth to 32-bit, then run winsetup and select to run the game in a window.

Then, you can launch ACWIN (or any AGS game) with the parameter "--15bit" (without the speech marks), which will force it into 15-bit mode.

This should always work when run windowed, regardless of what your graphics card supports full-screen.

Press Ctrl+V in-game to check if it worked.
Title: Re: Fire plugin (UPDATED!)
Post by: Scorpiorus on Mon 10/05/2004 23:39:31
Thanks for a quick tip CJ.
I've just tried with 15bit and it seems to work fine. :)

One more thing, would it be possible for future versions of the plugin to handle an invalid object number was passed situation (i.e. the one that doesn't exist)? Currently, the game aborts but a dynamic sprite was never deleted warning pops up too.
Title: Re: Fire plugin (UPDATED!)
Post by: Kweepa on Tue 11/05/2004 00:29:01
It doesn't look quite right to me...
Seems there's less red than there should be. :P
I'll look at it tomorrow.

Invalid object, eh? Sure, I'll sort that out.
I think aborting the game is still good. I just won't create the sprites.
Title: Re: Fire plugin (UPDATED!)
Post by: MrColossal on Tue 11/05/2004 06:04:48
So i set up a little test trying to change the fire seed object while the fire is burning and it doesn't seem to work [just messing around seeing if fire growing or spreading or a fuse or something would work]

i was able to change the fire strength dynamically so that was cool

actually modifying the strenth doesn't do much, if i set it to 0 there's still quite a bit of fire left

but otherwise it's still pretty awesome, what i've always wanted is a hires particle system... oh imagine the smoke you could make with that
Title: Re: Fire plugin (UPDATED!)
Post by: Kweepa on Tue 11/05/2004 11:39:52
Quote from: MrColossal on Tue 11/05/2004 06:04:48
So i set up a little test trying to change the fire seed object while the fire is burning and it doesn't seem to work [just messing around seeing if fire growing or spreading or a fuse or something would work]
I was considering that (using a view rather than a sprite as the seed) but it would slow it down a fair bit, and it would be a lot of work if some of the frames were different sizes. So I shelved the idea.

Quote from: MrColossal on Tue 11/05/2004 06:04:48
actually modifying the strenth doesn't do much, if i set it to 0 there's still quite a bit of fire left
Did you have an area of the seed sprite lots of pixels tall? I tuned it so that 100 was a nice flame and 0 was little pops. You could try -33 (if you care).

Quote from: MrColossal on Tue 11/05/2004 06:04:48
but otherwise it's still pretty awesome, what i've always wanted is a hires particle system... oh imagine the smoke you could make with that
What do you mean, hi-res particle system? I've written particle systems for games before, so one for AGS is not impossible. But it's probably a week's work or so... It would probably still render into an object for sorting purposes. The big problem is passing all the parameters to make it useful.
Title: Re: Fire plugin (UPDATED!)
Post by: MrColossal on Wed 12/05/2004 07:18:35
by hi res i mean useable in 16 bit to take advantage of transparency but what would probably slow down the majority of ags users

but mmmmmm, i loves me some particles
Title: Re: PLUGIN: Fire plugin - now AGS v2.7 only
Post by: Kweepa on Sun 05/06/2005 17:13:17
New version of the plugin released.

* Only works with AGS 2.7 because of the differences in the way 2.7 deals with dynamic sprites when loading and saving.

* Now works properly when loading and saving.

* There's a new function to PreHeat an object so when you enter a room it looks like it's been on fire for a while, rather than starting to burn every time.

There may be some bugs lurking, so please report any problems you have!
Title: Re: PLUGIN: Fire plugin - now AGS v2.7 only
Post by: MaiSacNjo Mouf on Fri 05/08/2005 02:04:59
Hey guys,

I saw that someone mentioned earlier about posting a demo using this plugin.
I however havn't noticed that anyone has done so.
If I missed it, and you have, I am very sorry for wasting your time...
I made one..  (I'm really new at AGS, and horrible at graphics so laugh all you want at my art work!)
Here is a screen shot:
(http://www.basstech.net/bonfire.jpg)
The demo can be downloaded here http://www.basstech.net/FireDemo.zip

I hope this helps..

By the way Steve, great plug in!  Thanks!

Edit by strazer: Fixed screenshot
Title: Re: PLUGIN: Fire plugin - now AGS v2.7 only
Post by: Kweepa on Fri 05/08/2005 21:25:50
Glad you like it, and thanks for the demo!
Title: Fire Plug-In Question
Post by: R4L on Mon 22/05/2006 00:50:16
Is there anyway to attach fire to a character? I have an evil character and I want him to be on fire all the time, even while walking.
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: Kweepa on Mon 22/05/2006 02:42:58
Not directly, but you could, in repeatedly_execute_always, reposition a fire object on top of the character, then set its baseline just below the character.
[EDIT] Yes, the fire will be animated, but it won't leave trails behind the character. Try it out, and see.
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: R4L on Mon 22/05/2006 02:51:43
Will it still animate the fire too?
Title: Fire Plugin
Post by: .M.M. on Sat 14/07/2007 08:07:15

When I have in my script

FireAddObject(TORCH, 67, 68);

AGS announced error:"FireAddObject is allready compiled". What does it mean and what I have to do?
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: seraphimdreamer777 on Fri 25/04/2008 12:05:46
I've got a question about the plugin can it be used on objects the player picks up or just background objects cause I want to use it for an inventory item in my game called the fire starter stone.

EDIT: I think I've answered my own question but I'm getting the same error message the guy who posted right above me got "FireAddObject is allready compiled" so I don't know what I'm doing wrong

EDIT2:Sorry I wasn't more specific above but I put this under room load on line 26

int FireAddObject(int object, int seedSprite, int paletteSprite);

int FirePreHeat(int object);

int FireDisableSeeding(int object);

int FireEnableSeeding(int object);

int FireSetStrength(int object, int strength);

int FireRemoveObject(int object);

int FireUpdate();

int FireStop();

Call FireAddObject (in the player enters room) with an object number, a seed sprite number, and a palette sprite number, e.g.

FireAddObject(OBJECT_TORCH, GetObjectGraphic(OBJECT_TORCH), SPRITE_FIREPALETTE);

I also tried using numbers in place of certian words such as

int FireAddObject(int 5, int 7, int 10);

but that didn't work either thanx ahead of time for any help!
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: .M.M. on Fri 25/04/2008 20:53:01
Quote from: seraphimdreamer777 on Fri 25/04/2008 12:05:46
I think I've answered my own question but I'm getting the same error message the guy who posted right above me got "FireAddObject is allready compiled" so I don't know what I'm doing wrong
I solved it already.
in after fade- in:
FireAddObject (1,10,12); 
in repeatedly execute FireUpdate ();
When you use int you are defining or importing some variable.
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: seraphimdreamer777 on Fri 25/04/2008 22:36:52
Thank you I'm no longer getting the error message but I still have one problem my sprite isn't lighting could it be because of the shape of it or something in my script still if I figure it out I'll let y'all know oh and here is my room script in case y'all need it thanks again

// room script file

function room_Leave()
{

}

function room_LeaveRight()
{






}

function room_Load()
{
  FireAddObject(0, 48, 49);
 
  FireSetStrength(0, 120);
 
  FirePreHeat(0);
}




function room_AfterFadeIn()
{

}

function room_RepExec()
{
  FireUpdate();
}

EDIT:Does this plugin work with 3.0.1 cause if not that could be my problem

EDIT2: I figured it out every thing should have been under function room_AfterFadeIn
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: .M.M. on Sun 27/04/2008 08:32:54
I had no problem with it in AGS 3.0.0 (with plugin, not with your script). Maybe... erase FirePreHeat(0);
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: Gold Dragon on Mon 28/04/2008 03:47:46
I have tried and tried and tried to read up on this mod to get it to work and I just can't seem to get it to work. Every one says they got it solved but aren't exactly saying how they did or I"m not understanding it.

this is what I have done so far.

*I've copied AGS_Fire.dll file and put it in my Adventure Game Studio 3.0.1 folder

*I have put the code in the Globalscript.ash

// Main header script - this will be included into every script in
// the game (local and global). Do not place functions here; rather,
// place import definitions and #define names here to be used by all
// scripts.
import int FireAddObject(int object, int seedSprite, int paletteSprite);
import int FirePreHeat(int object);
import int FireDisableSeeding(int object);
import int FireEnableSeeding(int object);
import int FireSetStrength(int object, int strength);
import int FireRemoveObject(int object);
import int FireUpdate();
import int FireStop();

*in the room code I put

/ room script file
function room_AfterFadeIn(){
  FireAddObject(0, 6, 7);
  FirePreHeat(0);
  FireDisableSeeding(0);
  FireEnableSeeding(0);
  FireSetStrength(0, 25);
  FireRemoveObject(0);
  FireUpdate();
 
}

*Room compiles and everything.. then when when the room fades in I get "Error:unable to create local script: Runtime Error: unresolved import 'FireAddObject'

what am I doing wrong.. can some plz give me a step by step way of how to use this wonderful mod.

Sometimes I'm slow at understanding things. but when I get it.. I get it
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: Pumaman on Mon 28/04/2008 15:39:33
Did you actually enable the plugin? Just copying it to the AGS folder isn't enough, you then need to right-click it and enable it under "Plugins" in the project tree.
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: Gold Dragon on Mon 28/04/2008 16:01:08
no I didn't...


ok enabled it... but still not working.. but at least I don't have any more error messages. I'll play around with the code a bit more and see if I can get it to work
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: Gold Dragon on Mon 28/04/2008 19:36:42
ok no errors.. but still no action

I've.....

*enabled the plugin

*put the code in my room script

    function room_AfterFadeIn(){
         FireAddObject(0,6,7);
         FireEnableSeeding(0);
         FireSetStrength(0, 100);
         FirePreHeat(0);
         FireUpdate();

    }

    function repeatedly_execute_always(){
        FireEnableSeeding(0);
        FireUpdate();
    }


But still no fire WTH! =(
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: Cogliostro on Thu 07/03/2013 14:24:29

I can get the fire module to work just fine with a 16-bit game, but I love transparent PNG images and those only work with 32-bit games and so far I have been unable to get the FIRE PLUG IN to work with the 32-bit game.  Have I just screwed up my images and it really should work? Is there a newer version?

On a similar note, does anyone have a copy of the ParticleSystemManager v1.01 - I tried to download it and couldn't find one anywhere.

Thanks,
Cogliostro
Title: Re: PLUGIN: Fire plugin (2005-06-05)
Post by: san.daniele on Sun 05/05/2013 00:16:46
Quote from: Cogliostro on Thu 07/03/2013 14:24:29

I can get the fire module to work just fine with a 16-bit game, but I love transparent PNG images and those only work with 32-bit games and so far I have been unable to get the FIRE PLUG IN to work with the 32-bit game.

sorry for digging up this old tread (at least the last post isn't that old). People might like to know that it works just fine in AGS 3.2 (and yes, even in 32-bit games. actually, the seed-sprite i used is only 16-bit … maybe that made the difference as seed/palette-sprite should have the same colour depth according to documentation and I used the palette included in the zip).

p.s. wonderful plugin!