This tech demo recreates the iconic fire effect from the DOOM intro in PICO-8 running at a stable 60 FPS!

Technical Challenges
There aren't many detailed resources or tutorials online for implementing such effects efficiently. Many examples too simplistic, so a lot of trial and error is required to stay within the constraints. Here, I've used a 2D array for fire intensities that's updated per frame, and optimized drawing by rendering pixels in four sections to save computation time.
Implementation Highlights
- Initialization: A 32x36 pixel grid is filled with minimal intensity; the bottom row starts at white (maximum intensity).
- Update: In _update60(), fire spreads upward by randomly decreasing and propagating intensity values.
- Reduced Resolution: The fire effect is computed on a low-resolution 32x36 grid (1152 pixels). This drastically reduces the number of calculations in the _update60() function, which updates fire intensities.
- Pixel Scaling: Instead of computing unique pixel values for the entire screen width, the code reuses each pixel from the 32x36 grid four times horizontally (w, w2, w3). This "stretching" creates a full-screen effect without additional computation.
- Minimal pset Calls: By only calling pset for non-zero colors (col > 0) and drawing four pixels at once, the code minimizes the number of loop iterations and draw operations.
Disclaimer
This project is a technical demo inspired by the fire effect seen in DOOM and does not use any assets or code from the original game.
[Please log in to post a comment]