The Basis Of Generic Programming / Scripting For (Almost) Every Engine

Being completely new to programming or scripting is the most scariest part of your indie game developer journey. After all, it is the most important part to game development. Without it you can not make a game.

 

So now your probably thinking, well how can this relate to the engine and / or language your about to learn. These fundamental principles are used in nearly every language. As a result, visual scripting such as in construct 2 also uses the same principles. It’s these principles that, with a little understanding, will have you thinking in no time about all the great things you can do.

Scripting is all about manipulation, believe it or not. Manipulation of data is what you will be mainly doing when scripting. So for a fine example, in a game you might have money. Of coarse you would like to manipulate the money, add to it and take away from it. So how would you store that data. So you can reference and manipulate it?

Variable

A variable is exactly what the name imply’s. It’s data that can be manipulated. In nearly every language you will be able to declare a variable. Usually by declaring the name and then it’s beginning value. Variable’s are used only when your game, program or website is operating. As soon as you close it, that value or the variable will reset to it’s beginning value.

 

So despite how you manipulate the variable, being slightly different in each language. You will need to create conditions of when to set the variable to something else. You will need:

If Statement

“If” statement’s along side variables, might just be the very core to all programming and scripting languages. An if statement work’s simply, “IF” “Condition” then run code. Not to cause confusion, as this will be different depending on which language your learning, I won’t use any example’ from real languages.

 

You can also then keep an if statement going depending on what you would like to check for. For instance: “IF” “Condition” do this, “ELSE IF” “Condition” do this, “ELSE” do this. Hopefully this will help understand how you can use an if statement.

 

So what if you had a certain if statement condition that you would like to use time and time again. You could copy the same bit of code over or over again. That or use an:

Function

This might be something you’ve read about before. It’s used in two different way’s depending on the language. In some cases you have what is known as “Built In Functions”. These usually run a predefined code giving you quick easy access to doing a certain job. The other way to use a function is by making your own. You should be able to call the function using a piece of code which in turn will run anything with in the function.

 

There’s a lot more to programming and scripting. Though these few fundamental principles are universal in learning nearly any language. Knowing these is the perfect basis to get started with writing and thinking in script.