How To Set People On Fire

Or another day of learning how to do Lua scripting with artists. (It’s easier than you think.)

It's simple, really.

Just click the button. You monster.

I’ve been excited about the possibilities for our scripting system to handle fire and fire propagation for some time and finally made the chance to start working on it this last week while I was delving into some combat scripting (and that with regard to making The Troubles With Fish People more aesthetically pleasing).

That's how you set people on fire.

That’s how you set people on fire.

This man is not as upset as he should be about having the "burning" tag associated with his game object.

This man is not as upset as he should be about having the “burning” tag associated with his game object.

As you can see above, it is pretty simple to associate a lovely fiery-looking particle system with a character’s render object, make a puff of flame, and play the appropriate sound. Well, simple enough once Nicholas sorted out an issue with particles aligning to their parent animation bone vs. world, the fix for which unfortunately broke musket shot effect particles, but stiff upper lip and all that.

The cool part is that tag there, the “burning”. We can associate any tag – a string – we want with any object in the game we want then have game objects start behaving different if they detect that tag, or if they detect that tag on another game object.

The "I am on fire" icon.

The “I am on fire” icon.

Every object in the game receives an update call for every data tick which is executed unless they’re set to “sleep”, like rocks, grass, and that is not dead which can eternal lie and all that. (I should say also, this is a surprisingly quick process due to some sorcery or other which Micah performs for us.) So the game is essentially turn-based, firing off about ten turns a second while executing the rendering even more often thus giving the illusion of a real-time game. Isn’t that neat? I’m sure all the coders are cringing at my explanation, but David is here to tell it like it is. Real Talk.

So “update” is where I snuck a line into the character game object’s script so that when its update is called, the character asks “am I burning?” and if so, will lose health until they die. (Yes, we should explore the possibilities of extinguishing oneself if on fire, but all in good time!) I also had characters who are on fire set adjacent objects on fire but that got out of hand almost instantly so I’ve commented that bit of the script out ’til I get a chance to balance its effects properly. In anticipation of that glorious day, I did go through every entry in our commodities database and tag appropriate goods with either “flammable” or “explosive”. Clockwork Empires is, after all, about things going terribly wrong.

The terrifying burning shovel.

A terrifying burning shovel.

Elsewhere in code or script or something which I just assume works because I’m the art director and not a coder, characters query activities they could be doing like “stand around doing nothing”, “chop down a tree”, “have a conversation”. These are fired based on various weighted values which may include such things as “is an object near me on fire?” – and if this is so, to commence with the “run away screaming” activity. So I did that, as you can see to the right.

Nicholas was also kind enough to make me a query for this where a character can check if they have a particular tag which in this case is “burning” but could be all sorts of fun stuff like “isCorpse” or “infected_by_Selenian_Fungus”. There are foundations here, gentleman, upon which we can build castles. Burning castles!

This barbecue is terrible, pass the whisky.

This barbecue is terrible, pass the whisky. (Also shows off the misaligned particles bug which is now fixed, totally fixed [unless you’re a musket], so no one needs to comment on it.)

In short, the possibilities are spectacular and implementing them is shocking easy. Heck, even an artist can do it.

Posted in Clockwork Empires | Tagged , , , , , , , , , , , , , ,
27 Comments

27 Responses to “How To Set People On Fire”

  1. Headjack says:

    Is that a cannon with a stock on it in the first image?

    { reply }
  2. wootah says:

    I love the particle animations (or at least the stills of them).

    Is the engine powerful enough that you could designate parts of a character (such as the arm or leg) to catch on fire and spread to other parts as opposed to the whole entity burning? I realize this gets back to the Hit Point Dilemma thread, but more often than not a person who catches on fire usually doesn’t have it occur in a binary “Burning” or “Not Burning” state, but from a single point of ignition. If it is powerful enough, is it worth the effort? A player who might have their leg brush up against a not super safe Furnace might have their leg catch on fire and put it out before it catches them entirely on fire… but then again that might not be as ‘fun’.

    { reply }
  3. Bropocalypse says:

    “Well, he’s on fire, but he’s ALSO infected with eldritch spores. Sooooo let’s just let that one lie.”

    { reply }
  4. Danny says:

    Looks like someone wants to set his willy on fire, specifically.

    { reply }
  5. Matthew LeTourneux says:

    I appreciate your highlighting/option reticle thingies are centered on the NPCs’ crotches.

    { reply }
  6. Luxray says:

    The e-mail notification took me to the tale of Thaddeus Cogthingy transcribed by dusty gas-lamp a week ‘afore. I was most perplexed. No matter.

    { reply }
    • AdminDavid Baumgart says:

      Oh damn, I messed up the link due to rushing this out.

      Totally impossible to fix now, unfortunately. It’ll just haunt me. Forever. Urgh.

      { reply }
  7. Michal says:

    I think the problem with the fire distribution to other objects could be solved by adding a “heat” stat to every flammable in-game object. This stat would be scaled (let’s say 5 for paper, 8 for people, 10 for wood and 20 for coal) and if the stat bar would be full, the object would get the “burning” tag. If one object with this Heat stat would be in adjacent square to another object with the Heat stat of higher value (for example burning person – value 8 of 8 would be next to a stack of not-currently-burning-paper – value 0 of 5), the Heat stat of object with lower value would be increased every few ticks until the values would be equal. If an object with a Heat stat would not be adjacent to another object with a higher Heat stat, the value of its Heat stat would decrease every few ticks (with the exception of objects with the “burning” tag). Just imagine the possibilities – the Fun in hot climates (with ambient Heat value) or the possible Fun with the stack of documents on the overseer’s desk in the forge worshop (as the forge workshop would have ambient Heat value too, right?) Ohhh, there can be so much Fun with the burning opium pipes around gunpowder.
    But I’m no programmer, so disregard anything I said. I’m just dreaming of the burning elephants and puppies…

    { reply }
    • SangerZonvolt says:

      I agree with your suggestion, but I think multiple pbjects near to each other should be able to exceed their natural maximum heat. In your example even a thousand papers could never set a log of wood in flames cause paper would have a maximum heat of 5 and wood needs 8. Maybe add a few points of heat as soon as they catch fire and make it possible for heat from multiple sources to add up (maybe not 100% realistic but good enough for simulation puposes).

      { reply }
      • Davud says:

        Well what about the fact that fires are naturally hottest in their centers, and degrade in intensity as distance increases? So what if the center was at the said heat value, and every square (or two, or w/e) would decrease by one, assuming it’s all being heated from a single square and radiating outwards.

        { reply }
        • Michal says:

          I think the simpler soulution would be that the maximum heat level of the object would be increased for example by ten percent per every object with the “burning” tag in adjacent square. Then the center of the massed burning objects of the same type would be much “hotter” than the edges.

          { reply }
  8. Thomas says:

    Ahhh, characters who ‘react’ to being on fire. That’ll be a breath of fresh.. uh.. smoke.

    I’m so used to the Dwarf Fortress thing where they’ll be engulfed in flames, but perfectly fine with it as they leisurely stroll through the stockpiles to get a drink of booze, igniting all the furniture and boxes and barrels along the way.

    { reply }
  9. NomadBrasil says:

    You should be able to set people on fire, apreend one of the guys that every night goes to the forest and talks to little Lucifer ,put him on a wooden pole and set him on fire ,this may cause people to be afraid or even cause riots.
    Ps: i have a idea , if your older colony rebelled because of your rule whit a iron fist and you lost the control they could tutn into a pirate outpost (or something like that) that you need to assault to stop raids and other things.this whil make your older games participate in interesting form in your present collony

    { reply }
  10. Cutter says:

    “Clockwork Empires is, after all, about things going terribly wrong.”

    That, gentlemen, should be your marketing tagline for this game. I actually LOL’ed at that.

    And you should be careful about ‘A Man on Fire’, particularly if it’s Denzel Washington.

    { reply }
  11. Sneaky says:

    So this is what happens when an artist attempts programming – things literally catch on fire.

    { reply }
  12. JASON says:

    this blog, for me, counts as a weekly webcomic on my “List of Hilarious Places To Visit on the Web”. Thank you for every post!

    { reply }
    • JASON says:

      ooh ooh, on that note, can you make a short comic strip as a multi-purpose advertising campaign/continuation of the blog’s humor/ possible things to do in the released product?

      { reply }
      • AdminDavid Baumgart says:

        I actually used to do comics for Dredmor but it turned out that doing just one took an entire day of work, at least to pull it off really nicely. As much as I love drawing comics, spending 20% of my work-time drawing them isn’t a good way to spend my time if my goal is to finish the game, ya know?

        { reply }
  13. gt says:

    So this is what happens when an artist attempts programming – things literally catch on fire.

    { reply }

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>