Alpha Revolver Games

Challenges, Professional Growth

Leave a comment

This week, I said i was going to talk more specifically about challenges I have been faced with during my time on this project. However I feel like before I do, its important to touch on the basic concept of Object Oriented Programming; and how OOP differs in GML when compared to vanilla C#. Object Oriented Programming is, at its core, implementing behavior or functionality of objects within the games environment. This functionality will then form the boundaries of the games world; setting up rules, initialising game mechanics like so:

when this happens > do this.

when that’s finished > do this and this and this… etc.

Expanding on this, the most basic example of OOP is a simple if statement:

if(player gets shot){

 reduce health by amount;

}

the above pseudo-code is an example of one such rule: if the player is shot, they take damage.

Regarding differences  between C# and GML, I have noticed a significant fundamental difference in how I personally implement functionality:

in GML, if I want to execute a piece of code ONCE, I feel like the easiest way to do so is to use an IF statement, in conjunction with a Boolean variable, like so:

if(enemy_Killed){

add_Score = true;

}

if(add_Score == true){

score += 100;

add_Score = false;

}

this code will only add_Score ONCE, whenever an enemy was killed; because the Boolean is true, the code within the if statement will fire at the end of which, the Boolean is set to false, so the code will not run again until it is once again true.

in C# if i wanted to run the same code with the same functionality, I would call the function add_Score() from the update function like so;

void Update(){

        if(enemy_Killed){

        add_Score();

        }

}

public void add_Score(){

score += 100;

}

in GML, 95% of my code is in 2 places, the create event (essentially the Start() function of GML, initialises variables and objects) and the step event (which is basically the Update() function of GML). In C# my code structure is very different.

That is essentially programming in a nutshell, very iterative, very logic based, very heavy mentally, trying to solve problems, trying to explicitly tell the program what should happen in any given situation. Next week, I will talk about those challenges I eluded to 🙂

Thats all Folks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s