Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Fire Simulator (Flaming Torches)

Author
Message
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Apr 2004 21:05 Edited at: 15th Apr 2004 21:18
Well, instead of buying one of those programs to perform particle effects, render images and then use in your game, how abour writing your own?

This fire simulator is pretty basic, but it does the job and look decent enough. It's fun to knock up as well, and I'll probably do more in the future to simulate other things.

Please note, I wrote this for flaming torches (medieval style). I wasn't aiming to simulate some burning house or something. Just a single, small source, hot flame.



As I said, I'm not claiming this looks super realistic, but it looks good enough. Also a fair bit too CPU intensive to use dynamically, but capture some frames from it, and you can billboard the images to a plain to have flaming torches etc.

EDIT: Dammit, almost forgot. You'll need to save and compile it into a project, with this particle BMP in the same directory. Feel free to try your own particle shapes, but use greyscale for accurate effects.


EDIT 2: Here. Have a screenshot.


Signature? No! Obsolete! These days it's all about chip and pin!
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 15th Apr 2004 21:30
cool! nice fire effect.

P.S. this is "3D" fire with particles right?(not some sissy 2D avi\texture...)


Formerly known as "DarkWing Duck"
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Apr 2004 22:37 Edited at: 15th Apr 2004 22:39
It's a 2D fire I'm afraid. Makes use of a particle sprite, but there are no AVIs. It's still coloured, scaled, alphas and positioned dynamically and is customisable.

As I said in the post, it's gonna be used for billboards. It's not me showing off. It's for practical use - just thought I'd share the code. It could well be used for 3D applications though. This code does the job in 3D, although it's a quick botch.



Just replace the code above with this code. You still need the particle image in the same directory.

This image is a 3D torch made of a few boxes sweeping around infront of the camera on fire.



Signature? No! Obsolete! These days it's all about chip and pin!
Dostej
21
Years of Service
User Offline
Joined: 21st Jan 2003
Location: Switzerland
Posted: 16th Apr 2004 10:40
Looks nice

I think i would be really cool if some DB(P)-er code something for particle and explosion etc.

To code or not to be...
GALACTIC X - A brief overview - http://www.angelfire.com/space2/galactix also my IDE: jaPROe - the Image Enhance plugin and some snippets and tools -
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 16th Apr 2004 20:53
bolt released his explosion code for firewall...http://www.thegamecreators.com/?m=forum_view&t=24518&b=6...


Formerly known as "DarkWing Duck"
darkdomy
21
Years of Service
User Offline
Joined: 6th Apr 2003
Location: Italy
Posted: 20th Apr 2004 23:21
help!!! download bmp

help!!! download media.
help!!!
Arkheii
20
Years of Service
User Offline
Joined: 15th Jun 2003
Location: QC, Philippines
Posted: 22nd Apr 2004 15:44
I don't have pro, but from the screenies it looks good. I think you can also do it twice so you have smoke coming up from there as well, but scaling it bigger as time passes.


"Story in a game is like story in a porn movie. It's expected to be there, but it's not that important." - John Carmack
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 22nd Apr 2004 17:25 Edited at: 22nd Apr 2004 17:29
is it okay with you if i use this fire effect(the torch one ) in my "acoder's compo" entry?

[edit] and BTW i would just about worship you(it would save me a lot of time and head aches ) if you could convert this to a function\sub that positions the "fire" effect at a point in 3D space...


Formerly known as "DarkWing Duck"
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 24th Apr 2004 16:15
lol - Magellan ...

Yes, you can use it however you like, but ...
(1) With that amount of particles, it takes up a load of CPU power. I didn't really make it to be a real time thing with other gaming elements going on, but you're welcome to try.
(2) I could convert it to a function, but it still wouldn't be very efficient and would tie up a range of sprite positions etc, but I'll look into it at the end of may when I have time.

Signature? No! Obsolete! These days it's all about chip and pin!
DEANO
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United States
Posted: 25th Apr 2004 19:34
I remember a looooong time ago(3ish years or so) someone coded in db classic, the most perfect flame. It looked very, very realistic, but it was just .exe, not source. I wish I still had it,oh well

"When I examine myself and my methods of thought, I come to the conclusion that the gift of fantasy has meant more than my talent for absorbing positive knowledge."
-ALBERT EINSTEIN
las6
21
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Finland
Posted: 28th Apr 2004 15:50 Edited at: 28th Apr 2004 15:54
hehe. reminds me of my first DBpro project ever. Just didn't have as pretty texture as you back then. Check it out for fun:
http://las6.dbspot.com/down/Torch.zip
48kb, source, project & media.

EDIT: just remembered that there might be some funky things going on. (DBpro has changed a bit since the first versions) .just play with object settings...

quite funny now...
You should check it out, I think there's still one thing that is missing from your demo, but you can quickly copy it as soon as you see it.

btw, Since I did this (fresh copy of DBpro), DBpro has increased a lot in speed and it now runs 2-4 times faster!


| Keyboard not detected. Press F1 to continue. |

Login to post a reply

Server time is: 2024-05-12 15:17:22
Your offset time is: 2024-05-12 15:17:22