FIRE.

I am try to build a way to handle fire, like in a crafting system. So, I wrote something that handles:
heat, dryness, humidity, type of wood (different burning time), and finally carbonize to other matter (coal or ash, dipends on volume of the burned object).
WOOD matter has a "critic heat" level that if overpassed can start a combustion process. The dryness percentage determines how much time we need to make the object starting the combustion (when HEAT reaches the "critic" level).
Fire is an object that "incorporates" other objects (becomes the father in the childnodes). Every burning object inherits the type "fire" with all his scripts . Furthermore the combustion process spreads to all the objects that have the same "burning" properties script and are inside the same room (this is dangerous!)... in this test we have a fireplace so it's safe!

The bigger the object is (see volume attribute) the longer the combustion lasts.
The wetter the object is (see WET attribute, in %) the longer it takes to start burning.

The burning object loses volume every turn.

When the combustion finally stops:

  • If the volume of the piece of wood was big enough (a woodchunk for the fireplace), it will be COAL.
  • If the volume of the piece of wood was very little (a woodstick for the tinderbox), it will be ASH.

In future, the Weather lib available in this forum could affect the dryness of a wooden object. So it will be more difficult to set up a campfire after a raining day... :-D
This is a very "simplified" idea of the real combustion process. Could be something useful to make some type of crafting lib.

Also, the "clock", "liquid" and "stackable" library available in the Libraries and Code Samples of this forum are included.
The Liquid lib is included to develop (in the future) something to interact with fire, to stop the burning process. Water...

test_fire_and_combustion.aslx (Main file to run)
libs icluded:
Clock_lib.aslx (from this Code and Samples Forum, modified to the Warhammer Fantasy Roleplay imperial calendar system... Yes, initially I wanted to develop a WFRP text adventure game...)
library_fire.aslx (the main fire library)
LiquidLib.aslx (from this Code and Samples Forum, included, but still not used, for the purpose to interact liquids with fire)
StackLib.aslx (from this Code and Samples Forum, to stack objects, you can stack coal if you create a stacker object for coal )
Utility.aslx (stores some utlity function)

Download from here:
https://drive.google.com/drive/folders/11j3TirIz5W0Qz3JfGWoC6HFIvZS0dZR3?usp=sharing
There are a lot of code loggers that I put to monitor the attribute values.

Start the main file and try this commands in sequence:

  • look fireplace [to reveal the chunks inside.]
  • open tinderbox [Yes, to use it you must open it, there are some woodsticks inside. Leave those inside the tinderbox because the woodstick is the "propeller" of the tinderbox]
  • use tinderbox [you have a small amount of turns to use it after you start some fire inside, so do not mess up...]
  • burn chunk [with the burning tinderbox you can set up a fire to a combustible object.]
  • wait 240 minutes [or wait an arbitrary number of minutes you want. You can use this command that I implemented from the Libraries and Code Samples of this forum, the wood chunks will burn for about 4 hours, [1 turn = 1 minute]. So wait for 240 minutes means that the turscript will fast forward 240 turns... you will see a lot of messages (code loggers to be commented after I am sure the code is ok, so feel free to test it and give me any feedback) ]

I divided the combustion process into three phases:

  1. HEATING / DRYING
    The heat level starts to increase turn by turn, even the dryness value increase , so the chunk now is IN the fire and heating but not completely burning

  2. COMBUSTION
    The heat level reaches the CRITIC heat value, so the chunk is burning. This also changes the volume of the object, for example If you stop the burning process (at this moment it's impossible, I didn't wrote any code to stop the fire) you will notice that the chunk has less VOLUME value than before.

  3. COAL / ASH
    The code replaces the chunk with coal, taken from a REPOSITORY of objects.

The REPOSITORY has the purpose of storing the prototype objects to be cloned.

After some turns in the combustion process, you will notice:
Some ash inside the tinderbox, that once was the woodstick.
Some coal inside the fireplace, that once was the wood chunk.
You don't need to set fire to all three logs, if you want. Just do it for one and the combustion process will spread to all the contents of the fireplace.
Some wood chunks burn before others (depending on the type of wood) and therefore you will realize that by setting fire to the most durable one, you will be sure that the fire will burn all three. The Holm chunk is the most durable one.

This is a very very very alpha version so I need some encouragement.


I'm cutting and pasting my original reply here.

https://drive.google.com/open?id=1RyeQX9BDI5LXtbFpSYLOedUMsXrujQ2_

Fire is my most-developed part of my template (aside from a world clock time and regions/ambience).
What you want to look at are the class libraries for fire, and you can see how they work by:

Start the world template.
Wait about a minute for the sun to come up (was in the middle of testing world time)

Then try the following:

get match
You pick it up.

light match
The match ignites!

light candle with match
The candle ignites!

douse candle
You douse the candle.

light candle with match
The candle ignites!

Then, just stare at the screen for a second, then the following happens:

The match burns out.
There's nothing left of the match.

And then wait even longer, the following happens:

There's nothing left of the candle.


My goal was different than yours. I wasn't worried about crafting, just how fire interacts with objects.

My objects class for fire means:
an object can catch fire or cannot
an object can be a source of fire (a match can light) or cannot (a candle must get lit)
different objects can burn once, ever, and that's it (a match) or be doused and re-lit, until it reaches maximum burn consumption


Added a turnscript "Global Heat", to reproduce the natural loss of HEAT after the combustion. Something HOT slowly go back to its natural climatic temperature. I set it to 25°, but you can set it the number you want, the WEATHER library could be helpful to this scope.


Yes, this is a different approach. My lib is for a turn based game, so I tried to avoid timers.
Anyway feel free to use anything you want from my code, hoping this could inspire you.

I am trying to find the original "Portable Lanten" code, a long ago once posted in this forum. Where can I find it? This forum has changed a bit and now it's hard to find some old posts...

Thank you for the reply.


Is this what you're looking for;
https://textadventures.co.uk/forum/samples/topic/4610/portable-lantern


Thank you, but what I mean was a page with a code (and a turnscript).
It seems it's disappeared. Anybody remember what I'm referring to?


I found it.
http://docs.textadventures.co.uk/quest/handling_light_and_dark.html
It was changed from "portable lantern" and integrated with this new thread!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums