holistic mobile game development with unity 1 @ 2015 taylor & francis. all rights reserved

26
Procedural Literacy Holistic Mobile Game Development with Unity 1 @ 2015 Taylor & Francis. All rights Reserved.

Upload: archibald-page

Post on 14-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Procedural LiteracyHolistic Mobile Game Development with Unity

1@ 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 languages

@ 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 R0,#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. JavaScript, Lua, C#

@ 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 Literacy

@ 2015 Taylor & Francis. All rights Reserved. 6

LogicLogic Statements: Boolean algebraAND, OR ...NOT, NAND, NOR, XOR, XNORTruth tables

Comments// This is a single line comment. /* This is a multi-line

comment. */

Scripting Literacy

@ 2015 Taylor & Francis. All rights Reserved. 7

VariablesModified block of computer memory used

to store a valueData types

Scripting Literacy Operators

Arithmetic○ =, +, -, *, /

Relational○ >, <, >=, <=, ==, !=

@ 2015 Taylor & Francis. All rights Reserved. 8

FunctionsBlocks of code

performing specialized operations

Libraries

Scripting Literacy Loops

Conditional statements

Multiple executionsfor loop

@ 2015 Taylor & Francis. All rights Reserved. 9

Conditional StatementsUse Boolean algebraDivert flowif else

Scripting Literacy

@ 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 Objects

@ 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○ myPosition.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 JavaScript

Primary differences○ How the variables are declared○ How the functions are defined

@ 2015 Taylor & Francis. All rights Reserved. 14

JavaScriptC#

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

2. A missing matching parenthesis

3. A line break inside a stringDebug.Log(“Hi

There“);Or:Debug.Log (“Hi” +

“There”);

@ 2015 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 spelling

@ 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 name

@ 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 datatype

@ 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

NormalizingDot product

○ Forward and backward

Cross product○ Turning

direction

@ 2015 Taylor & Francis. All rights Reserved. 22

Game Mathematics Literacy Affine Transformations

Constant proportionsCombination of:

○ translations (moving)○ scalings (resizing)○ rotations (orienting)○ skew

@ 2015 Taylor & Francis. All rights Reserved. 23

Procedural Content Generation Fractals

Algorithmically generated patternsStrange 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

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 developer

@ 2015 Taylor & Francis. All rights Reserved. 26