All programs are written to do something, their purpose may be to perform a calculation or to run a computer game, but all programs will perform a task, also known as a process. All programs take the stricter of input, process to output. Th input includes user controls such as keyboard, mouse, game controller, voice and so on. It will also include data from the user, computer or other programs. Data Structures
Programs need to store data at some time during the execution of processes. Data is held in variables which are names containers for each piece of data. Each variable must be given a name so it can be referred to again and again throughout the program. It should be something that is recognisable because for example variable 1 would be soon forgotten in a substantial piece of code. Variable names cannot be the same as code words such as print or run. Algorithms
Every program is made up of sets of algorithms. These are the individual chunks of code which each carry out a process. When the algorithms are combined the whole game is formed. A common algorithm in games creation is a game loop. This is code which controls the actions that are carried out when there is no input from the user. Ordinary programs like a word processor will not do anything when there is no user input; they will just wait for the next command, but a game must keep running constantly, therefore a game loop runs constantly in the background of a game and is established when there is a pause in the input. This could just be to keep the environment active, such as a waterfall that keeps flowing; some involve the character making a reminder movement to the user. Control Structures
Programs, especially computer games, are usually not linear; they are not carried out sequentially but jump around the code as different parts are needed. It is not always possible to predict what the user will do, therefore good programming allows the user the freedom to do...