This fire image was mathematically generated using the code available below.(NOTE: as of February 26th, 2009, version 2.0 of this code is available here.)
Whether working on an old-school RPG or a state-of-the-art FPS, every game programmer needs to be able to generate a fast, cool fire effect at some point in his/her career. In this example, I’ve opted for a straightforward and easy-to-understand method for generating real-time flames. No pre-built images or palettes are used, making the code quite small and easy to reuse. Coloring and flame generation is done using only math and a little cleverness. :)
To simplify the code, I’ve used SetPixelV for drawing the fire. This slows the demo down significantly, but DIB sections could easily be dropped into place if speed is a major factor for you.
This site - and its many free downloads - are funded by donations from visitors like you.
Please consider a small donation to fund server costs and to help me support my family.
Even $1.00 helps. Thank you!
bookmark and share this article
Discussion (Be the first to comment!)
Comments are closed.