new fire system
I implemented the new version of the fire. The fire now has 4 variables: size, heat, light, and smoke. The fuel now has 6 variables: ignition_delay, burn_time, size_output, heat_output, light_output, and smoke_output. The fire keeps track of the fuel in its area with two arrays: inactive_fuel for unlit fuel and active_fuel for lit fuel. Both arrays hold instances of FuelEntry, a helper class that holds a fuel and a timer for the ignition delay or burn time. Every frame, the timers on inactive and active fuels are reduced. Inactive fuels become active fuels if their timer reaches 0 and active fuels are removed if their timer reaches 0.
Above is some of the code for checking inactive and active fuels. I also sum up the size_output, heat_output, light_output, and smoke_output of all the active fuels to get a total current output of the fire for each variable. It might be a bit overkill to have size, heat, and light (all of which are often dependant on each other) but maybe it could make for some interesting mechanics. I have yet to implement the heat, light, or smoke, nor have I added any new art or visuals, so for now I just scale the old fire drawing based on size.
In the clip above I throw some sticks on the fire. The stick in this video has no ignition delay, a burn time of 3 seconds, and a size output of 5. These numbers are for testing.
In the clip above I throw some logs on the fire. The log in this video has an ignition delay of 1 second, a burn time of 5 seconds, and a size output of 10.
As you can see, some work needs to be done on the visuals, but it seems to function pretty well and I’m pretty happy with that. In these clips the fire is never dead which will eventually change when I add some fire starting mechanics.