Log In  


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

Campfire

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)
10


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.


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!


@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.


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



[Please log in to post a comment]