# Gw Temp

## Article - 'Game Logic' by DrowZero

An item about Game Design posted on Aug 8, 2003

### Blurb

Here are some tips for some good game logic!

### Body

I have seen countless people try and fail at programing because of one simple fact. They can understand all of the functions and what they do, but they are so unorganized that they get lost a few weeks into making it and eventually lose interest in it. This can be applied to many things not just writing programs (although thats what im concentrating on here). They have no clue how to plan what they are trying to do and they have no clue where to begin. I am going to show you people various ways of planning out the logic for a program that you are trying to make, and if you people dont trash it too bad I might do some more tutorials with some tips on how to make your programing a lot easier.

Oh and it helps if you know what the functions do...this is just ways of planning how to use those functions. Im not concentrating on any specific language.

1. WRITE IT DOWN
- This is probably one of the easiest and most effective ways to plan. Just sit down with a pad of paper and start writing about what you are trying to accomplish and different ways to get there. One of the major things to learn about programing is that there are usually many different ways to accomplish one thing. Just sitting down and writing usually helps a lot.

2. Fake Code
- This is an interesting idea that was given to me by my programing professor when we first started the class. What you do is you write out the code in english (or whatever language you happen to speak) totally ignoring the syntax of the programing languge so that you can understand the way that it is really going to work. Here is an example of a simple number adding program.

Start
declare x as integer
declare y as integer
declare z as integer

print "Enter number for x"
get x
print "Enter number for y"
get y
z = x + y
print z
End

Ill admit that thats a pretty trivial problem but when you have a bigger problem and if-then statements with a few loops thrown in there just for good measure it can really help. (although I have yet to meet a person who threw loops in there just for the fun of it)

3. Flowcharts
-This is one method that I really dislike but some people swear by it. Flowcharts are just charts that show the flow of the program just like the fake code does except each command has a box and the boxes are linked together by arrows showing how it all flows (hence the name flowchart). I could do a whole seperate tutorial on flowcharts alone, and I might if anyone wants me to. It is very good, I think, for people just starting to program and are just beginning to see how a program comes together, so if you want me to go more indepth in that then just say so.

4. Heirarchy charts
-One of the most useful ideas out of all of them I would say. I am sure that a lot of you have seen charts with the members of a big business or something on them stedily decreasing in rank till you get to the average factory worker. This is basically the same thing. It starts with the big program and then stedily divides it up into all of the different modules and sections that make up the program. This is GREAT for people who are getting a team together to do a big project because you can all see exactly what needs to be done and just break it up into individual parts right there.

Ok well that was it. If you hated it then dont bug me with flames and death threats just tell me to shut up and I will go back to being one of those people who used to be moderatly active on this site and am now just on whenever the fancy strikes me. Oh and for all of you devout Rm2k users who are wondering why I am even bothering to write this because it has nothing to do with game making, before you get bend out of shape about it there are game makers, like game maker that allow you to put in your own code and execute it as part of the game. I mainly meant this for the person who wants to do cool stuff with it but has never even touched a programing language before. Well ill shut up for now and let you people get to commenting. cya

-DrowZero