Fire wasn't anywhere near as much of an all-consuming inferno as it should be - so I fixed that.
Oh, players also have sprites now, so they're 87% less house-shaped.
Improved Player Graphics
It's easy to miss, so here's a close-up:
Jokes aside, after last week's ragdolls, it felt wrong to have enemies turn into ragdolls but not players - and ragdolls require sprites, so here we are.
Feeble Fire
Long time readers may remember from 3 months ago that fire is a special kind of atom which looks for other atoms around it to burn (or moves straight upwards if there's nothing to burn).
This approach was simple-ish1 but it wasn't cutting it:
- It doesn't burn moving bodies consistently (like ragdolls).
- Coal burns at the same speed as oil.
- But worst of all, it feels weak!
When fire doesn't feel great or cause chaos, what is even the point of having it!
Ferocious Fire
I figured better fire came down to fixing 3 things:
- Make the fire atom movement look less uniform & artificial.
- Emit a whole lot more fire atoms so fire seems more deadly.
- Atoms need to track whether they're burning (rather than fire atoms just damaging nearby atoms), so moving atoms and moving bodies stay burning.
Numbers 1 and 2 were easy: I turned fire into a powder (like sand or coal) with reverse gravity, and turned the fire spawning frequency up to 11.
Then fixing #3 required a total fire rewrite, so I probably should have done that first. Whoops.
Anyway, the new approach gives each burning atom a chance to ignite a nearby atom based on its burning temperature and the nearby atoms' ignition temperature, so e.g. oil ignites faster than coal.
Here's that same clip from before but using the new fire mechanics:
Burning atoms require nearby oxygen, which causes the fire to advance and retreat into the "mass" of atoms - it looks kind of like flames moving. And burning atoms get their color darkened over time too.
This works with your fireball spell too,2 so you can roast your enemies' corpses to a crisp:
That said, it's also very easy to roast yourself to a crisp3, so I still need to tune the damage numbers a fair bit.
Playable web build
Alrighty, have fun burning yourself to death accidentally:
- Tab, Tab to cast a fireball!
- You might want to ready water (8) so you can use the mouse to put yourself out when you catch alight.
- (I know the flamethrower spell is broken. It needs a rewrite still.)
It was actually 200 lines of logic accounting for lots of special cases, such as water/steam/air interactions and making sure fire survived single atoms falling down onto them. But at least the complexity was all in one place!
Which by the way has gained a burning trail, and also now pushes enemies back a little.
Particularly if you move into your fireball's burning trail, but also if a burning hound that's rushing toward you happens to die & fling its own burning corpse at you. That recording took me at least 10 takes!