95102,FPS,API,program,simulates,fire,seen,oth
Quick Search for:  in language:    
95102,FPS,API,program,simulates,fire,seen,oth
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
RentACoder Stats

 Code:  lines
 Jobs: 0 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for RentACoder
Wrapping Scrolling Text
By Paranoid_Androi d on 7/2


Create A Dummy File
By AML on 7/2


Click here to see a screenshot of this code!Captionbar manipulation!
By Peter Hebels on 7/2

(Screen Shot)

A Game Of War
By Co0nest on 7/2


Click here to see a screenshot of this code!KeyGen Example
By Bengie|NET on 7/2

(Screen Shot)

Click here to see a screenshot of this code!OpenBrowser v1.9
By Orlando Jerez on 7/2

(Screen Shot)

SendMessageBySt ring() Example
By Jaime Muscatelli on 7/2


Click here to see a screenshot of this code!FirstSunday
By Jan Paul Penning on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Ikonz v1.0
By Gaurav Creations on 7/2

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Real-time fire (updated, 100 FPS)

Print
Email
 
winzip icon
Submitted on: 11/28/2000 8:51:17 PM
By: Odin  
Level: Advanced
User Rating: By 36 Users
Compatibility:

Users have accessed this code 8483 times.
 
(About the author)
 
     This program simulates fire. I have seen other articles that simulate fire, but this one is extremely fast (95-102 FPS on my 366) and it uses some neat API calls that most programmers probably have never seen before. I uploaded this before, but it only worked if your computer was in 24-bit colormode. I have changed it so that anyone running in 16, 24, or 32-bit colormode can see the fire perfectly. I really want to know what you think of my program. I have commented it heavily so even a beginner should be able to understand what each line does. I really hope that you will vote and leave comments, I have worked really hard to make this compatible and also the get such a high FPS so please let me know what you think.

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

    //**************************************
    //     
    //Windows API/Global Declarations for :R
    //     eal-time fire (updated, 100 FPS)
    //**************************************
    //     
    A few
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 8 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
11/28/2000 9:01:48 PM:Ackbar
looks cool but the fps display does not 
seem to work. I'd like to see how it 
runs on my computer.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/28/2000 9:08:31 PM:Dertanyun
The FPS is determined after you hit the 
stop button. I hope this is the problem 
you are seeing and not that the FPS 
isn't showing at all. So hit the start 
button then wait a little while then 
click stop. The FPS will show then. If 
this doesn't work let me know.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 12:06:01 AM:PaC
I get 135.50 FPS on my comp
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 12:48:18 AM:Warren
Nice effect! I get 205 fps.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 1:49:13 AM:Rad-X
I keep getting a run time error, 
"Subscript out of range"
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 7:30:17 AM:Steve
Really cool, I get 64 FPS on a PII 
266MHz and 120 FPS on a PIII 
300MHz
when compiled as a .exe.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 9:17:01 AM:Ron
Great code, Is There anyway to make it 
run in full screen? I tried to increase 
the size of the image box but got an 
error script out of range.
PS
FPS 
was between 102 and 110 on a PII 400 
Win98
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 10:05:28 AM:xXx_VipeI2_xXx
Very nice! 315 FPS on my machine.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 12:44:07 PM:Dertanyun
Rad-X did you try to change the size of 
the fire? Because if you do, you must 
change all of the buffersizes and the 
picturebox's size on the form. If 
something else occured please let me 
know.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 1:02:53 PM:ChrisJL
Cool I get 651 FPS on my AMD-K 650 with 
3D Now! MMX and 3D AGP ATI Graphics 
Card!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 1:30:23 PM:Simon Price
I just clicked on the .exe, didn't 
change anything, and it crashed 
"subscript out of range" on startup. So 
I open the code and tried to run it 
from VB instead, but the exact same 
thing happened. I have not changed the 
size of the picture. I have Win98, 1024 
x 786 x 24 screen res, VB6. I think 
fire is a cool effect and quite 
difficult to simulate, so I'd like to 
see this! See my fireworks screensaver 
for another cool graphics effect.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 1:54:43 PM:Michael L. Barker
Dude! The tab key is your friend! Learn 
how to use it. I would have given you 
5/5 for this. But because this code is 
just hard to read, drops it down to a 
2/5.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 4:53:07 PM:Roscket
Hi, nice code, LOVE IT! However, I want 
customize the size of the fire, and 
when i stretch the black picture box 
horizontally and ran it, it gave me a 
"Subscript out of range error." I 
wanted to make the fire larger 
horizontally. Is it possible, and if 
so, can you please e-mail me how (it'd 
be great if you send an example form 
too)? Thanks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 4:54:29 PM:Dertanyun
I'm sorry Michael, but I really think 
you judged this a little unfairly. I 
worked my @$$ off to get this code to 
work. Then just because I use a 
different coding style then you, I 
receive a horrible rating. I even went 
through line by line, just so that 
everyone knew what was happening 
because I was trying to help people 
understand these API calls. It is very 
unfortunate that you were unable to 
vote for this code based on the work 
that was put into it and what it does, 
and rather the fact that you feel my 
coding style is inferior. I hope I 
didn't offend you or anyone else that 
feels my code appears a little messy 
because I didn't use tabs, but 
personally, I HATE HATE using tabs 
because to me it makes the code appear 
unorganized and when people tell me my 
code is worthless because of this, I 
get a little irritable.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 4:56:07 PM:Dertanyun
Simon, I will look through my code to 
see if I can locate what seems to be 
the problem because apparently Rad-X 
seems to be having a similar problem. I 
also run at 1024x768x24, but don't seem 
to run into this problem. There must be 
a small flaw somewhere though. I will 
let you know if I am able to determine 
what the problem is. Also, could you 
let me know where the error is 
occuring. (if possible) Thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 5:11:49 PM:Chris
Fire looks great Dertanyun, I wish I 
had a faster PC...my PIII 733 with mega 
everything only runs your fire at 22.48 
FPS....huh?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 7:20:37 PM:Erik Forbes -- Mobius-Corp
Hey, don't listen to that michael guy. 
Personally, I feel that this particular 
piece of code is for display, not 
example. In other words, don't judge it 
by its insides.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/29/2000 10:13:03 PM:aleksisc
Cool! I've got only 18 FPS on my PIII 
700 w\ 128 mem. huh!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/30/2000 1:04:40 AM:Ackbar
Run the exe for the speed. In vb it's a 
lot slower. I ran between 12.5 and 13 
fps in vb and 128+ outside. Just so you 
know :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/30/2000 12:36:36 PM:Dertanyun
Yes, Ackbar is correct. If you want to 
see the actual speed of the program you 
must run the exe. Thanks for voting and 
telling me what is wrong with my code. 
I hope that i can fingure out what is 
going wrong on Rad-X's computer and 
Simon's computer. I have yet to figure 
out what the problem seems to be. If 
you want to resize the fire, it takes a 
little more than just resizing the 
picturebox. (sorry about that). You 
have to change the picturebox to the 
size you want. Then at the start of 
each form you must set the fHeight and 
fWidth to the size you have made the 
picturebox. You must also change the 
three buffers (Coolingmap, NCoolingmap, 
and Buffer1) so that there upperbound 
is the fHeight * fWidth. (so if you 
made it 250 by 250 the buffers must be 
1 to 62500)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/30/2000 12:38:28 PM:xim
Great job! The update runs a full 40 
fps faster (131 fps on PII450) and 
looks almost perfect with the exception 
of an occasional pixel squaring. Love 
the comments and, "I don't need no 
steenking Tabs!"  5 globes up!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/30/2000 2:16:01 PM:Simon Price
Dertanyun, in the form frmFire_New and 
the sub AddHotspots, on the line that 
begins with Buffer1(), it crashes with 
subscript out of range and I think it's 
the y value that messes up because the 
variable TotInf was over 15000, way 
outside the picture. Hope that helps 
you somehow... I agree that there's no 
problem with leaving out tabs if that 
helps YOU, and I'm not voting poorly 
just because it crashed on me (because 
you couldn't test it on every machine 
and I hate it when people do that to 
me).
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/30/2000 2:21:41 PM:Simon Price
Oops ignore the thing about the 15000 
being outside the picture, I didn't 
realise you were using a 1D buffer. I 
wonder why it's says it's out of range 
then?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/30/2000 3:07:41 PM:HenYa
not to dis the code or 
anything..
But it's not supprising, 
anything can run at 100 or more FPS in 
a tini little window. :)
Bye.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/30/2000 3:13:38 PM:HenYa
mmm, nice.
On win2k with gforce 256 
i got a range of 195-202 fps. Which is 
good. :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/1/2000 4:17:42 PM:Dertanyun
Simon, if you want to get rid of the 
error, you may enter in the On error 
resume next command and that top of any 
sub that is getting an overflow error. 
This will slow the program down 
considerably, but you can atleast see 
what the program looks like.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/1/2000 4:42:26 PM:Dertanyun
HenYa, I was just wondering if you saw 
a simulation of fire written in VB that 
got much faster FPS, cuz that seems to 
be what you are implying. I was 
wondering that if this is so, could you 
let me know where it is, cuz I really 
like the simulation of graphics (exsp. 
fire) So please let me know. If you 
haven't thats cool and if anyone else 
has let me know, cuz I really want to 
see if there is some way I can improve 
my algorithm. Thanks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/2/2000 2:53:36 PM:opello
Hey! I tried it before and got blue, 
green, and gray fire (looked kinda cool 
thow) .. but this release works on my 
computer (1280x1024x32) ... I got 
between 25 - 40 fps in IDE, and 200 - 
230 in exe ... looks great! I'm on a P3 
800 w/ 128 MB ram & GeForce 2 DDR 16mb 
... wonder why it wasn't a little 
higher ... also, the frame rate lowered 
if I left it on for about 5 min ... 
again, great code :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/4/2000 1:16:02 PM:Dertanyun
Thanks to all of you people for voting 
and giving me feedback I was able to be 
selected as a contest winner! I am 
currently trying to design a new fire 
program that will be more realistic, 
faster, and runs in full screen mode. 
I'm currently at the point in finding 
the fastest way to render to the 
screen. So maybe in a few months I will 
have a full screen fire program, but 
maybe I will be unable to a faster way, 
so if you have any suggestions please 
let me know.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/5/2000 8:40:39 AM:Don
Don't feel bad I don't use tabs either 
cause it sux that way hehe
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/6/2000 6:48:56 PM:ck
Hope you tab-less guys aren't looking 
for a real programming job!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/6/2000 7:52:15 PM:Glenn
Hey, the code looks good, it's 
commented, and it works.  What else do 
you want?!  Tabs help, but not enough 
to influence the vote.  
This .exe 
simulates fire better than any other 
I've seen on this site, and even though 
he's already been selected a contest 
winner, I'm giving him all 5 globes up 
here.  Keep up the good work!
I'd 
love to see the full-screen version, or 
at least one that can be resized, 'cuz 
my only complaint with this one is the 
small window.  That's very minor 
though, when you look at the actual 
imaging...  Great job.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/12/2000 11:15:48 AM:livinINvb
holy s*** this kicks a**!!! Even at 132 
FPS!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/13/2000 4:12:41 AM:Jotaf98
Hey, I have a suggestion: if you have 
DX7 development kit, you'll see there a 
fire sample. It's not as fast and 
realistic as this one, but it 
demonstrates direct access to video 
memory trough arrays, which seems to be 
what you're looking for ;)
It runs 
at about 20 frames per second in a 
1024x768 resolution in my computer, so 
don't worry about speed, you could even 
make a SCREEN SAVER with it! =)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/13/2000 4:13:36 AM:Jotaf98
Forgot to say, great code!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/13/2000 4:13:48 AM:Jotaf98
Forgot to say, great code! Can I use it 
in my game?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/13/2000 9:28:50 AM:Sonar
Nice fire effect. Very well commented. 
I Get a 140 fps on my Pentium III here 
when I use the program's EXE in the ZIP 
file. But you should try this: to get a 
little more speed and heat, recompile 
the EXE with all the extra checks 
(overflow, array bounds, etc) removed. 
My fire suddenly burned 190 fps. I did 
not change any code for that, just 
removed the extra compile checks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/14/2000 4:05:23 PM:Picklezz
Hello! Great code! I want to know how 
you do to update the FPS while it's 
running can you pls tell me that
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/14/2000 5:32:20 PM:Steve Sanford
Excellent job...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/16/2000 4:28:18 PM:Kristof Torfs
This is pretty cool, can you also make 
an alphabet out of it ? I haven't been 
able to check out the code.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/16/2000 9:11:59 PM:Dertanyun
You can use this code as long as you 
give credit where credit is due. 
Kristof I don't understand what you 
want to do, but if you look at the code 
you can check and see.  About automatic 
FPS, you would have to put an if 
statement that would check the current 
FPS and when it reaches a number like 
200 you would have it calculate the FPS 
and then reset the variable that is 
holding the amount of time passed.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/16/2000 10:11:19 PM:shoota
hey I get 235 on a PIII 500 with 256 
mem
cool
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/17/2000 5:32:13 AM:lvramanan
Very Nice Code. Keep Trying a Lot of 
some more good stuff. Why can't u use 
this in place of a visual Analyzer, 
hope u would've seen the visualisation 
that comes with Realplayer 8 Basic . I 
got 1024 fps. I've P!!! 650e, Nvdia 
Rivia TNT witn 32MB RAM.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/18/2000 9:58:36 AM:Kenneth Gilbert Jr.
Voodoo Banshee equals 330 FPS?  Hmmm.  
Anyway, I gotta say it... BURN 
BABY, BURN! : )
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/21/2000 1:07:19 PM:Dertanyun
This program doesn't take advantage of 
graphics cards so no matter what card 
you have it shouldn't effect the FPS, 
but I'm thinking of trying to use the 
DirectX fire example that comes with 
the SDK and seeing if I can make a fast 
full screen version, but I've been 
really busy with school and all. 
(Thanks Jotaf98 for the idea)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/27/2000 12:40:13 PM:FormatC
Compiled exe got 225fps on a Athlon 
700... and 32fps on a p166. Removed 
checking (as Sonar suggested) in 
compile and got the p166 up to 50fps. 
Astounding.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2001 4:44:50 AM:SKoW
nice.. 300fps on my Dual P3 in Win2k
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2001 9:25:47 AM:Casey Goodhew
I couldn't get it working either - I 
ran into the 'Script out of range' bug 
too. Adding On Error Resume next makes 
that program run, sort of. It doesn't 
crash but I don't see any fire and I 
get 0 fps. If you would like to work 
through this problem I can do some 
troubleshooting for 
you.
goodhewc@hotmail.com
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2001 9:59:51 AM:Stefan
I only become 18.xx FPS on my 750 Mhz 
Computer, but it's not a problem. I 
tested it only short. I only want to 
tell You: This is a very great prog. 
Keep up this good work!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2001 11:08:31 AM:Viper Tec.
Ok, to ck(wrote: Hope you tab-less guys 
aren't looking 
for a real programming 
job!). I do have a "real" programming 
job at Ayrshire Electronics in 
Fayetteville, AR. I don't use tabs, 
ever. Nobody cares. As long as it works.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2001 8:14:06 PM:HANSEN2000
Nice one master!
Look into the 
DirectX and you'll find some features 
you can use for sure!
I'm looking 
forward to a new release with 
fullscreen mode.....great screensaver 
:_>
btw - if you ever make the 
fullscreen mode, then post it for 
WinAMP.....just an idea... 
:_>
HANSEN2k
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2001 1:33:35 PM:Kevin Pirkl
Cool code...  Make it resizable so I 
can embed it into a screen saver.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/7/2001 4:12:13 PM:Dertanyun
Ok, thank you everybody for your 
comments. I haven't had a chance to get 
any real work done on a full screen 
version all though i have looked at my 
options and i will be using DX for it. 
Had to spend most of my time looking at 
schools, but that is pretty much over. 
I'm hoping to release it in a few 
months, i'm going to be working on it 
while i'm in my last class at high 
school. If you want me to notify you 
when it is done, just let me know, and 
i will tell you when it is completed. I 
will also try and make the updated one, 
sizeable for all you people who want it 
that way. So if you have any other 
suggestions, just let me know and i 
will try and incorporate them in.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 3:59:04 PM:Michael Barnathan
Impressive that you can get that type 
of FPS without using DirectX, although 
with it, you can probably run a 
fullscreen fire demo at close to that 
speed. Great code.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/13/2002 7:59:33 PM:BoBocK
cool
I got 68,70 FPS on PII 266
you 
get 5 votes!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | RentACoder Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.