Originally posted by another user
Ok, so I originally WAS going to do this as a video series, but then I thought about it, and decided on a blog-based series.
If I get enough feedback, I will continue . Lets begin..
Background Information:
I have beeen recently corrected in the fact that mostly ALL COD games use the QUAKE game engine.
In a game there are 2 parts. The content and the engine. The engine can be thought up as the frame of a car. It the foundation and it is what makes it “work”. The content are the seats and internals. They are what you can interact and have fun with.
You can have just the engine, and no content to play, or have the content but nothing to run it. In call of duty, the content files are in a format called FastFiles, or ff files (file extension). They are compressed with zlib compression. They hold game models, audio, game settings, video, challenges and stuff, and picture/textures.
The game developers update the game by providing a patch_mp.ff file. Since this fastfile is on HDD and not disk, we can modify it and create “mods”. The game also has a order in how it searches for content. If it is in the patch, it takes priority over that file to the one(s) on disc. You can rename the files to something else and it will do the same.
COD is also know for horrible debugging. It gives almost no information to a scripting error..
The Basics:
Thing back to algebra, were you solved for X. Now put those teachings to this as it is similar.
A variable contains a value, its that simple. Noe for the more complex thing is what type of value?
The following are data types, also know as value types:
Integer which is a number
String which is text
Boolean with is simply true or false
Float which is a decimal like .12345
An array, which is a slightly harder thing to explain and we will soon cover it.
test = 2;
That sets a integer value of 2 to the variable “test”. The semi-colon means the end of a line.
test = “hello”;
This sets “test” to the string (text) “hello”.
test = true;
This sets “test” to the boolean value of true.
test = false;
This sets “test” to the boolean value of false.
Now about arrays. Arrays are a set of data. They are like a group of variables in a way.
Arrays use what are called “keys” and “values”. You use a key to access a value. Arrays are also like matrices. Array keys can be strings or integers.
arraya = [];
Sets the variable “arraya” to an array.
arraya["key1"] = “hello”;
That creates an array element with a key of “key1″ and a value of “hello”.
arraya[0] = “hello”;
That creates an array element with a key of 0 and a value of “hello”.
In arrays, when looping or iterating though them, the key always starts at 0. Now I know you thinking, “wait! hold up, I what about array keys being strings?”. Well that IS true, but you can also access using a integer key based on the position of the array element in the group, as well as the key you used yourself. This will be mostly used in for loops and getting the size of an array (how many elements it has)..
Here is a example array set:
b= [];
b["a"] = 1;
b[2] = true;
b["pcfreak"] = “is cool”;
This can be shown in a diagram view:
b
“a” = 1
2 = true
“pcfreak” = “is cool”
You can do multi-dimensional arrays to. Thats simple nesting arrays, or one array inside another.
a= [];
a[0] = [];
a["hi"] = “test”;
To access the value test, you would do=
varc =a[0]["hi"];
That returns the element with the key of “hi” which is under the key of 0 as well to the variable “varc”. The key of 0 also has a value of an array..
A diagram could be shown as:
a
0
Well that about covers this tutorial. If you liked. it, please comment. If I get enough feedback I shall continue. If you have any questions about this tutorial, do ask away.
Have fun coding ..