The Storytelling Behind Coding

I’ll be the first person to admit that I’m not an expert coder. In fact, I’ve only begun to unpeel the banana. But, as I notice other writers and creative minds straying away from the incredibly technical, logic-based language of it, I feel that there is a much-needed change of perspective. After all, writing code is writing! It is language! And isn’t that what being a writer is all about?

Hear me out. I promise I won’t get super technical with this!

Let’s look at one of the fundamental algorithms of programming: a conditional statement. Essentially, for the program, what you’re saying is “If a variable is true, something will happen; else something different happens.”

But this doesn’t mean anything in either coding or storytelling. It’s just a formula. Which is mathematical. And scary. But, I promise you that it isn’t and doesn’t have to be. The real magic comes when you fill in the blanks.

Let’s say that you’re a child shopping with your parent at a grocery store. That delicious Snickers bar on the counter keeps calling your name; you know that only that bar will bring you happiness. You’re at the check out counter… 

You know if you get that Snickers, you’re going to be happy. If you don’t, well… you’re probably going to throw a tantrum. Or at least cry. 

Thisis programming. Thisis a condition statement! Of course, in programming language, this may look something closer to:
            <<if $Snickers is 1>> <<set $Happiness += 100>>
            <<else>> <<set $Happiness -= 100>>
            <<endif>>

That right there is our situation. Those lines of code (which I’ve written out in a language for Twine) probably look really intimidating to some of you. But, why let a few symbols deter you from the possibilities? I mean, punctuation is just symbols, but that doesn’t stop us from telling our stories on paper! Does it?

Essentially what the above code is saying is our situation. If you have the Snickers, your happiness level goes up. Here, we’re using two variables to play out the scenario – whether you have the Snickers ($Snickers) and your happiness meter ($Happiness). 

We’ve just taken a situation and turned it into an algorithm, a formula. And it’s truly as simple as that. Instead of focusing on the crazy little symbols or the math of it all, consider what the coding is telling in story form.

Now, this example can’t even begin to scratch the surface of truly complex coding and programming. But, it is this kind of thinking that we as writers can use to our advantage in the gaming world. Understanding the basics of logical thinking and “if this, then this” formulas can make mapping our your game stories so much more complex, intricate, and ultimately, more centered around the gameplay.

Every line of code relates to the story, and the sooner you understand the potential for that, the easier it’ll be for you to start writing your videogame masterpiece!

No comments:

Post a Comment