Engine Research
This is an extremely important choice for my Project and I will need to decide on either a 2D or a 3D video game to develop.
In green is my chosen selection for my game engine. I have chosen Unity 5 as it is written in C# a flexible programming language. It offers a standard engine layout with formatted and importing assets as well as built in exporting runnable executable applications. It also allows for 3D game builds and Networking for multiplayer gameplay. There are a couple of drawbacks to Unity which is a plug ins are required to build a level efficiently and C#/JavaScript can be complicated to learn for advanced functions.
C#
C# is a flexible, object orientated programming language that is supported in the Unity engine. It is a modern language meaning it is still used today and is fairly popular in terms of development on games specifically.
Syntax
The syntax in C# is similar to Java and C++ because it utilises Syntax such as:
-Semicolons (These are used to finish a line during a statement)
-Curly Brackets (The main syntax, used in order to group statements together and generally make methods work together)
-Variables (These are usually assigned with an equals sign but can have different effects if done with <, >, ==, or - and + signs)
-Square Brackets (Square brackets are used in order to declare arrays and to get a given index for one of the variables in an array)
I am beginning to look through tutorials in C# that will assist me in learning the language for the production of my final product.
In object orientated programming languages such as Java and C#, actions interact with one another through what is called a 'method'. Objects that are the same are usually within either the same class or the same type.
Methods and Objects
Following a tutorial from: http://www.tutorialspoint.com/csharp/csharp_basic_syntax.htm
I have learned that methods are usually contained within the class and this is similar to Unity's game engine.
A class from the tutorial page:
class Rectangle { // member variables double length; double width; public void Acceptdetails() { length = 4.5; width = 3.5; } public double GetArea() { return length * width; } public void Display() { Console.WriteLine("Length: {0}", length); Console.WriteLine("Width: {0}", width); Console.WriteLine("Area: {0}", GetArea()); } }
As shown from this tutorial, we can see that methods are contained within a single class and objects are stuctured within the method. Here we see the objects (length and width) are contained within a method using the aforementioned curly brackets. There are a total of 3 methods during this example, public void "Accepdetails()", public double GetArea(), public void Display(), and because these 3 methods have been declared, it then allows for objects to be placed inside the objects in this case are "length", "width", and the "Console.WriteLine's", these give the program something to go off in terms of what is being displayed, and because this is displaying the area of a rectangle through length and width it multiplies them in the "GetArea()" method then returns the multiplication as a value to: Console.WriteLine("Area: {0}", GetArea());.
Type conversion
Following a tutorial from: http://www.tutorialspoint.com/csharp/csharp_type_conversion.htm
I have learned that data conversion could be a possibility for my final major media product and it is usually contained within the class and this is very similar to Unity's game engine.
A class from the tutorial page:
using System; namespace TypeConversionApplication { class StringConversion { static void Main(string[] args) { int i = 75; float f = 53.005f; double d = 2345.7652; bool b = true; Console.WriteLine(i.ToString()); Console.WriteLine(f.ToString()); Console.WriteLine(d.ToString()); Console.WriteLine(b.ToString()); Console.ReadKey(); } } }
When the above code is compiled and executed, it produces the following result:
75 53.005 2345.7652 True
Data conversion in C# is a way of converting "types" into different data. There are a bunch of methods that are used in data conversion and can be found in this table.
| Sr.No | Methods & Description |
|---|---|
| 1 |
ToBoolean
Converts a type to a Boolean value, where possible.
|
| 2 |
ToByte
Converts a type to a byte.
|
| 3 |
ToChar
Converts a type to a single Unicode character, where possible.
|
| 4 |
ToDateTime
Converts a type (integer or string type) to date-time structures.
|
| 5 |
ToDecimal
Converts a floating point or integer type to a decimal type.
|
| 6 |
ToDouble
Converts a type to a double type.
|
| 7 |
ToInt16
Converts a type to a 16-bit integer.
|
| 8 |
ToInt32
Converts a type to a 32-bit integer.
|
| 9 |
ToInt64
Converts a type to a 64-bit integer.
|
| 10 |
ToSbyte
Converts a type to a signed byte type.
|
| 11 |
ToSingle
Converts a type to a small floating point number.
|
| 12 |
ToString
Converts a type to a string.
|
| 13 |
ToType
Converts a type to a specified type.
|
| 14 |
ToUInt16
Converts a type to an unsigned int type.
|
| 15 |
ToUInt32
Converts a type to an unsigned long type.
|
| 16 |
ToUInt64
Converts a type to an unsigned big integer.
|
The following shows the possibilities that type conversion can do within C#. In terms of relevence to my final product type conversion could be an important factor. As you can see in the code example above, in the class string conversion. the different types are all converted into strings which are essentially just text on the standard page. So the value "53.005f" on the "float f =" type is converted into "53.005" since it is converted into a string. The tutorial does mention that all of the types are actually value types. Another thing to note is that each of the letter's in the brackets during the types also appears in the Console.WriteLine this is because the type must be read to the client in order for it too display.
Variables
In C# variables are a given name to a storage area. Meaning they are fairly useless without delcaring and letting the compiler actually give them meaning to the program. In terms of defining variables the following code is needed:
<data_type> <variable_list>;
The <data_type> depends on what wants to be declared. For instance if you wanted to declare decimals, you would use the decimal value type. The next step to declaring a variable is the variable list this can be any letter for instance if I wanted to declare a variable within C# I would write, this declares both A as 1 and B as 2 and they are declared upon the time of definition. This means that on the same line that the variable is declared, it is then defined so in this case a has been defined on the same line it has been declared.
int a = 1, b = 2;
There are also 2 more definitions that can be stated within C# these are "Pi" and "letter variables". So for instance, a variable can be initialized and given a letter value so x is equal to "x". Whilst the double pi is a numeric approximate value for pi.
double pi = 3.14159; /* declares an approximation of pi. */ char x = 'x'; /* the variable x has the value 'x'. */
Types of Variables:
| Type | Example |
|---|---|
| Integral types | sbyte, byte, short, ushort, int, uint, long, ulong, and char |
| Floating point types | float and double |
| Decimal types | decimal |
| Boolean types | true or false values, as assigned |
| Nullable types | Nullable data types |
Constants
Constants are values in C# that are fixed and cannot be altered during execution, this includes execution of a program such as a game client. Constants are treated similar to variables in the C# and are essentially can be any one of the data types that are listed above, from integral types to floating point types or Boolean types the only difference is that after their definition they cannot be altered or even converted.
Character Constants
The character constants in C# are handled in a single expression for instance 'x'. There are also a list of constants that have a '\' in front which also have set meanings and are character constants meaning they can't be changed.
| Escape sequence | Meaning |
|---|---|
| \\ | \ character |
| \' | ' character |
| \" | " character |
| \? | ? character |
| \a | Alert or bell |
| \b | Backspace |
| \f | Form feed |
| \n | Newline |
| \r | Carriage return |
| \t | Horizontal tab |
| \v | Vertical tab |
| \ooo | Octal number of one to three digits |
| \xhh . . . | Hexadecimal number of one or more digits |
using System; namespace EscapeChar { class Program { static void Main(string[] args) { Console.WriteLine("Hello\tWorld\n\n"); Console.ReadLine(); } } }In this class we see a method that calls a for a string, then extends the Console.WriteLine method and reads "Hello [tab] world [newline] [newline]" due to the \t, and 2 \n character constants. This would be good for me too add instructions to my final major product. The project is a game, and in many games, text is often required for objectives or specific achievements and as such, I could include it in my First person shooter game, perhaps for a tutorial also and utilising character constants I could format this text.
Operators
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
- Assignment Operators
- Misc Operators
| Operator | Description | Example |
|---|---|---|
| + | Adds two operands | A + B = 30 |
| - | Subtracts second operand from the first | A - B = -10 |
| * | Multiplies both operands | A * B = 200 |
| / | Divides numerator by de-numerator | B / A = 2 |
| % | Modulus Operator and remainder of after an integer division | B % A = 0 |
| ++ | Increment operator increases integer value by one | A++ = 11 |
| -- | Decrement operator decreases integer value by one | A-- = 9 |
Here we can see basic mathematical functions such as division and multipication and the remainder of certain functions.
using System; class Program { static void Main(string[] args) { int a = 21; int b = 10; if (a == b) { Console.WriteLine("Line 1 - a is equal to b"); } else { Console.WriteLine("Line 1 - a is not equal to b"); } if (a < b) { Console.WriteLine("Line 2 - a is less than b"); } else { Console.WriteLine("Line 2 - a is not less than b"); } if (a > b) { Console.WriteLine("Line 3 - a is greater than b"); } else { Console.WriteLine("Line 3 - a is not greater than b"); } /* Lets change value of a and b */ a = 5; b = 20; if (a <= b) { Console.WriteLine("Line 4 - a is either less than or equal to b"); } if (b >= a) { Console.WriteLine("Line 5-b is either greater than or equal to b"); } } }
In this class, we can see that there are a number of operators used to define what is in the string. For instance, in the first 'if statement' it says that a is equal to b with the operator '=='. I could probably use this in Unity in order to say that if a player has 0 bullets in their clip, then the reload animation and script will play in order to restock ammo, of course there also needs to be a bunch of other variables such as if the player is still, but the basic principal of operators is still there. Operators are usually formatted in if statements and are contained within curly brackets.
When the above code is compiled and executed, it produces the following result:
Line 1 - a is not equal to b Line 2 - a is not less than b Line 3 - a is greater than b Line 4 - a is either less than or equal to b Line 5 - b is either greater than or equal to b
These are the results of the following if statements when they are compiler using the operators.
Logical Operators
In Logical Operators there are 3 symbols used in order to determine different things. The '&&' Logical operator' essentially means AND in C#. This could be in the format of if (a && b) and so long that 'a' or 'b' are not zero (in this class they aren't) then the condition becomes true. This would be used in my project in order to set 2 variables up for a specific action.
The next logical operator is '||' and means that if 'a' or 'b' are different then the condition will still become true. This is used much like the '&&' operator however might be used in some situations in which '&&' would compile with errors or I may need to change too '||' due to an in-game bug with the first person shooter project.
The final logical operator is used in if statements and can also be used in conjunction with other operators as shown by the if statement: if (!(a && b)) the operator '!' means that if something is NOT something else, then it will send true statements as false. It is basically used to reverse how a statement turns out with no compiler errors.
using System;
namespace OperatorsAppl
{
class Program
{
static void Main(string[] args)
{
bool a = true;
bool b = true;
if (a && b)
{
Console.WriteLine("Line 1 - Condition is true");
}
if (a || b)
{
Console.WriteLine("Line 2 - Condition is true");
}
/* lets change the value of a and b */
a = false;
b = true;
if (a && b)
{
Console.WriteLine("Line 3 - Condition is true");
}
else
{
Console.WriteLine("Line 3 - Condition is not true");
}
if (!(a && b))
{
Console.WriteLine("Line 4 - Condition is true");
}
Console.ReadLine();
}
}
}
In Logical Operators there are 3 symbols used in order to determine different things. The '&&' Logical operator' essentially means AND in C#. This could be in the format of if (a && b) and so long that 'a' or 'b' are not zero (in this class they aren't) then the condition becomes true. This would be used in my project in order to set 2 variables up for a specific action.
The next logical operator is '||' and means that if 'a' or 'b' are different then the condition will still become true. This is used much like the '&&' operator however might be used in some situations in which '&&' would compile with errors or I may need to change too '||' due to an in-game bug with the first person shooter project.
The final logical operator is used in if statements and can also be used in conjunction with other operators as shown by the if statement: if (!(a && b)) the operator '!' means that if something is NOT something else, then it will send true statements as false. It is basically used to reverse how a statement turns out with no compiler errors.
using System; namespace OperatorsAppl { class Program { static void Main(string[] args) { bool a = true; bool b = true; if (a && b) { Console.WriteLine("Line 1 - Condition is true"); } if (a || b) { Console.WriteLine("Line 2 - Condition is true"); } /* lets change the value of a and b */ a = false; b = true; if (a && b) { Console.WriteLine("Line 3 - Condition is true"); } else { Console.WriteLine("Line 3 - Condition is not true"); } if (!(a && b)) { Console.WriteLine("Line 4 - Condition is true"); } Console.ReadLine(); } } }
Assignment Operators
The following class shows the following operators used in if statements.
The main reason these operators will be used is when any of the the other operators I have mentioned will also want to assign the value of the right side to the left side. For example, in the second statement, c += a; would mean that c is c + a so if we gave 'c' the value of 1 and 'a' the value of 2 then the c += a; would return '3' as a final outcome because c = c+a would be the assignment.
Miscellaneous Operators
The following class shows the following operators used in if statements.
| Operator | Description | Example |
|---|---|---|
| = | Simple assignment operator, Assigns values from right side operands to left side operand | C = A + B assigns value of A + B into C |
| += | Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand | C += A is equivalent to C = C + A |
| -= | Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand | C -= A is equivalent to C = C - A |
| *= | Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand | C *= A is equivalent to C = C * A |
| /= | Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand | C /= A is equivalent to C = C / A |
| %= | Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand | C %= A is equivalent to C = C % A |
| <<= | Left shift AND assignment operator | C <<= 2 is same as C = C << 2 |
| >>= | Right shift AND assignment operator | C >>= 2 is same as C = C >> 2 |
| &= | Bitwise AND assignment operator | C &= 2 is same as C = C & 2 |
| ^= | bitwise exclusive OR and assignment operator | C ^= 2 is same as C = C ^ 2 |
| |= | bitwise inclusive OR and assignment operator | C |= 2 is same as C = C | 2 |
using System; namespace OperatorsAppl { class Program { static void Main(string[] args) { int a = 21; int c; c = a; Console.WriteLine("Line 1 - = Value of c = {0}", c); c += a; Console.WriteLine("Line 2 - += Value of c = {0}", c); c -= a; Console.WriteLine("Line 3 - -= Value of c = {0}", c); c *= a; Console.WriteLine("Line 4 - *= Value of c = {0}", c); c /= a; Console.WriteLine("Line 5 - /= Value of c = {0}", c); c = 200; c %= a; Console.WriteLine("Line 6 - %= Value of c = {0}", c); c <<= 2; Console.WriteLine("Line 7 - <<= Value of c = {0}", c); c >>= 2; Console.WriteLine("Line 8 - >>= Value of c = {0}", c); c &= 2; Console.WriteLine("Line 9 - &= Value of c = {0}", c); c ^= 2; Console.WriteLine("Line 10 - ^= Value of c = {0}", c); c |= 2; Console.WriteLine("Line 11 - |= Value of c = {0}", c); Console.ReadLine(); } } }
Miscellaneous Operators
The final operators are ones that are not necessarily symbols but are still quite important. "sizeof()" returns the size of a data type. "typeof()" returns what type of class an operator is. '&' sends the address of a variable to the compiler so '&a' would return the address of the variable. '*a' creates a pointer to the variable called 'a'. '?' is essentially a conditional expression it says that a variable is either this or this. The 'is' operator determines whether an object is a certain type for instance, if(ford is car) then it will check that the ford object is in the "Car" class. Finally, 'as' essentially sends a condition without raising an exception.
| Operator | Description | Example |
|---|---|---|
| sizeof() | Returns the size of a data type. | sizeof(int), returns 4. |
| typeof() | Returns the type of a class. | typeof(StreamReader); |
| & | Returns the address of an variable. | &a; returns actual address of the variable. |
| * | Pointer to a variable. | *a; creates pointer named 'a' to a variable. |
| ? : | Conditional Expression | If Condition is true ? Then value X : Otherwise value Y |
| is | Determines whether an object is of a certain type. | If( Ford is Car) // checks if Ford is an object of the Car class. |
| as | Cast without raising an exception if the cast fails. | Object obj = new StringReader("Hello");
StringReader r = obj as StringReader;
|
using System; namespace OperatorsAppl { class Program { static void Main(string[] args) { /* example of sizeof operator */ Console.WriteLine("The size of int is {0}", sizeof(int)); Console.WriteLine("The size of short is {0}", sizeof(short)); Console.WriteLine("The size of double is {0}", sizeof(double)); /* example of ternary operator */ int a, b; a = 10; b = (a == 1) ? 20 : 30; Console.WriteLine("Value of b is {0}", b); b = (a == 10) ? 20 : 30; Console.WriteLine("Value of b is {0}", b); Console.ReadLine(); } } }
Decision Making
Decision making is the way a programmer allows a decision to be returned to the program. This can include decisions being made through statements returning true or false.| Statement | Description |
|---|---|
| An if statement consists of a boolean expression followed by one or more statements. | |
| An if statement can be followed by an optional else statement, which executes when the boolean expression is false. | |
| You can use one if or else if statement inside another if or else if statement(s). | |
| A switch statement allows a variable to be tested for equality against a list of values. | |
| You can use one switch statement inside anotherswitch statement(s). |
If statements consists of a Boolean which is followed by one or more statements that are contained within curly brackets. This would be useful when I need to define how much ammo is left when needed to reload so it would be something like, if the ammo is equal to 0, then the reload script would play. If/else statements are if statements which are followed by an additional else statement, this means that even if the Boolean answer is false it would still run through a command to the program.
Nested if statements are essentially if statements which are followed by another if or if/else statement. This means that a condition can be true and then true again, or true and then false, then false in general and not usually but can be false and false again as well, this could be useful when using unity but I will more than likely not need this unless I want to be really specific in what I want to declare to the program.
A switch expression is a way of allowing a certain variable to be tested against a list of requirements that other variables in the code. Below is an example of optional case's that are compared to the default.
using System; namespace DecisionMaking { class Program { static void Main(string[] args) { /* local variable definition */ char grade = 'B'; switch (grade) { case 'A': Console.WriteLine("Excellent!"); break; case 'B': case 'C': Console.WriteLine("Well done"); break; case 'D': Console.WriteLine("You passed"); break; case 'F': Console.WriteLine("Better try again"); break; default: Console.WriteLine("Invalid grade"); break; } Console.WriteLine("Your grade is {0}", grade); Console.ReadLine(); } } }
Method
I have researched methods which are a fairly important part of C# and will definitely help when it comes to programming my fist person shooter. In order to use a method, it must first be defined and then called. When you define you declare what the method is about, you do this within the following format.
<Access Specifier> <Return Type> <Method Name>(Parameter List) { Method Body }
The website shows us what each of these parts to the methods actually mean:
- 'Access Specifier: This determines the visibility of a variable or a method from another class.
- Return type: A method may return a value. The return type is the data type of the value the method returns. If the method is not returning any values, then the return type is void.
- Method name: Method name is a unique identifier and it is case sensitive. It cannot be same as any other identifier declared in the class.
- Parameter list: Enclosed between parentheses, the parameters are used to pass and receive data from a method. The parameter list refers to the type, order, and number of the parameters of a method. Parameters are optional; that is, a method may contain no parameters.
- Method body: This contains the set of instructions needed to complete the required activity.'
The different parts of the method have now been defined but in order to call them, in the next example FindMax this method has been defined but now has been called. It belongs within the NumberManipulator class and calls upon the CalculatorApplication and the System package.
using System; namespace CalculatorApplication { class NumberManipulator { public int FindMax(int num1, int num2) { /* local variable declaration */ int result; if (num1 > num2) result = num1; else result = num2; return result; } static void Main(string[] args) { /* local variable definition */ int a = 100; int b = 200; int ret; NumberManipulator n = new NumberManipulator(); //calling the FindMax method ret = n.FindMax(a, b); Console.WriteLine("Max value is : {0}", ret ); Console.ReadLine(); } } }
Gaming Research
Portal 2
This is gameplay of the popular online puzzle game portal 2. Whilst it is primarily a puzzle platformer it can be considered a first person shooter for it's portal gun and aiming mechanics. I like the idea of having difficult movement involved but I don't think I will focus on this for my Final Product.
CounterStrike
This is gameplay of the popular online puzzle game portal 2. Whilst it is primarily a puzzle platformer it can be considered a first person shooter for it's portal gun and aiming mechanics. I like the idea of having difficult movement involved but I don't think I will focus on this for my Final Product.
CounterStrike

Battlefield
Borderlands
Brink
Call of Duty
Gears of War
Halo
The games I have chosen are mainly first person shooters to draw my inspiration from. This is because they all have similarities in their UI however there are quite a lot of differences, for instance Halo's concept on weapons is more of a collected inventory system where players kill AI for weapons during the campaign (or players online) and can retrieve their weapon and their are also weapons around the map however the a player can only have 2 weapons at 1 time. In Call of Duty, a player spawns with a premade load-out OR a loud-out of their choice which is quite a good idea for a first person shooter game as It allows for customization, another unique feature is the customization kill streak system. In modern Warfare 2, players can select up to 3 kill streaks to take into a game with them. Counter Strike Global offensive uses currency to purchase weapons which is also a very nice system, it takes into consideration how powerful a weapon and sets a price depending upon it's stats (which are displayed). This also has a drawback though because if a round is lost you have less currency than the opposing team, also, currency is gained upon kills and the harder a weapon is to get a kill with the more currency is gained for instance, the knife gives over $1000 whilst the AWP (a 1 shot sniper rifle) only gives $100 per kill. All of these games have allowed me to generate ideas on what 3D game I would like to create and It is something similar to a Halo/Call of duty mash up in the sense that weapons can be picked up.
Film Research
Black Hawk Down
Full Metal Jacket
We were soldiers
I thought the concept of these 3 films were quite interesting and I believe the background and synopsis to a lot of them are really well presented. In black hawk down, a mission turns bad after the planes are shot down and the soldiers must survive on the streets of a rural city filled with terrorists. This too me is quite an interesting idea for a game but this may cause a lot of problems as I would need to model everything from the players and weapons to the City and equipment. I like the idea of the harsh training from full metal jacket, it gives me the idea that tutorial's are most of the time easy and I could perhaps have not just an easy tutorial but a hard one as well, this may be for timed challenges.
Image Sources:











