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

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).

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.

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.

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!

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