Holistic Mobile Game Development with Unity Procedural Literacy
Holistic Mobile Game Development with Unity Procedural Literacy @ 2015 Taylor & Francis. All rights Reserved. 1
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 languages � @ 2015 Taylor & Francis. All rights Reserved. 2
Programming versus Scripting � Programming languages �Machine code: binary, strings, instruction set ○ eg. Cortex-A 9 CPU implements Thumb-2 �Assembly language: symbolic representation, assembler ○ eg. Thumb-2: MOV R 0, #15 @ 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. Java. Script, Lua, C# @ 2015 Taylor & Francis. All rights Reserved. 4
Scripting Literacy � Anatomy of C# namespace my. Cee. Sharp. Namespace { class holistic. Unity. Cee. Sharp { public static void Main(string[] args) { System. Console. Write. Line(“Hey!”); } } } @ 2015 Taylor & Francis. All rights Reserved. 5
Scripting Literacy � Logic Statements: Boolean algebra � AND, OR. . . � NOT, NAND, NOR, XNOR � Truth tables � Comments � // This is a single line comment. � /* This is a multi-line comment. */ @ 2015 Taylor & Francis. All rights Reserved. 6
Scripting Literacy � Variables � Modified block of computer memory used to store a value � Data types @ 2015 Taylor & Francis. All rights Reserved. 7
Scripting Literacy � Functions � Blocks of code performing specialized operations � Libraries @ 2015 Taylor & Francis. All rights Reserved. � Operators � Arithmetic ○ =, +, -, *, / � Relational ○ >, <, >=, <=, ==, != 8
Scripting Literacy � Conditional Statements � � Use Boolean algebra � Divert flow � if else @ 2015 Taylor & Francis. All rights Reserved. Loops � Conditional statements � Multiple executions � for loop 9
Scripting Literacy � Arrays � String together same datatypes � One dimensional � Multi-dimensional � Store multiple data or objects @ 2015 Taylor & Francis. All rights Reserved. 10
Scripting Literacy � Classes and Objects @ 2015 Taylor & Francis. All rights Reserved. 11
Scripting Literacy � Classes and Objects � Constructors ○ Main function call and allocates memory � Properties/Variables ○ float x. Pos = my. Position. x; � Functions/Methods ○ my. Position. Set(5. 7, 1. 2, 3. 0); @ 2015 Taylor & Francis. All rights Reserved. 12
Scripting Literacy � Yields and Coroutines � Freeze? � Pause the execution of the code and not effect the game loop @ 2015 Taylor & Francis. All rights Reserved. 13
Scripting Literacy � C# versus Java. Script � Primary differences ○ ○ How the variables are declared How the functions are defined C# Java. Script @ 2015 Taylor & Francis. All rights Reserved. 14
Scripting Literacy Logical Errors and Syntactical Errors � Common Coding Errors 1. No semicolon at the end of a statement � @ 2015 Taylor & Francis. All rights Reserved. 15
Scripting Literacy A missing matching parenthesis 3. A line break inside a string 2. Debug. Log(“Hi There“); Or: Debug. Log (“Hi” + “There”); @ 2015 Taylor & Francis. All rights Reserved. 16
Scripting Literacy The wrong casing 4. • Debug or debug ○ error CS 0103: The name ‘debug’ does not exist in the current context 5. The wrong spelling @ 2015 Taylor & Francis. All rights Reserved. 17
Scripting Literacy The use of a reserved word for a variable or class name 7. The filename doesn’t match the class name 6. @ 2015 Taylor & Francis. All rights Reserved. 18
Scripting Literacy 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 datatype 8. @ 2015 Taylor & Francis. All rights Reserved. 19
Game Mathematics Literacy � Points � x, y and z axes � planes @ 2015 Taylor & Francis. All rights Reserved. 20
Game Mathematics Literacy � Vectors ○ Direction and length @ 2015 Taylor & Francis. All rights Reserved. 21
Game Mathematics Literacy � Angles � Normalizing � Dot product ○ Forward and backward � Cross product ○ Turning direction @ 2015 Taylor & Francis. All rights Reserved. 22
Game Mathematics Literacy � Affine Transformations � Constant proportions �Combination of: ○ translations (moving) ○ scalings (resizing) ○ rotations (orienting) ○ skew @ 2015 Taylor & Francis. All rights Reserved. 23
Procedural Content Generation � Fractals �Algorithmically generated patterns �Strange attractor @ 2015 Taylor & Francis. All rights Reserved. 24
Procedural Content Generation � Perlin Noise �Randomness generated from sine and cosine waves �Height map @ 2015 Taylor & Francis. All rights Reserved. 25
Procedural Literacy Summary C# scripting and an examination of fundamental programming constructs � Essential mathematics for 3 D 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 developer � @ 2015 Taylor & Francis. All rights Reserved. 26
- Slides: 26