Log In  

Cart #pck404_campfire-3 | 2022-10-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


This is just me trying to simulate fire in Pico8 without shaders or fancy particle systems.

My approach is :

  • At load time :
    • Generate bursts of animated particles
    • Each particle increments the brightness value for the pixels it sits on
    • The burst animations are baked into the spritesheet
  • At run time :
    • Animate the baked sprites (moving them up)
    • Again, add the brightness values together

The brightness value (which is just a color from 0 to 7) is mapped to a fire shade with pal().

There are other particle systems for bursts of sparkles and fireflies.

Any thought? What would be your approach?

v2 update

  • use colors 0 to 7 for fire shades : no table needed to store brightness values
  • bake animations into spritesheet for performance
  • got rid of smoke
  • add flickering
  • nicer fireflies and flying ember
  • add clouds

v3 update

  • press a button to toggle scene on/off (monitor CPU usage of fire only)
P#118338 2022-10-01 23:56 ( Edited 2022-10-02 22:14)

very cool. what if the objects around the fire flickered? or the smoke was lit up by the fire. i can't wait to see more of this.

P#118339 2022-10-02 00:25

Thanks !
Yes I tried the flickering on the rocks edges but I couldn't get it right. I was picking a random shade (lit or unlit) each frame and that looked nasty !
The lit smoke is a cool idea, I'll try that!

P#118342 2022-10-02 00:37

@pck404 you're welcome :). As for the flickering on the rocks, it should base on proximity to the nearest particle, or if that's not happening quite yet, it should be periodically as opposed to randomly.

P#118343 2022-10-02 01:18

Super cute, I love it!
@Ummmm_ok fancy seeing you here :)

P#118411 2022-10-03 01:47

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-03-27 01:21:59 | 0.052s | Q:19