Thinking like a programmer when using GameSalad

contrasthallcontrasthall Member Posts: 131
edited March 2013 in Community Tutorials
-I have Been wanting to write this for a while. I have jumped in and out of programming my whole life but my true passion is creating games. Something from my mind instantly visualized and interactive in front of me is it's own reward.

-Any one who has looked into a bit of programming will understand GameSalad better because it is programming. Just a click here and a click there are writing lines of code for you. It's the understanding of what lines of code/rules you will need to create for the game that will help you focus on how to attack making your games.

PART 1: FPS INTRO-
In non object orientated programming you write lines of code or as i like to call it rules for you program. "hey program this is what you do, this is what you don't do and check this and don't do this". Well lets say you have a hundred lines of code for a simple program, all those lines are checking PER screen it shows you...but a screen isn't what you see with your inferior human eyes, a screen to the computer is a frame per second rate to the computer. this is the fps term you will here in the community...you will see it when debugging your game as well it will flicker around 59 60 or much lower depending on how many lines of code your game has to check aka how many things are going on at once in your game.

Let's say you have a ball bouncing around between some invisible walls and that's it...well your game checks the rules, does the math on where the ball was and where it should be now and if it hit a wall and changes a true or false depending on if it hit a wall and holds that true or false in memory and updates the frame....now times all that by the full frame rate and your simple bouncing ball program checks all that 60 times a second. Optimizing your game is all about making it easier to check and move things around as fast as it can. If you have a million bullets flying around every second and those bullets are massive images and 200 bad guys and tons of rules to check....well then good luck having your game check that at 1 frame per second.

part2: Variables
In most current programming languages you have variables. Variables are integers "numbers", a true or false "which a computer sees as a 1 or zero basically in memory" or a string of characters. This is the same in GameSalad you pass and save information through out your game with variables and think a head of what information you will need to know every frame per second or much later on in your game. This will help you be more prepared if you figure this out before jumping right into your game.

i like to think of the game as a pyramid and at the top is the name of the game, the first point. From there it branches out. The next row below the name of the game is "what is in my game? " lets say i have a good guy and a bad guy and a bad guy bullet he shoots. Well now i have to think about the next row in my pyramid. This 3rd row is what rules or code will i need to tell these 3 objects in the 2nd row...the good guy will have rules like what to do when hes dead, what to do if hes jumping, what to do if he is hit. From there i will know about the Variables in my game, i may need variables like true or false - hero jumping,hero alive?, or integers like how many times the hero has been hit by bad guy bullets. So Variables would be the 4th row. To summarize top/level 1 of pyramid - name of game, level 2 actors, level 3 actors rules, level 4 variables needed for rules and actors and game..try it next time i guarantee a smoother game making process.

part3: loops
loops in program are rules that are setup with sort of a human sentence structure. A "if ,then" loop is written like if x = 2 then hero dead = true. There is also a "do,while" and "for" loops that are similar depending on a programmers needs. Well these loops should look familiar, you use them to write your rules in every character and objects in GameSalad. You will have rules like "Actor receives touch = true" then you will add actions like move your character. Well you just wrote a "if,then" loop with your mouse congratulations programmer you just told your game "IF touch = true THEN do this". When creating a character, think of the questions you will have to ask or tell your program to do..is my hero jumping this frame? is he being hit this frame? is he jumpingANDbeing hit?....think of all the options that are possible from the world you're creating.

part 4: Object Orientated programming
OOP is the most up to date style of programming we have today. Programming started by flipping switches on or off simply telling massive computers this is true and this is false and if this is true and false then this is true or false...after about 6 months and 20 scientist they may have gotten it to count to ten on its own. From that we made programs to flip the switches for us and then we could write pages of code it would scan from top to bottom from what you wrote and check the rules a long the way. Currently most programs use object orientated programming, the program starts at one page of code and then some where in there it tells it to go somewhere else another page of code otherwise called another object and then it could go somewhere else or back to its main page and continue. In object orientated programming you create objects like a page of code for race car, well the race car's original line or code/rules is called your race car class...its just the main blue print but we could create 5 "instances" of that class creating 5 race car objects. The race car blue print/"class" is in the code but doesnt exist until we create 1 or more instances of it. Well that is what happening when you create a character or object "prototype" in gamesalad and then drag and drop it into your scene or scenes in game salad, you're making instances of your original blue print, good job programmer.

ending notes:
Almost anything is possible when you have the power to create something from nothing but thinking like a programmer and understanding how your personal slave the computer is working for you will help you master design as you orchestrate your symphony of game play. Try not to jump right into making a serious game without at least a few minutes creating a roadmap for yourself. Can you get there without a roadmap? yeah but you might get lost a long the way...be efficient and think like a programmer. On another note if you do not program and ever think about starting object orientated programming, then being able to relate to GameSalad as you learn will help you learn faster when you need a visual in your head of what someone is teaching you about programming example: what is a class and a instance of a object? oh yeah i create classes when i make a gamesalad character but i don't make a instance of him until i bring him into the scene...I'm not controlling the blue print i just control the clone of him in the scene, this object orientated programming isn't so hard.

This was fun to write and i hope someone out there got something out of this...have fun/make games!

Comments

Sign In or Register to comment.