PLUGIN: Fire plugin (2005-06-05)

Started by Kweepa, Wed 05/05/2004 23:31:53

Previous topic - Next topic

Kweepa

An image is worth a thousand words:

On the left, a "seed" sprite for a flame.
On the right, an object with a plasma flame.

Another example:


Download here
Mirror (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:

Code: ags

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...
Still waiting for Purity of the Surf II

Scorpiorus

What a cool effect!! Really great work Steve. Thanks for this plugin! :)

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

~Cheers

Moox

I look forward to trying this out, any chance of smoke?

Kweepa

#3
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...
Still waiting for Purity of the Surf II

Ishmael

Whee, sounds interesting, should be useful! :)
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Pet Terry

Hey, this'll be useful!

* Petteri downloads.
<SSH> heavy pettering
Screen 7

Scorpiorus

#6
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?

Kweepa

#7
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.
Still waiting for Purity of the Surf II

Scorpiorus

#8
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 :)

Kweepa

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.
Still waiting for Purity of the Surf II

Ashen

#10
As everyone else says, pretty sweet plugin.
I know what you're thinking ... Don't think that.

Hollister_Man unplugged

#11
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?)

Kweepa

#12
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.
Still waiting for Purity of the Surf II

Moox

hmm i havent tested it yet, but does it light the areas around it?

Kweepa

#14
NO! ;D
And there's no lens flare either.
Still waiting for Purity of the Surf II

Isegrim

#15
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:

and here after ten seconds:


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!
This post was generated automatically and therefore bears no signature.

Kweepa

#16
I think the problem is you need to clear the bottom line of the seed sprite.
Still waiting for Purity of the Surf II

Hollister Man

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. :)
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

Kweepa

#18
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.



It's not perfect but you get the idea.
Or you could add five full screen width objects that overlap vertically.
Still waiting for Purity of the Surf II

Gilbert

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.

SMF spam blocked by CleanTalk