Holistic Mobile Game Development with Unity 2015 Taylor & Francis. All rights Reserved.
Introduction Use computational and visual methods to explore the patterns and dynamics at the core of computer game code Develop a mastery of the processes, data structures, and algorithms found in all processes that form the foundation of programming 2015 Taylor & Francis. All rights Reserved. 2
Programming versus Scripting Programming languages Machine code: binary, strings, instruction set ○ eg. Cortex-A9 CPU implements Thumb-2 Assembly language: symbolic representation, assembler ○ eg. Thumb-2: MOV 2015 Taylor & Francis. All rights Reserved. 3
Programming versus Scripting Programming languages Compiled language: intuitive, English- like, translated by a compiler Interpreter language: scripting languages ○ eg. JavaScript, Lua, 2015 Taylor & Francis. All rights Reserved. 4
Scripting Literacy Anatomy of C# namespace myCeeSharpNamespace { class holisticUnityCeeSharp { public static void Main(string[] args) { System.Console.WriteLine(“Hey!”); 2015 Taylor & Francis. All rights Reserved. 5
Scripting 2015 Taylor & Francis. All rights Reserved. 6 Logic Logic Statements: Boolean algebra AND, OR... NOT, NAND, NOR, XOR, XNOR Truth tables Comments // This is a single line comment. /* This is a multi-line comment. */
Scripting 2015 Taylor & Francis. All rights Reserved. 7 Variables Modified block of computer memory used to store a value Data types
Scripting Literacy Operators Arithmetic ○ =, +, -, *, / Relational ○ >, =, <=, ==, 2015 Taylor & Francis. All rights Reserved. 8 Functions Blocks of code performing specialized operations Libraries
Scripting Literacy Loops Conditional statements Multiple executions for 2015 Taylor & Francis. All rights Reserved. 9 Conditional Statements Use Boolean algebra Divert flow if else
Scripting 2015 Taylor & Francis. All rights Reserved. 10 Arrays String together same datatypes One dimensional Multi-dimensional Store multiple data or objects
Scripting Literacy Classes and 2015 Taylor & Francis. All rights Reserved. 11
Scripting Literacy Classes and Objects Constructors ○ Main function call and allocates memory Properties/Variables ○ float xPos = myPosition.x; Functions/Methods ○ 2015 Taylor & Francis. All rights Reserved. 12
Scripting Literacy Yields and Coroutines Freeze? Pause the execution of the code and not effect the game 2015 Taylor & Francis. All rights Reserved. 13
Scripting Literacy C# versus JavaScript Primary differences ○ How the variables are declared ○ How the functions are 2015 Taylor & Francis. All rights Reserved. 14 JavaScript C#
Scripting Literacy Logical Errors and Syntactical Errors Common Coding Errors 1. No semicolon at the end of a 2015 Taylor & Francis. All rights Reserved. 15
Scripting Literacy 2. A missing matching parenthesis 3. A line break inside a string Debug.Log(“Hi There“) ; Or: Debug.Log (“Hi” Taylor & Francis. All rights Reserved. 16
Scripting Literacy 4. The wrong casing Debug or debug ○ error CS0103: The name ‘debug’ does not exist in the current context 5. The wrong 2015 Taylor & Francis. All rights Reserved. 17
Scripting Literacy 6. The use of a reserved word for a variable or class name 7. The filename doesn’t match the class 2015 Taylor & Francis. All rights Reserved. 18
Scripting Literacy 8. A float has been initialized without an “f” on the end 9. The wrong type of value is being assigned to a variable 10. The variables being passed to a function are not the correct 2015 Taylor & Francis. All rights Reserved. 19
Game Mathematics Literacy Points x, y and z axes 2015 Taylor & Francis. All rights Reserved. 20
Game Mathematics Literacy Vectors ○ Direction and 2015 Taylor & Francis. All rights Reserved. 21
Game Mathematics Literacy Angles Normalizing Dot product ○ Forward and backward Cross product ○ Turning 2015 Taylor & Francis. All rights Reserved. 22
Game Mathematics Literacy Affine Transformations Constant proportions Combination of: ○ translations (moving) ○ scalings (resizing) ○ rotations (orienting) ○ 2015 Taylor & Francis. All rights Reserved. 23
Procedural Content Generation Fractals Algorithmically generated patterns Strange 2015 Taylor & Francis. All rights Reserved. 24
Procedural Content Generation Perlin Noise Randomness generated from sine and cosine waves Height 2015 Taylor & Francis. All rights Reserved. 25
Summary Procedural Literacy C# scripting and an examination of fundamental programming constructs Essential mathematics for 3D game programming The power of algorithms and mathematics in the Minecraft landscape recreation Exploring the boundary between visual beauty and logical constructions Introduction to why and how these fundamentals are implemented over and over again Why you need this knowledge to be a games 2015 Taylor & Francis. All rights Reserved. 26