Flames

https://attnam.com/topics/Flames

The Cathedral of Attnam > IVAN Development

#1 May 21, 2014, 3:46 pm Hide

fejoa

EDIT 20141116 - I figure I can use this first post to put up the to-do list:

Synchronised to sandbox repo:

20141116 - Graded charring in the bitmap, achieved by selecting the RGB colour with the max intensity, RSHIFT max intensity by 2, RSHIFT old RGB by 3 and then add these together with Max>>2 to form the new 'burnt' RGB values
Different materials now have different burn times. Introduced a BurnModifier() which determines the duration of burning based on material strength, fire resistance and density, according to the formula (500 + Den + ((Str * FR) >> 1))
20141116 - Made it so that the words "(on fire)" appear in the post-fix of meleeweapons and armors that are on fire, a la fluids (covered in ...)
20141116 - Prevented wooden flaming swords from catching fire. Achieved this via CanBeBurned in item.h and item.dat and test condition in item::ReceiveDamage
20141116 - Caused burning phoenix feather to reset and stop burning once it gets completely burnt. Wondering if this needs a separate message.
20141116 - Introduced code for extinguishing flames via the function Extinguish() (opposite function to Ignite()) - wielded equipment graphics still do not extinguish for some reason
20141116 - Ghosts, powder, fluids were all burning. Even the snow in Attnam was on fire! This was fixed by adding "virtual int IsBurning() const { return 0; }" to liquids (therefore powders) and gasses. Not ideal means of fixing this. it should really be fixed at the level of object.h

Updated the Activation energy threshold to the following formula:
ActivationEnergy = 0.5 x MaterialStrength + 5 x MaterialFireResistance + FireResistanceItemEnchantment
Revised hence the FireResistance of all materials


 key:
 (YYYYMMDD) = complete
 BF = bugfix
 FE = feature
 BA = balancing
 
 To do:
 
 BF - Graded charring in the bitmap
 BF - Whenever a meleeweapon or something with a secondary material is completely burnt, then a lump of the secondary material is created
 BF - Flames do not go away on wielded equipment when extiguished. Clue: The flames do go away when the (phoenix feather) sword is covered in blood
 BF - Flames do not animate when a stick of balsa is ignited (item sitting far away when ignited??)
 
 FE - Once something is on fire, try to get it to infect the rest of the stack and player inventory
 FE - Introduce the 'on fire' postfix, for (all) things that are presently on fire
 FE - Include wetness in the formula for activation energy
 FE - Handle the duration of burning via mass-density, fire resistance, enchantments and material wetness
 FE - Implement ways of putting flames out
 FE - Introduce thermal energy (integrate fire damage over cascading explosions)
 FE - Chance to decrement enchantment when gear is burnt (magic fire?)
 FE - Flaming sword burning effect
 FE - Smashing lanterns should be a source of fire
 FE - Get tailors to repair burnt fabric
 FE - Burning bodyparts
 FE - ?Create smoke in tunnels
 FE - ?Vomit to extinguish fires
 FE - Burning objects persisting in the bonefile
 FE - Burning golems
 FE - Burning phoenix feather golems
 FE - Make it so melee weapons that are on fire spread fire to enemies
 
 BA - Hard code ironalloys so that they cannot burn (avoiding (possible?/untested) conflict with rusting graphics)
 BA - Give goblinoid magic users mirrored wands
  
 Partially done:
 
 20141116 - FE - Destroy objects once they are completely burnt up
 20141116 - FE - Special property for phoenix feather material
 20141116 - FE - Introduce the 'on fire' postfix, for meleeweapons and armors that are presently on fire
 
 20141116 - BA - Improve ignition by way of explosions. Get Explosion Strength to scale nice and linearly with Activation Energy
  
 Complete:
 
 20141116 - BF - Stop - f.ex. wooden - flaming swords from catching fire
 20141116 - BF - Ghosts, powder, fluids are all burning. Even the snow in Attnam is on fire!
 
 20141116 - BA - Prevent the TestActivationEnergy algorithm from testing objects that cannot burn anyway
 


Original post, for history:

So far, I have been able to light the player on fire.

in bodypart.cpp:
int rightarm::GetSpecialFlags() const { return !GetMaster()->IsPlayer() ? SpecialFlags|ST_RIGHT_ARM : SpecialFlags|ST_RIGHT_ARM|ST_FLAME_1; }

EDIT: Latest discovery is that the above code causes the game to crash when you sever your right arm :\
#2 May 21, 2014, 4:41 pm Hide

Ernomouse

Awesome! Remember to create appropriate graphics and the smoke. We want blinding smoke in the tunnels, only penetrable by infravision. Maybe ESP for creatures...
#3 May 21, 2014, 7:51 pm Hide

4zb4

So does this change the material of the character's affected limb to "Burnt Flesh" and also that is a horrible, horrible thing.

//You hear a faint thump.
//You look down and see an active big mine.
//The big mine explodes!

YOUR HEAD IS ON FIRE!
YOUR TORSO IS ON FIRE!
YOUR GROIN IS ON FIRE!
YOUR LEFT LEG IS ON FIRE!
YOUR LEFT LEG IS SEVERED OFF!
#4 May 21, 2014, 11:46 pm Hide

chaostrom

Infravision is "heat-vision" as they like to call it. You won't be seeing anything through flames with that.
#5 May 22, 2014, 7:01 am Hide

red_kangaroo

Will the flaming swords set your enemies on fire, or simply do additional damage like now?
#6 May 22, 2014, 7:20 am Hide

Ernomouse

Chaostrom, you are right, you shouldn't see through flames and fire. But through smoke only... I'd say yes.

red_kangaroo, I like that idea. A lot.

Edit:

My thoughts on smoke and fire:

Smoke is generated by PC, NPC's and monsters or items and tiles that are on fire. The amount of smoke generated should be relative to the mass that is on fire, and maybe even for how long it has burnt already. If you want to go all the way, some materials like wood generate relatively little smoke, and others like rubber create a massive clouds of smoke. But that's taking it a bit far.

I like to think that smoke (and other gasses, magical mushrooms anyone?) should disperse into adjacent tiles with less smoke. Say you have two tiles, one with 100% smoke and the other 0% smoke. After a short period of time, the two title system should contain two 50% smoky tiles. To make things more simple, you could use the values 0 %, 25 %, 50 %, 75 % and 100 %. With those 5 values you should be able to do a whole lot.

Tiles with 100% smoke should put out fires and cause unconsciousness followed by death, if the player suffocates (a new state, used for choking on gasses and drowning) in them for too long. This has the potential to burn out all the air on a level, which make for very IVANesque bones files. Suffocating should produce a warning message once when attained, and maybe once when about to lose consciousness.

Fire should eventually burn out by itself, when there is nothing left to fuel it. Like smoke, it should spread to adjacent tiles with something flammable in them. Check for tile itself, items, gasses and monsters / PC's / NPC's.

Fire destroys items which do not burn, if the items are in fire for too long. For example armor becomes charred and start losing enchantments until their AV drops to 0 and they are destroyed entirely. ("You see a steel plate mail -5. It is charred.")

If you dump water on a fire, the fire will go out. If you dump a mine in the fire, the mine will blow up after a while.


I realize that all this is a LOT of work, and all of it doesn't have to be in the next version. This is intended more as notes for the programmers... Take it or leave it, is up to you.
#7 May 22, 2014, 8:30 am Hide

red_kangaroo

Ernomouse wrote
Tiles with 100% smoke should put out fires and cause unconsciousness followed by death, if the player suffocates (a new state, used for choking on gasses and drowning) in them for too long. This has the potential to burn out all the air on a level, which make for very IVANesque bones files. Suffocating should produce a warning message once when attained, and maybe once when about to lose consciousness.

Gas Immunity protects agains smoke suffocation, I suppose? And if we are to have vacuum levels (MuwahahaHAHAHAHAHA) there really should be something like an amulet of unbreathing (or you could poly into e.g. golem).

Ernomouse wrote
If you dump water on a fire, the fire will go out.

You should be able to put out fire by vomiting on it.

You are on fire!
You vomit. Vomit is spilled all over you.
The fire is extinguished.
Your head dissolves.
You die.
#8 May 22, 2014, 8:39 am Hide

Eagle V

Wand of Undeath: you temporarily need no air or food, and have poison immunity, but it gives you lepra and lowers charm. Healing while undead counters the complete status effect, not just lepra. Close range, so you can't just zap Sherry with it and run till her arms and legs fall off. Maybe scroll/potion of undeath to limit range. Also makes you slightly more chaotic (and Scabies loves you), maybe skeletons/zombies don't attack on sight.
#9 May 22, 2014, 10:07 am Hide

Ernomouse

Amulet of Resist Death xD

As the name implies, this has to RESIST death. Not prevent it...
#10 May 22, 2014, 12:53 pm Hide

capristo

Oooo I love the thought of fighting through GC6 with a flaming sword and there's a bunch of burning zombies wandering around.
#11 May 22, 2014, 4:45 pm Hide

fejoa

This is all good stuff which I am taking on board. I'm starting with some visual effects so that I can see where the flames are. Then I can get to work on making them propagate through the game environment.
#12 May 22, 2014, 8:44 pm Hide

Pent

In the interest of extinguishing fires (among other uses), an ability to 'e'mpty bottles/cans onto nearby squares would come in handy. I'll look into this one when I get a chance (probably early next week; I'll be away for the weekend).
#13 May 22, 2014, 10:24 pm Hide

4zb4

Yes I do imagine smashing a bottle of water against the nearest wall to extinguish yourself looks a bit silly.
#14 May 23, 2014, 2:49 am Hide

chaostrom

4zb4 wrote
Yes I do imagine smashing a bottle of water against the nearest wall to extinguish yourself looks a bit silly.
"Oh shit, flaming corridor! Time for my grenade of H2O!"
*Dramatically throws bottle of water against the ajacent wall*
*Is covered in glass and water*

On a more serious note:

Pent wrote
In the interest of extinguishing fires (among other uses), an ability to 'e'mpty bottles/cans onto nearby squares would come in handy. I'll look into this one when I get a chance (probably early next week; I'll be away for the weekend).
I always thought you should be able to choose a square to throw to. Actually makes bottles of acid usable.
#15 May 23, 2014, 4:52 pm Hide

capristo

Weren't ranged weapons planned eventually? Then you should be able to either fire a ranged weapon or throw an item at an intended square, and of course the distance of how far you can throw is affected by arm strength.. maybe dexterity also affects accuracy
#16 May 26, 2014, 9:26 am Hide

[Eire]MadHatter

Ernomouse wrote
Amulet of Resist Death xD

As the name implies, this has to RESIST death. Not prevent it...


I think I understand what you mean...

So something like prevents a golem boxing your head clean off with a critical punch,
Before you even have a chance to look at him.

Prevents instant death.....1 hit KO's
Have it just as rare as amulet of life saving but breaks just as quickly?




On a bad memory note....

wasn't there a feature removed from IVAN that allowed bottles and items to be dipped into dead bodies?

I don't remember but I'm sure i remember reading you 'Could' dig a bottle into a spiders body to collect spider poison to use as a weapon...or suicide item for endurance training.




I do like the thought of burning limps.

How about this as well....

If you are on fire ...or not.
you have an action to 'roll around' on the ground to put out fires as well as bath in whatever liquid is on the ground?

Me:"Oh crap my potion bottle smashed and My head is just about chopped off!"
*Rolls in the liquid and glass splinters.*
Me:"Ahhh thats bet.....AHHHH THIS BURNS!!"

you thought was healing liquid....was actually dolan acid.!
#17 May 26, 2014, 1:37 pm Hide

Ernomouse

(Eire)MadHatter wrote
I think I understand what you mean...

So something like prevents a golem boxing your head clean off with a critical punch,
Before you even have a chance to look at him.

Prevents instant death.....1 hit KO's
Have it just as rare as amulet of life saving but breaks just as quickly?

Yeah, that's exactly what I want the name to imply, just another AoLS! The true effect however is quite different. It only prevents death from passive sources as hunger, drowning, burning etc. and does nothing against the mighty golem you thought you could take with the extra insurance...
#18 May 27, 2014, 4:11 am Hide

[Eire]MadHatter

Ernomouse wrote
Yeah, that's exactly what I want the name to imply, just another AoLS! The true effect however is quite different. It only prevents death from passive sources as hunger, drowning, burning etc. and does nothing against the mighty golem you thought you could take with the extra insurance...


Satan plz...

But yeah that wouldn't be so bad.
I've died several times running from the caves to attnam just from starvation.
[lugging heavy armour and some loot....running full speed to attnam.]
#19 Jun 12, 2014, 2:17 pm Hide

fejoa

Ok, just a little update:
I am currently working on getting a visual effect going for flames. The reason for this is because I want to be able to have a visual cue for how the fire will spread from item to item. I have set my sights on using the existing "flaming sword" type graphics, for now, in lieu of more awesome looking fire. (for instance, the flame base goes along the top of the bitmap main material, but I would like to try make it go from the bottom).
I am trying step by step to light a single stick of balsa wood on fire, by 'a'pplying it. So far I managed to light the whole dungeon on fire, but not the stick. I just got it working. It is quite hilarious and I promise to post pictures of this soon.
I know why the dungeon goes up in flames, but I don't know how to set the truth variable to zero initially. I will post code as well, so you can have a look and maybe give a few pointers.
Right now, a cold beer.
#20 Jun 12, 2014, 4:38 pm Hide

capristo

Haha that sounds awesome. Looking forward to the screenshots
#21 Jun 13, 2014, 2:49 am Hide

chaostrom

Haha, everything burns but the stick XD

I want to see that.
#22 Jun 13, 2014, 4:35 am Hide

[Eire]MadHatter

I probably would've made it where fire engulfs you entire body visually....so just a big square of fire.
Then you can read in the text box......
your left arm is burning!!
your left arm is scorched!!
your left arm is burned off!!

What about if say theres a material called soot or charred.
.....like a black water for now.....but it covers stuff similar to how water does. When items burn.



And Obviously Fire should cause a high level of panic while burning...

"I appear to have burst into flames. - The Spy on the blatantly obvious"

...erm...metal armor holding onto fire longer?
Throw it onto the ground until it stops burning/being hot?

SPOILER ALERT. Click here to see text.
#23 Jun 13, 2014, 12:47 pm Hide

Ernomouse

We need a new special wand... Stick of Armageddon, which lights EVERYTHING on fire when applied. =D Or something like that.
#24 Jun 13, 2014, 1:34 pm Hide

red_kangaroo

Ernomouse wrote
We need a new special wand... Stick of Armageddon, which lights EVERYTHING on fire when applied. =D Or something like that.

I imagine it would be enough to zap a wand of fireballs. Once again, WoF will prove to be the most dangerous wand ever!

#25 Jun 13, 2014, 4:11 pm Hide

fejoa

EireMadHatter wrote
What about if say theres a material called soot or charred.
.....like a black water for now.....but it covers stuff similar to how water does. When items burn.

This is a good idea. There are powder materials, like sand, snow and gunpowder available, so soot would be a natural extension to this concept.

Well, the results go as follows:
03.png: Get into the level. What the? A flaming wand of striking!
04.png: This kobold's pants are on fire! It is getting ridiculous.
05.png: get stick with pick-axe (it is not on fire)
07.png: apply the stick...
08.png: the stick is now on fire! Some output thingees indicate the state of the flag responsible for determining whether the object is on fire or not.
09.png: what does the rest of the level look like? There is a flaming spider!

As you can observe, there is lots of functionality missing. Like for instance, there is no discrimination yet between items in a stack that are on fire, or not on fire, so these items just pile together and look silly at the moment.

It begs the question, why are only some of the objects in the level on fire?
This is because when the flag is instantiated, it is not initialised to zero first. Most of the locations in the memory contain the integer zero, but there are still some memory locations that contain garbage, and so these are non zero. The variable Burning will take on a non-zero value, and so this will reveal itself as a spot fire in a level in the game.
My question is, in the code added in object.h, how do I initialise the truth variable Burning to zero generally?

Code:
//In object.h:
class object : public entity, public id
{
	public:
	...
	truth Burning; //Added
	virtual void SetIsBurning(truth What) {Burning = What;} //Added
	virtual truth IsBurning() const { return Burning; } //Added
	

//In miscitem.h:
ITEM(stick, item)
{
	public:
		virtual truth Apply(character*); //Added
		virtual truth IsAppliable(ccharacter*) const { return true; } //Added
	protected:
		virtual void AddPostFix(festring& String, int) const { AddLumpyPostFix(String); }
		virtual truth ShowMaterial() const { return false; }
		virtual truth WeightIsIrrelevant() const { return true; }
};

//in miscitem.cpp
truth stick::Apply(character* Applier) //Added this function
{
  if(Applier->IsPlayer())
	{
    ADD_MESSAGE("You light %s.", CHAR_NAME(DEFINITE));
		ADD_MESSAGE("Burning is %d", Burning);
		ADD_MESSAGE("IsBurning is %d", IsBurning());
	}

			SetIsBurning(true);
			UpdatePictures();
			ADD_MESSAGE("The %s now burns brightly.", CHAR_NAME(DEFINITE));
			ADD_MESSAGE("Burning is %d", Burning);
			ADD_MESSAGE("IsBurning is %d", IsBurning());
			return true;
}

//in object.cpp:
void object::UpdatePictures(graphicdata& GraphicData, v2 Position, int SpecialFlags, alpha MaxAlpha, int GraphicsContainerIndex, bposretriever BitmapPosRetriever) const
{
	...
	
	alpha Alpha;
	// added this new condition below
	if(IsBurning()) //is burning is sometimes initially filled with crap, so Burning should be initialised to zero
	{
		SpecialFlags &= ST_FLAMES; //this should be the |= operator, not the &= operator. 
	}