I’ve heard a few times over the years that implementing fire as an environmental hazard is hard, nay impossible, to implement. I’m curious, so to those who know more about it than me: what are the difficulties of implementing fire when it comes to tings like code, visuals and gameplay? Can we come up with workable idea’s to circumvent the difficulties.
simply put, what do you want this fire to -do-?
destructable buildings isnt a thing, and everything is made out of the same blocks but with a different collor. visually, we can do fire. we have hearths, and multiple people that know the eldritch art of qubemitters.
there just isnt anything flamable in the world, and thus we dont have fire.
trees could easily be made flammable – they have health and can be destroyed by lightning (which BTW is a potential ignition source too), so an appropriate damage-over-time effect could do the job… just need a way to bring the effect into being.
One thing which has been talked about re fire damaging/destroying buildings is to have the building “burn” for so long (giving a chance to extinguish) before triggering the building destruction/demolition automatically, the same as how Gary’s tentacles can. It’s possible to have the building drop some/most of its resources so this isn’t quite as punishing, assuming the player hasn’t deleted the template then it could be rebuilt. The main difficulty, again, is figuring out how the fire starts and what “passes it on” to the building rather than coming up with a suitable effect. Chances are that it would be an area-of-effect/aura rather than something that’s applied directly to the building – i.e. the fire starts somewhere and is an entity, hearthlings would literally fight the fire (perhaps it’s immune to normal weapon damage, but there’s a new short-ranged bucket weapon which can be used to fight against fires? It could do 0 damage but have 2 effects applied on-hit; one reduces enemies’ courage so it has a use when goblins etc. attack and the other effect deals direct damage to enemies tagged as being a “fire” enemy… this opens up the potential to include new enemies, e.g. elementals or Wizard of Oz witches who are damaged by splashing water on them haha); any furniture and hearthlings in range would take damage over time and if the fire isn’t extinguished before it runs its course then it does the building destruction move.
The really interesting thing about this implementation, though: it allows the player to use fire as a weapon too! Obviously there’s some risks involved, but there’s the potential to make traps or use it to attack enemies who are too powerful to fight directly. Imagine starting a fire in the middle of the Goblin camp, or trapping Ogo’s army in a choke-point and then setting fires around them… the automatic trade-off would be that any loot drops have the potential to be burned up if you don’t extinguish the fire quickly enough (all items have health pools IIRC) so fire traps are basically a last resort for enemies you can’t fight or don’t care about the loot from.
Being done as a mod, there’s a lot of flexibility on concept of “balance” since it’s an optional feature. Players can choose whether to have fire or not, and can even potentially configure how dangerous it is.
ACE’s signalling system could be very interesting for having fire spread, and would certainly help create a rich set of features, but the implementation I’m imagining could be done without that… basically it’s just an entity (whose model is simply some embers with a cubemitter) which can summon more of itself semi-randomly within an range and which does a DoT aura effect to anything in range. Simple, straightforward and intuitive, the only hurdle I imagine is making sure that soldiers aren’t trying to fight fire with their swords LOL! Probably the easiest solution there is to make fire a neutral entity rather than an enemy, and then fire can be harvested/butchered in the same way animals are… there could even be a specific firefighter class to do that job (with bonuses to move speed, how quickly they extinguish fire, resistance to its effects) but I think that’s overkill.
my legendary hammer already bestowes a DOT effect on enemies which damages them so i know how that works, i think there is a way in which you can define valid targets, in this case that would be nature (trees) and that DOT effect could look like fire. problem being we have different sized nature (trees, shrubs etc) how to make the right size effect? (this is also the issue with my implementation of smoking fire, i cant get it to go around a corner if you build a roof above it for instance)
One would realistically want it to, indeed, burn down buildings, items and hearthlings. This would make it something you want to prevent from happening.
Given that you said
That begs the question about what that means code-wise. The game can be ordered to demolish a building entirely, either by Player or by Gary. Maybe the ideal would be to have (parts of) buildings burn down into ruins that can be more easily rebuild, but from what I remember from the building overhaul, that is the hard part. Buildings can be given a health bar to determine when enough damage is done. Other items can be gotten a health bar that the respective crafter would need to tend to after the fire. Heartlings already have a health bar.
Edit: When buildings burn down, the game makes a template, and plops it down in it’s original place, ready for the hearthlings to completely rebuild it.
As for the fire itself, you mention an entity. I was personally thinking the fire might be a heatmap, for which we have some technologies in place. I think this approach might help with computation.
Say every in-game hour (i.e. not that often) the temperature heatmap is checked up on by the game. If at any place the temperature exceeds the combustion-temperature set by a variable in the json of each object, the item will be aflame. Given extreme temperatures, maybe even metals can burnWhen it has been ablaze for long enough for its health to deplete, it might go through some stages of disrepair (using the evolve command used for rotting food) before burning up to either nothing or ashes. The fire itself then feeds back into the heatmap ala appeal to make it hotter in it’s surroundings.
And now I think of it, there might be even more options. I am not sure it is possible, but I am specifically referring to this post from @paulthegreat. A connectivity service can meybe be used to transfer fire from item to item in between the ingame hour that it takes to do it via the temperature heatmap. This should then combine into a system that is light on the PC and mostly dormant when ther is no fire. I hope.
Although having said that, the idea of an actual fire entity pretending to be a living thing with eyes, hungrily ravaging the landscape, that does appeal to me. Maybe even a combination of systems can be an idea.
my innitial thought about this is “prepare for a lag spike every hour” as it check EVERYTHING to the heatmap. might just be me but i’d rather not tax the system more then it has to be taxed.
(in which case KISS applies here (keep it simple, stupid. …or the more PC version tought nowadays: keep it stupid simple )
I meant this in the sense that taxing the system every hour is better than taxing it equally every frame, which I expected to be the case in a simple model, so that slowing the simulation speed would lower the computation costs. That said, it was just an idea. if it doesn’t work, it’s bad. period.
Would a better method check each item once an hour, but spread the load over that hour somehow, or am I think to complicated again.
No you are correct, spreading the load over an hour would be better than doing everything at once, a good example would be minecraft snow, it doesn’t immediately turn everything to snow, but does it random blocks at a time over a period of ingame time