+ Typed Message [Vlissides, 1998]

Size: px
Start display at page:

Download "+ Typed Message [Vlissides, 1998]"

Transcription

1 Background literature Introduction to Game Programming Autumn Game Programming Patterns and Techniques Juha Vihavainen University of Helsinki E. Gamma et al. (1994), Design Patterns: Elements of Reusable Object-Oriented Oriented Software. Addison Wesley. The original source on design patterns. Robert Nystrom (2014), Game Programming Patterns. Genever Benning. "A A book for programming in general, not just for games " Eric Freeman (2004), Head First Design Patterns: A Brain- Friendly Guide.. O'Reilly Media. Judith Bishop (2007), C# # 3.0 Design Patterns. O Reilly Media. "An introduction to the classic object-oriented oriented design patterns, and how to use C# to code them" Juha Vihavainen / University of Helsinki 2 Source of Design Patterns In software projects, we have concrete problems, e.g.:.: how to provide access to the elements of an aggregate without revealing any knowledge about an implementation how to represent a shared global resource as an object a way to provide for the undoing of actions how to provide a unified interface to a set of services Design patterns are solutions to such common problems (1) the name of the pattern, (2) the problem and its context (circumstances, forces) (3) the solution,, usually as a set of collaborating objects (4) the consequences (pros and cons) of using the pattern Plus: sample code, implementation tips, related patterns, actual systems ("at least two"), etc Juha Vihavainen / University of Helsinki 3 Classic Design Patterns [Gamma et al, 1994] + Typed Message [Vlissides, 1998]

2 Design patterns vs. idioms vs. frameworks (1) Idioms - describe techniques for expressing low-level, level, mostly language-dependent ideas (e.g., reference counts in C++) (2) Design patterns - medium-scale, mostly language-independent abstractions (solution "ideas") usually depend on object-oriented oriented mechanisms essential features can often be described with a simple UML class diagram (3) Software frameworks - consist of actual code with variant parts, into which the user can plug-in specific code to provide the required structure and behavior for example, GUI libraries in object-oriented oriented languages (with their Hollywood principle: : use callbacks) The original uses a pointer variable to store the singleton object As one alternative solution, can use C++ static local variables class Singleton { Singleton (in C++) public: static Singleton& instance (); // reference... ;... In C#, can use // implementation file: a static class Singleton& Singleton::instance () { static Singleton instance; // created at first call return instance; // and destructed after main Returns a reference: harder to destroy accidentally Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 6 Goals of software development (Nystrom, 2014) We want a nice and clean architecture so the code is easier to understand over the lifetime of the project changes/updates and consequences should be local We want fast run-time performance We want to get today s features done quickly These goals are at least partially in opposition There is no one right answer, just different flavors of wrong (i.e., many conflicting trade-offs) Use simplicity as a major decisive objective often less code means easier to understand and maintain not necessarily easy to achieve Juha Vihavainen / University of Helsinki 7 Game programming patterns by (Nystrom, 2014) I. Introduction On architecture, performance, and games II. Design Patterns revisited for game programming Command: : a request as an object, to queue, or support undo Flyweight: : share common data with similar objects Observer: : list of observers are notified of changes Prototype: : cloned to produce new objects Singleton: : only one single instance, and a way to access it State: : an object alters its behavior by delegating requests to an object that represents its current state Juha Vihavainen / University of Helsinki 8

3 Sequencing and behavioral game patterns III. Sequencing Patterns Double Buffer (used by GPU for its frame buffer) Game Loop (any game/engine for timing of tasks) Update Method (any game/engine for scheduling updates) IV. Behavioral Patterns Bytecode: : code as data, and scripting for flexible behaviour Subclass Sandbox: : define behavior in a subclass using a special set of protected operations provided by its base class Type Object: an object stores a reference to a type object that describes its inherent (and usually invariant) shared characteristics (data and behaviour) Juha Vihavainen / University of Helsinki 9 Decoupling and optimization game patterns V. Decoupling Patterns Component: : a game entity is a container of components, each one defined by its own component class (e.g., in Unity) Event Queue: decouple when an event is send and processed Service Locator: provide a global point of access to a service (without binding to a specific implementation class or way of access) VI. Optimization Patterns Data Locality: : prefer contiguous memory blocks (for cache) Dirty Flag: defer work until new data are really needed Object Pool: : reuse objects from a pool of (ready-made) instances Spatial Partition: : store objects in a data structure organized by their positions; used for spatial queries, collision detection, and view frustum culling Juha Vihavainen / University of Helsinki 10 Game Loop design pattern (revisited) The main objective is to decouple the progression of game time both from user input and processor speed A game processes user input but doesn t wait for it while (true true) process input; update; render; Frame limiting eliminates the effect of a too-fast CPU speed Separate real time vs. game time to easily scale timing of physics & game logic Physics simulation need more frequent updates and fixed-time delays to achieve accuracy and avoid numerical instabilities need to run physics on its own, faster update loop When updates start lagging behind, use (limited) frame dropping Juha Vihavainen / University of Helsinki 11 Game Loop var phystimesum := 0.0, lasttime := 0.0, dropcount := 0; while game is running do sketch, only //... poll input and receive/deliver any messages... var time := Game.Time; // the wall-clock time var realdeltatime := time - lasttime; lasttime := time; phystimesum += realdeltatime; // accumulate the physics time while phystimesum >= Game.PhysDeltaTime do // play catch up physics steps PhysicsUpdate (Game.PhysDeltaTime * Game.TimeFactor); // fixed delta (?) phystimesum -= Game.PhysDeltaTime; // physics step time decrement for var obj : Updateable in Game.UpdateableObjects do // logic updates obj.update (realdeltatime * Game.TimeFactor); // generate output but only if have time left - or need to force one frame if realdeltatime < Game.TargetDelay or dropcount++ = DropLimit then Render (phystimesum/game.physdeltatime ); // interpolate the last update dropcount = 0; // reset draw-priority if realdeltatime < Game.TargetDelay then // frame limiting Game.Sleep (Game.TargetDelay - realdeltatime);

4 Update design pattern The game world maintains a collection of independent objects, and these objects or systems "run" logically simultaneously objects behaviours need to be simulated over time and are mostly independent Each object implements an update method that simulates one frame of the object s behavior, and each frame, the game updates every object in the collection Splitting code into single-frame slices often makes it more complex For each frame, we need to store states to resume where left off Be careful of modifying shared data (e.g., the game object list) while processing and updating on it A variable time step means that each update () call needs to know the elapsed time, so often it is passed in as an argument - or can access a global clock Using contiguous layout for Data Locality Some relevant game data Cache-friendly contiguous memory block Pointer chasing : traversing links in a graph-like structure may cause losts of cache misses Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 14 More on Unity scripting Refresh: Unity game objects, components, variables Unity scripting is creating MonoBehaviour subclasses A selection of Unity game programming idioms how to access other game objects and components? prefabs in Unity (a version of the Prototype design pattern) Unity coroutine facility Miscellaneous C# / Unity topics Juha Vihavainen / University of Helsinki 15 Physics materials a force slowing the movement of an object E.g., a rigid body controls a game object's position via physics simulation: will react to gravity ("falls down"), and can strike and bounce off other objects (or at least "staying above the floor") Note that custom game-specific variables and behaviour are defined via scripts and are also attached to game objects as components Juha Vihavainen / University of Helsinki 16

5 Summary on Unity scripts A Unity game is programmed with scripts Unity scripting system is based on Mono,, an open-source version of.net ( ~ VM) Unity supports C# and UnityScript C# is well documented, is the kind of standard language for.net and Mono, and widely used UnityScript is a Unity dialect of Javascript, compiled into.net bytecode and native code Scripts are derived from MonoBehaviour,, a direct subclass of Behaviour ( => Component => Object = Unity's base class) Scripts are assets (and so put into the Project View), and must be attached to game objects as components (a script defines a class) Many scripts are provided as standard assets Juha Vihavainen / University of Helsinki 17 Some script-component component call-backs/events The Update () function runs every frame to implement logic/behavior The FixedUpdate () function runs as determined by the physics system, independently of frame rate (and more frequently); use for any physics calculations of your own The LateUpdate () function is called after all Update methods (e.g., actions for a 3rd-person camera are done last, after all other updates) The Awake () function is called when the script instance is being loaded; can use e.g. for "internal initialization" " of a component The Start () function is called just before any of the Update methods is called for the first time; e.g., "establish connections and relationships" The OnMouseDown () function is called when the user has pressed the mouse button while over the GUIElement or Collider The OnGUI () function is called for rendering & handling GUI events (called multiple times per a frame to handle GUI events) Juha Vihavainen / University of Helsinki 18 Most important Unity classes MonoBehaviour: : any kind of interactions or control over game objects and their components Transform represents the position, rotation and scale in space (whether 3D or 2D) plus the scene hierarchy; provides helper functions to move, scale, rotate, to organize and manipulate children, as well as converting coordinates from one space to another Rigidbody / Rigidbody2D The physics engine provides the tools for moving objects around, detecting triggers and collisions, and applying forces; to manage velocity, mass, drag, force, torque, collision, etc Juha Vihavainen / University of Helsinki 19 On physics General physics parameters settable in the editor via the Physics Manager (Edit->Project Settings->Physics) The y gravity value is 9.8 meters / second ^ 2 (one unit = 1 meter) Moving colliders need rigidbodies even if not affected by physics If an object is moved by animation or code, set as a kinematic rigidbody Physic materials determine surface properties, e.g, bouncing effects and friction (can use standard assets or create you own) OnMouseEnter,, raycasts, etc. work on colliders For further background and details, see Unity and NVIDIA PhysX documentation Juha Vihavainen / University of Helsinki 20

6 Common Unity script idioms Accessing the game state of game objects, stored as parts of scripts! GetComponent < ScriptId > ().variable = value; // the same object GetComponent < ScriptId > ().method (); // the same object other.getcomponent < ScriptId >().variable = v; // another object target = anobject.getcomponent < ScriptId >; // cache the target pl = GameObject.FindWithTag ("Player").GetComponent<ScriptId> (); Scripting things to happen in the future: Note. Names s of game objects are not necessarily unique. Invoke ("Method", 2.0f); // call in 2 secs InvokeRepeating ("Heal", 2.0f, 2.0f); // call every 2 secs void Start () { Destroy (gameobject, 5.0f); // will live only 5 secs For alternative solutions could use Unity coroutines Juha Vihavainen / University of Helsinki 21 Unity prefabs (prefabrications) Prototype design pattern (Gamma et al., 1994): specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype Pros/cons? In Unity: A prefab ("ready-made object") is an object first created in the scene and then stored in the project, to be instantiated in Editor or at runtime a prefab is a reusable prototype game object to create a prefab, we drag a game object from the game hierarchy view into the project view can be inserted multiple times into scenes; the instances (clones) are (at least initially) linked back to the original prefab so, making changes to the prototype causes changes to all its instances (unless the binding has been explicitly broken) Juha Vihavainen / University of Helsinki 22 Manipulating prefabs To create a new prefab (for a Project), drag a game object in the scene view into the Project view (pane or onto some empty prefab) the game object (and all its children and relevant data) are copied into the prefab object (by Unity) the original game object can now be removed (usually) can appropriately rename the new prefab in the project view Drag prefab to a variable to be instantiated at run time E.g., in Shooter script, a prefab is stored in a variable bullet To create and place prefab instance in the current scene, drag the prefab from the project view into the scene (or, alternatively, into the hierarchy view) In unity, sometimes refer to an object by the type of one of its scripts; likewise, may refer to a game object by its Transform/RigidBody component Juha Vihavainen / University of Helsinki Juha Vihavainen / University of Helsinki 24

7 Instantiating prefabs at run time Of course, we could create and carefully build all needed game objects from scratch using normal script code (factory methods) Prefabs are prebuilt game objects & their components that are as such reusable throughout the game (and for other games, too) In the Unity Editor: define a variable (say, bullet) ) in a script to contain a prefab drag the prefab from the project view onto that variable in the inspector In scripts, we can instantiate the prefab with one line of code: (prototypeobject, position, rotation) Instantiate (bullet, Vector3 (x, y, 0), Quaternion.identity); clones the original, places it at the given position, sets its rotation, and then returns the new instance Juha Vihavainen / University of Helsinki 25 Background on C# iterators and coroutines (1) The Iterator design pattern: var iterator = datasource.getenumerator (); while (iterator.movenext ()) process iterator.current; provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation (2) Coroutines are essentially like non-preemptive threads a coroutine must explicitly give over the execution turn later, the execution is continued at that same precise point & state C# provides a built-in in coroutine facility for its iterator abstraction the iteration over all elements can be written as one single routine = algorithm that yields the values one-by-one:.. while (more values) ) { value := produce next; ; yield return value; ;.. yield return may appear anywhere in the code. May have multiple yield return statements in a method Juha Vihavainen / University of Helsinki 26 Iterators in C# Here s a simple example: Producer public class MyCollection : IEnumerable { int [] data = { 1, 2, 3 ; Consumer for more technical details, see: /IteratorBlockImplementation.aspx The actual iterator object A collection that has an iterator public IEnumerator GetEnumerator () { // a Factory method foreach (var i in data) // iteration spec. that yield return i; // generates special // CIL code Notice the "black magic": GetEnumerator doesn t seem to return an enumerator at all! Upon parsing the yield return statement, the compiler generates a (hidden nested state-driven) enumerator class, and modifies GetEnumerator to return an instance of that class. foreach (var i in new MyCollection ()) Console.WriteLine (i); // means: :... while (it.movenext ()) {... it.current; Juha Vihavainen / University of Helsinki 27 Example: scripting a sequence of heavy tasks Consider the following C# script, with multi-frame actions using UnityEngine; using System.Collections; public class Example : MonoBehaviour int state = 0; // the current state of computation void Update () // called by the game loop if (state == 0) // or can use a switch do some calculations; ; state = 1; return; // resume others if (state == 1) do more calculations; ; state = 2; return; Juha Vihavainen / University of Helsinki 28

8 Multi-frame sequence as a Unity coroutine We may implement the preceding with Unity coroutines using UnityEngine; using System.Collections; public class Example : MonoBehaviour { public int state = 0; IEnumerator MyCoroutine () { while (true) do some calculations; ;... yield return null; // pause until next frame do more calculations; ;... yield return null; // pause until next frame Juha Vihavainen / University of Helsinki 29 Unity's coroutines (1/2) Update () is executed each frame (unless the object is inactive or the script is disabled) Unity uses the C#'s iterator/coroutine facility to implement multi- frame-spanning coroutines for game objects (for their scripts) Can have different actions happening at different intervals May improve performance by executing logic as a coroutine less often than each frame, say only every five seconds Note that it is a call coroutine private void Start () { StartCoroutine (Calculation ()); IEnumerator Calculation () { A subclass of YieldInstruction, while (true) { anything else is mostly ignored... run game logic; yield return new WaitForSeconds (5.0f); Unity calls MoveNext and inspects Current, and performs WaitForSeconds,, i.e., doesn't call MoveNext until time has elapsed, etc Juha Vihavainen / University of Helsinki 30 Unity's coroutines (2/2) We can do long computations (AI decisions, path calculations) over several frames with coroutines A call, again void Awake () { StartCoroutine (Calculate ()); IEnumerator Calculate () { create initial setup for computations; while (not finished) ) { Note. The yield break statement ends coroutine (e.g., inside the loop). do some calculations; // do here a partial task at a time yield return null; // 0 or null: skip to the next frame The suspended Debug.Log ("Coroutine is completed"); coroutine is again enabled = false; // disable this script called by Unity, in the next frame. Note.. Coroutines are executed only after all the Update functions Juha Vihavainen / University of Helsinki 31 "State machines" via coroutines technique void Start () { StartCoroutine (Init ());); // start state IEnumerator Init () { Debug.Log ("Initializing"); yield return new WaitForSeconds (3.0f);... Debug.Log ("Initialization completed"); StartCoroutine (Running ()); // goto next state... IEnumerator Running () { Debug.Log ("Running"); yield return new WaitForSeconds (5.0f);... Debug.Log ("Running completed"); StartCoroutine (GameOver ()); //... etc Juha Vihavainen / University of Helsinki 32

Introduction to Game Programming Autumn Game Programming Patterns and Techniques

Introduction to Game Programming Autumn Game Programming Patterns and Techniques Introduction to Game Programming Autumn 2017 02. Game Programming Patterns and Techniques Juha Vihavainen University of Helsinki Background literature Erich Gamma et al. (1994), Design Patterns: Elements

More information

Terrain. Unity s Terrain editor islands topographical landscapes Mountains And more

Terrain. Unity s Terrain editor islands topographical landscapes Mountains And more Terrain Unity s Terrain editor islands topographical landscapes Mountains And more 12. Create a new Scene terrain and save it 13. GameObject > 3D Object > Terrain Textures Textures should be in the following

More information

UFO. Prof Alexiei Dingli

UFO. Prof Alexiei Dingli UFO Prof Alexiei Dingli Setting the background Import all the Assets Drag and Drop the background Center it from the Inspector Change size of Main Camera to 1.6 Position the Ship Place the Barn Add a

More information

CE318/CE818: High-level Games Development

CE318/CE818: High-level Games Development CE318/CE818: High-level Games Development Lecture 1: Introduction. C# & Unity3D Basics Diego Perez Liebana dperez@essex.ac.uk Office 3A.527 2017/18 Outline 1 Course Overview 2 Introduction to C# 3 Scripting

More information

Pacman. you want to see how the maze was created, open the file named unity_pacman_create_maze.

Pacman. you want to see how the maze was created, open the file named unity_pacman_create_maze. Pacman Note: I have started this exercise for you so you do not have to make all of the box colliders. If you want to see how the maze was created, open the file named unity_pacman_create_maze. Adding

More information

Introduction to Unity. What is Unity? Games Made with Unity /666 Computer Game Programming Fall 2013 Evan Shimizu

Introduction to Unity. What is Unity? Games Made with Unity /666 Computer Game Programming Fall 2013 Evan Shimizu Introduction to Unity 15-466/666 Computer Game Programming Fall 2013 Evan Shimizu What is Unity? Game Engine and Editor With nice extra features: physics engine, animation engine, custom shaders, etc.

More information

Terrain. Unity s Terrain editor islands topographical landscapes Mountains And more

Terrain. Unity s Terrain editor islands topographical landscapes Mountains And more Terrain Unity s Terrain editor islands topographical landscapes Mountains And more 12. Create a new Scene terrain and save it 13. GameObject > 3D Object > Terrain Textures Textures should be in the following

More information

CS342: Software Design. November 21, 2017

CS342: Software Design. November 21, 2017 CS342: Software Design November 21, 2017 Runnable interface: create threading object Thread is a flow of control within a program Thread vs. process All execution in Java is associated with a Thread object.

More information

Topics in Object-Oriented Design Patterns

Topics in Object-Oriented Design Patterns Software design Topics in Object-Oriented Design Patterns Material mainly from the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides; slides originally by Spiros Mancoridis;

More information

Game Design Unity Workshop

Game Design Unity Workshop Game Design Unity Workshop Activity 2 Goals: - Creation of small world - Creation of character - Scripting of player movement and camera following Load up unity Build Object: Mini World and basic Chase

More information

Game Design From Concepts To Implementation

Game Design From Concepts To Implementation Game Design From Concepts To Implementation Giacomo Cappellini - g.cappellini@mixelweb.it Why Unity - Scheme Unity Editor + Scripting API (C#)! Unity API (C/C++)! Unity Core! Drivers / O.S. API! O.S.!

More information

Table of contents. Introduction. Having finally realized your ambitious plans for a game, you might face big performance

Table of contents. Introduction. Having finally realized your ambitious plans for a game, you might face big performance Table of contents Introduction Introduction... 1 Optimizing Unity games... 2 Rendering performance...2 Script performance...3 Physics performance...3 What is this all about?...4 How does M2HCullingManual

More information

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns EPL 603 TOPICS IN SOFTWARE ENGINEERING Lab 6: Design Patterns Links to Design Pattern Material 1 http://www.oodesign.com/ http://www.vincehuston.org/dp/patterns_quiz.html Types of Design Patterns 2 Creational

More information

Unity Scripting 4. CS 491 / DES 400 Crea.ve Coding. Computer Science

Unity Scripting 4. CS 491 / DES 400 Crea.ve Coding. Computer Science Unity Scripting 4 Unity Components overview Particle components Interaction Key and Button input Parenting CAVE2 Interaction Wand / Wanda VR Input Devices Project Organization Prefabs Instantiate Unity

More information

MIXED REALITY (AR & VR) WITH UNITY 3D (Microsoft HoloLens)

MIXED REALITY (AR & VR) WITH UNITY 3D (Microsoft HoloLens) MIXED REALITY (AR & VR) WITH UNITY 3D (Microsoft HoloLens) 1. INTRODUCTION TO Mixed Reality (AR & VR) What is Virtual Reality (VR) What is Augmented reality(ar) What is Mixed Reality Modern VR/AR experiences

More information

UNITY WORKSHOP. Unity Editor. Programming(Unity Script)

UNITY WORKSHOP. Unity Editor. Programming(Unity Script) July, 2018 Hayashi UNITY WORKSHOP Unity Editor Project: Name your project. A folder is created with the same name of the project. Everything is in the folder. Four windows (Scene, Project, Hierarchy, Inspector),

More information

Unity Game Development

Unity Game Development Unity Game Development 1. Introduction to Unity Getting to Know the Unity Editor The Project Dialog The Unity Interface The Project View The Hierarchy View The Inspector View The Scene View The Game View

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Unity

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Unity i About the Tutorial Unity is a cross-platform game engine initially released by Unity Technologies, in 2005. The focus of Unity lies in the development of both 2D and 3D games and interactive content.

More information

Easy Decal Version Easy Decal. Operation Manual. &u - Assets

Easy Decal Version Easy Decal. Operation Manual. &u - Assets Easy Decal Operation Manual 1 All information provided in this document is subject to change without notice and does not represent a commitment on the part of &U ASSETS. The software described by this

More information

Cláudia Ribeiro PHYSICS

Cláudia Ribeiro PHYSICS Cláudia Ribeiro PHYSICS Cláudia Ribeiro Goals: - Colliders - Rigidbodies - AddForce and AddTorque Cláudia Ribeiro AVT 2012 Colliders Colliders components define the shape of an object for the purpose of

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecturer: Raman Ramsin Lecture 20: GoF Design Patterns Creational 1 Software Patterns Software Patterns support reuse of software architecture and design. Patterns capture the static

More information

Spell Casting Motion Pack 5/5/2017

Spell Casting Motion Pack 5/5/2017 The Spell Casting Motion pack requires the following: Motion Controller v2.49 or higher Mixamo s free Pro Magic Pack (using Y Bot) Importing and running without these assets will generate errors! Overview

More information

NOTTORUS. Getting Started V1.00

NOTTORUS. Getting Started V1.00 NOTTORUS Getting Started V1.00 2016 1. Introduction Nottorus Script Editor is a visual plugin for generating and debugging C# Unity scripts. This plugin allows designers, artists or programmers without

More information

Adding a Trigger to a Unity Animation Method #2

Adding a Trigger to a Unity Animation Method #2 Adding a Trigger to a Unity Animation Method #2 Unity Version: 5.0 Adding the GameObjects In this example we will create two animation states for a single object in Unity with the Animation panel. Our

More information

if(input.getkey(keycode.rightarrow)) { this.transform.rotate(vector3.forward * 1);

if(input.getkey(keycode.rightarrow)) { this.transform.rotate(vector3.forward * 1); 1 Super Rubber Ball Step 1. Download and open the SuperRubberBall project from the website. Open the main scene. In it you will find a game track and a sphere as shown in Figure 1.1. The sphere has a Rigidbody

More information

Google SketchUp/Unity Tutorial Basics

Google SketchUp/Unity Tutorial Basics Software used: Google SketchUp Unity Visual Studio Google SketchUp/Unity Tutorial Basics 1) In Google SketchUp, select and delete the man to create a blank scene. 2) Select the Lines tool and draw a square

More information

Pong in Unity a basic Intro

Pong in Unity a basic Intro This tutorial recreates the classic game Pong, for those unfamiliar with the game, shame on you what have you been doing, living under a rock?! Go google it. Go on. For those that now know the game, this

More information

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich CSCD01 Engineering Large Software Systems Design Patterns Joe Bettridge Winter 2018 With thanks to Anya Tafliovich Design Patterns Design patterns take the problems consistently found in software, and

More information

Tutorial Physics: Unity Car

Tutorial Physics: Unity Car Tutorial Physics: Unity Car This activity will show you how to create a free-driving car game using Unity from scratch. You will learn how to import models using FBX file and set texture. You will learn

More information

IAT 445 Lab 10. Special Topics in Unity. Lanz Singbeil

IAT 445 Lab 10. Special Topics in Unity. Lanz Singbeil IAT 445 Lab 10 Special Topics in Unity Special Topics in Unity We ll be briefly going over the following concepts. They are covered in more detail in your Watkins textbook: Setting up Fog Effects and a

More information

This allows you to choose convex or mesh colliders for you assets. Convex Collider true = Convex Collider. Convex Collider False = Mesh Collider.

This allows you to choose convex or mesh colliders for you assets. Convex Collider true = Convex Collider. Convex Collider False = Mesh Collider. AGF Asset Packager v. 0.4 (c) Axis Game Factory LLC Last Updated: 6/04/2014, By Matt McDonald. Compiled with: Unity 4.3.4. Download This tool may not work with Unity 4.5.0f6 ADDED: Convex Collider Toggle:

More information

the gamedesigninitiative at cornell university Lecture 12 Architecture Design

the gamedesigninitiative at cornell university Lecture 12 Architecture Design Lecture 12 Take Away for Today What should lead programmer do? How do CRC cards aid software design? What goes on each card? How do you lay m out? What properties should y have? How do activity diagrams

More information

Better UI Makes ugui Better!

Better UI Makes ugui Better! Better UI Makes ugui Better! 2016 Thera Bytes UG Developed by Salomon Zwecker TABLE OF CONTENTS Better UI... 1 Better UI Elements... 4 1 Workflow: Make Better... 4 2 UI and Layout Elements Overview...

More information

Pong. Prof Alexiei Dingli

Pong. Prof Alexiei Dingli Pong Prof Alexiei Dingli Background Drag and Drop a background image Size 1024 x 576 X = 0, Y = 0 Rename it to BG Sorting objects Go to Sorting Layer Add a new Sorting Layer called Background Drag the

More information

Tutorial: Using the UUCS Crowd Simulation Plug-in for Unity

Tutorial: Using the UUCS Crowd Simulation Plug-in for Unity Tutorial: Using the UUCS Crowd Simulation Plug-in for Unity Introduction Version 1.1 - November 15, 2017 Authors: Dionysi Alexandridis, Simon Dirks, Wouter van Toll In this assignment, you will use the

More information

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern Think of drawing/diagramming editors ECE450 Software Engineering II Drawing/diagramming editors let users build complex diagrams out of simple components The user can group components to form larger components......which

More information

The Strategy Pattern Design Principle: Design Principle: Design Principle:

The Strategy Pattern Design Principle: Design Principle: Design Principle: Strategy Pattern The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Design

More information

Designing the Framework of a Parallel Game Engine

Designing the Framework of a Parallel Game Engine Designing the Framework of a Parallel Game Engine How to Optimize Your Game Engine for Intel Multi-Core CPUs By Jeff Andrews White Paper Visual Computing Multi-Threading Abstract Summary With the advent

More information

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS LOGISTICS HW3 due today HW4 due in two weeks 2 IN CLASS EXERCISE What's a software design problem you've solved from an idea you learned from someone else?

More information

Game Design Unity Workshop

Game Design Unity Workshop Game Design Unity Workshop Activity 1 Unity Overview Unity is a game engine with the ability to create 3d and 2d environments. Unity s prime focus is to allow for the quick creation of a game from freelance

More information

Game Design Unity Workshop

Game Design Unity Workshop Game Design Unity Workshop Activity 4 Goals: - Creation of small world - Creation of character - Scripting of player movement and camera following Load up unity Build Object: Collisions in Unity Aim: Build

More information

MIXED REALITY (AR & VR) WITH UNITY 3D (Microsoft HoloLens)

MIXED REALITY (AR & VR) WITH UNITY 3D (Microsoft HoloLens) MIXED REALITY (AR & VR) WITH UNITY 3D (Microsoft HoloLens) 1. INTRODUCTION TO Mixed Reality (AR & VR) What is Virtual Reality (VR) What is Augmented reality(ar) What is Mixed Reality Modern VR/AR experiences

More information

An Introduction to Patterns

An Introduction to Patterns An Introduction to Patterns Robert B. France Colorado State University Robert B. France 1 What is a Pattern? - 1 Work on software development patterns stemmed from work on patterns from building architecture

More information

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D. Software Design Patterns Jonathan I. Maletic, Ph.D. Department of Computer Science Kent State University J. Maletic 1 Background 1 Search for recurring successful designs emergent designs from practice

More information

INTERNAL ASSESSMENT TEST III Answer Schema

INTERNAL ASSESSMENT TEST III Answer Schema INTERNAL ASSESSMENT TEST III Answer Schema Subject& Code: Object-Oriented Modeling and Design (15CS551) Sem: V ISE (A & B) Q. No. Questions Marks 1. a. Ans Explain the steps or iterations involved in object

More information

User Manual. Contact the team: Contact support:

User Manual.     Contact the team: Contact support: User Manual http://dreamteck.io https://www.facebook.com/dreamteckstudio Contact the team: team@dreamteck.io Contact support: support@dreamteck.io Discord Server: https://discord.gg/bkydq8v 1 Contents

More information

ANIMATOR TIMELINE EDITOR FOR UNITY

ANIMATOR TIMELINE EDITOR FOR UNITY ANIMATOR Thanks for purchasing! This document contains a how-to guide and general information to help you get the most out of this product. Look here first for answers and to get started. What s New? v1.53

More information

Section 28: 2D Gaming: Continuing with Unity 2D

Section 28: 2D Gaming: Continuing with Unity 2D Section 28: 2D Gaming: Continuing with Unity 2D 1. Open > Assets > Scenes > Game 2. Configuring the Layer Collision Matrix 1. Edit > Project Settings > Tags and Layers 2. Create two new layers: 1. User

More information

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Design Patterns. SE3A04 Tutorial. Jason Jaskolka SE3A04 Tutorial Jason Jaskolka Department of Computing and Software Faculty of Engineering McMaster University Hamilton, Ontario, Canada jaskolj@mcmaster.ca November 18/19, 2014 Jason Jaskolka 1 / 35 1

More information

Design Patterns Design patterns advantages:

Design Patterns Design patterns advantages: Design Patterns Designing object-oriented software is hard, and designing reusable object oriented software is even harder. You must find pertinent objects factor them into classes at the right granularity

More information

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool Design Patterns What are Design Patterns? What are Design Patterns? Why Patterns? Canonical Cataloging Other Design Patterns Books: Freeman, Eric and Elisabeth Freeman with Kathy Sierra and Bert Bates.

More information

About the FBX Exporter package

About the FBX Exporter package About the FBX Exporter package Version : 1.3.0f1 The FBX Exporter package provides round-trip workflows between Unity and 3D modeling software. Use this workflow to send geometry, Lights, Cameras, and

More information

Game Architecture Revisited

Game Architecture Revisited Lecture 8 Game Architecture Revisited Recall: The Game Loop 60 times/s = 16.7 ms Update Draw Receive player input Process player actions Process NPC actions Interactions (e.g. physics) Cull non-visible

More information

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester Design Patterns Comp2110 Software Design Department of Computer Science Australian National University Second Semester 2005 1 Design Pattern Space Creational patterns Deal with initializing and configuring

More information

Mechanic Animations. Mecanim is Unity's animation state machine system.

Mechanic Animations. Mecanim is Unity's animation state machine system. Mechanic Animations Mecanim is Unity's animation state machine system. It essentially allows you to create 'states' that play animations and define transition logic. Create new project Animation demo.

More information

Unity Tutorial. Fall /15-666

Unity Tutorial. Fall /15-666 Unity Tutorial Fall 2014 15-466/15-666 Game World model, video, audio, interaction Often like Model-View-Controller Art, mechanics, levels, items, etc. Game Engine World model, video, audio, interaction

More information

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently. Gang of Four Software Design Patterns with examples STRUCTURAL 1) Adapter Convert the interface of a class into another interface clients expect. It lets the classes work together that couldn't otherwise

More information

C# in Unity 101. Objects perform operations when receiving a request/message from a client

C# in Unity 101. Objects perform operations when receiving a request/message from a client C# in Unity 101 OOP What is OOP? Objects perform operations when receiving a request/message from a client Requests are the ONLY* way to get an object to execute an operation or change the object s internal

More information

Java s Implementation of Concurrency, and how to use it in our applications.

Java s Implementation of Concurrency, and how to use it in our applications. Java s Implementation of Concurrency, and how to use it in our applications. 1 An application running on a single CPU often appears to perform many tasks at the same time. For example, a streaming audio/video

More information

the gamedesigninitiative at cornell university Lecture 13 Architecture Design

the gamedesigninitiative at cornell university Lecture 13 Architecture Design Lecture 13 Take Away for Today What should lead programmer do? How do CRC cards aid software design? What goes on each card? How do you lay m out? What properties should y have? How do activity diagrams

More information

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) Design Pattern CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) A. Design Pattern Design patterns represent the best practices used by experienced

More information

Runtime Worlds and Active Grids. By Kyle Gillen (Last Updated 11/4/15)

Runtime Worlds and Active Grids. By Kyle Gillen (Last Updated 11/4/15) Runtime Worlds and Active Grids By Kyle Gillen (Last Updated 11/4/15) Runtime vs Inspector Components Inspector Worlds and Active Grids are fully realized as components on active game objects in your scene,

More information

Unity3D. Unity3D is a powerful cross-platform 3D engine and a user friendly development environment.

Unity3D. Unity3D is a powerful cross-platform 3D engine and a user friendly development environment. Unity3D Unity3D is a powerful cross-platform 3D engine and a user friendly development environment. If you didn t like OpenGL, hopefully you ll like this. Remember the Rotating Earth? Look how it s done

More information

Demo Scene Quick Start

Demo Scene Quick Start Demo Scene Quick Start 1. Import the Easy Input package into a new project. 2. Open the Sample scene. Assets\ootii\EasyInput\Demos\Scenes\Sample 3. Select the Input Source GameObject and press Reset Input

More information

PROTOTYPE 1: APPLE PICKER FOR UNITY 5.X

PROTOTYPE 1: APPLE PICKER FOR UNITY 5.X CHAPTER 28 PROTOTYPE 1: APPLE PICKER FOR UNITY 5.X In the pages below, I've replaced the sections of Chapter 28 that used GUIText with new pages that take advantage of the UGUI (Unity Graphical User Interface)

More information

Unity Software (Shanghai) Co. Ltd.

Unity Software (Shanghai) Co. Ltd. Unity Software (Shanghai) Co. Ltd. Main Topics Unity Runtime System Architecture Workflow How to consider optimization Graphics Physics Memory Usage Scripting Where to compare to other engine Unity Editor

More information

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns Software Engineering ITCS 3155 Fall 2008 Dr. Jamie Payton Department of Computer Science University of North Carolina at Charlotte

More information

Object Oriented Paradigm

Object Oriented Paradigm Object Oriented Paradigm Ming-Hwa Wang, Ph.D. Department of Computer Engineering Santa Clara University Object Oriented Paradigm/Programming (OOP) similar to Lego, which kids build new toys from assembling

More information

Workshop BOND UNIVERSITY. Bachelor of Interactive Multimedia and Design. Asteroids

Workshop BOND UNIVERSITY. Bachelor of Interactive Multimedia and Design. Asteroids Workshop BOND UNIVERSITY Bachelor of Interactive Multimedia and Design Asteroids FACULTY OF SOCIETY AND DESIGN Building an Asteroid Dodging Game Penny de Byl Faculty of Society and Design Bond University

More information

The Motion Controller uses the Actor Controller to actually move the character. So, please review the Actor Controller Guide as well!

The Motion Controller uses the Actor Controller to actually move the character. So, please review the Actor Controller Guide as well! The Motion Controller uses the Actor Controller to actually move the character. So, please review the Actor Controller Guide as well! Input Source Camera Movement Rotations Motion Controller Note: MC is

More information

Software Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software

Software Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software Software Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software Chapter 9 Introduction to Design Patterns Copy Rights Virtual University of Pakistan 1 Design

More information

C# for UNITY3d: Sem 1 a.k.a. The Gospel of Mark Part 1

C# for UNITY3d: Sem 1 a.k.a. The Gospel of Mark Part 1 C# for UNITY3d: Sem 1 a.k.a. The Gospel of Mark Part 1 Special Thanks to Mark Hoey, whose lectures this booklet is based on Move and Rotate an Object (using Transform.Translate & Transform.Rotate)...1

More information

Design Patterns. (and anti-patterns)

Design Patterns. (and anti-patterns) Design Patterns (and anti-patterns) Design Patterns The Gang of Four defined the most common object-oriented patterns used in software. These are only the named ones Lots more variations exist Design Patterns

More information

DESIGN PATTERN - INTERVIEW QUESTIONS

DESIGN PATTERN - INTERVIEW QUESTIONS DESIGN PATTERN - INTERVIEW QUESTIONS http://www.tutorialspoint.com/design_pattern/design_pattern_interview_questions.htm Copyright tutorialspoint.com Dear readers, these Design Pattern Interview Questions

More information

Design Patterns. An introduction

Design Patterns. An introduction Design Patterns An introduction Introduction Designing object-oriented software is hard, and designing reusable object-oriented software is even harder. Your design should be specific to the problem at

More information

Applied object oriented programming. 4 th lecture

Applied object oriented programming. 4 th lecture Applied object oriented programming 4 th lecture Today Constructors in depth Class inheritance Interfaces Standard.NET interfaces IComparable IComparer IEquatable IEnumerable ICloneable (and cloning) Kahoot

More information

Design Patterns Reid Holmes

Design Patterns Reid Holmes Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book Design Patterns Reid Holmes GoF design patterns $ %!!!! $ "! # & Pattern vocabulary Shared vocabulary

More information

CMSC 425 Programming Assignment 1, Part 2 Implementation Notes

CMSC 425 Programming Assignment 1, Part 2 Implementation Notes CMSC 425 Programming Assignment 1, Part 2 Implementation Notes Disclaimer We provide these notes to help in the design of your project. There is no requirement that you use our settings, and in fact your

More information

Better UI Makes ugui Better!

Better UI Makes ugui Better! Better UI Makes ugui Better! version 1.1.2 2017 Thera Bytes UG Developed by Salomon Zwecker TABLE OF CONTENTS Better UI... 1 Better UI Elements... 4 1 Workflow: Make Better... 4 2 UI and Layout Elements

More information

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich CSCD01 Engineering Large Software Systems Design Patterns Joe Bettridge Winter 2018 With thanks to Anya Tafliovich Design Patterns Design patterns take the problems consistently found in software, and

More information

PERFORMANCE. Rene Damm Kim Steen Riber COPYRIGHT UNITY TECHNOLOGIES

PERFORMANCE. Rene Damm Kim Steen Riber COPYRIGHT UNITY TECHNOLOGIES PERFORMANCE Rene Damm Kim Steen Riber WHO WE ARE René Damm Core engine developer @ Unity Kim Steen Riber Core engine lead developer @ Unity OPTIMIZING YOUR GAME FPS CPU (Gamecode, Physics, Skinning, Particles,

More information

CE318: Games Console Programming

CE318: Games Console Programming CE318: Games Console Programming Lecture 1: Introduction. C# & Unity3D Basics Diego Perez dperez@essex.ac.uk Office 3A.526 2014/15 Outline 1 Course Overview 2 Introduction to C# 3 Scripting in C# for Unity3D

More information

Bonus Chapter 10: Working with External Resource Files and Devices

Bonus Chapter 10: Working with External Resource Files and Devices 1 Bonus Chapter 10: Working with External Resource Files and Devices In this chapter, we will cover the following topics: Loading external resource files using Unity default resources Loading external

More information

An Introduction to Object Orientation

An Introduction to Object Orientation An Introduction to Object Orientation Rushikesh K Joshi Indian Institute of Technology Bombay rkj@cse.iitb.ac.in A talk given at Islampur Abstractions in Programming Control Abstractions Functions, function

More information

Goals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming

Goals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming Goals of Lecture Lecture 27: OO Design Patterns Cover OO Design Patterns Background Examples Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2001 April 24, 2001 Kenneth

More information

Merging Physical and Virtual:

Merging Physical and Virtual: Merging Physical and Virtual: A Workshop about connecting Unity with Arduino v1.0 R. Yagiz Mungan yagiz@purdue.edu Purdue University - AD41700 Variable Topics in ETB: Computer Games Fall 2013 September

More information

Design Patterns Reid Holmes

Design Patterns Reid Holmes Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book Design Patterns Reid Holmes GoF design patterns $ %!!!! $ "! # & Pattern vocabulary Shared vocabulary

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

CSE 401/M501 Compilers

CSE 401/M501 Compilers CSE 401/M501 Compilers ASTs, Modularity, and the Visitor Pattern Hal Perkins Autumn 2018 UW CSE 401/M501 Autumn 2018 H-1 Agenda Today: AST operations: modularity and encapsulation Visitor pattern: basic

More information

Table of Contents. Questions or problems?

Table of Contents. Questions or problems? 1 Introduction Overview Setting Up Occluders Shadows and Occlusion LODs Creating LODs LOD Selection Optimization Basics Controlling the Hierarchy MultiThreading Multiple Active Culling Cameras Umbra Comparison

More information

is.centraldispatch Documentation

is.centraldispatch Documentation SPINACH is.centraldispatch Documentation July 27, 2016 Last Edit : July 27, 2016 Page I! of XII! IS.CENTRALDISPATCH DOCUMENTATION Getting Start Write Your First Multi-Threaded Script Using SPINACH.iSCentralDispatch

More information

Java Threads. COMP 585 Noteset #2 1

Java Threads. COMP 585 Noteset #2 1 Java Threads The topic of threads overlaps the boundary between software development and operation systems. Words like process, task, and thread may mean different things depending on the author and the

More information

Introduction to Unreal Engine Blueprints for Beginners. By Chaven R Yenketswamy

Introduction to Unreal Engine Blueprints for Beginners. By Chaven R Yenketswamy Introduction to Unreal Engine Blueprints for Beginners By Chaven R Yenketswamy Introduction My first two tutorials covered creating and painting 3D objects for inclusion in your Unreal Project. In this

More information

IAP Manager. Easy IAP Workflow. Copyright all rights reserved. Digicrafts 2018 Document version Support

IAP Manager. Easy IAP Workflow. Copyright all rights reserved. Digicrafts 2018 Document version Support IAP Manager Easy IAP Workflow Copyright all rights reserved. Digicrafts 2018 Document version 1.7.0 Support email: support@digicrafts.com.hk A. Before Start In order to use the IAPManager, the following

More information

Using Design Patterns in Java Application Development

Using Design Patterns in Java Application Development Using Design Patterns in Java Application Development ExxonMobil Research & Engineering Co. Clinton, New Jersey Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S.

More information

Previously, on Lesson Night... From Intermediate Programming, Part 1

Previously, on Lesson Night... From Intermediate Programming, Part 1 Previously, on Lesson Night... From Intermediate Programming, Part 1 Struct A way to define a new variable type. Structs contains a list of member variables and functions, referenced by their name. public

More information

Flowmap Generator Reference

Flowmap Generator Reference Flowmap Generator Reference Table of Contents Flowmap Overview... 3 What is a flowmap?... 3 Using a flowmap in a shader... 4 Performance... 4 Creating flowmaps by hand... 4 Creating flowmaps using Flowmap

More information

Last Lecture. Lecture 17: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 4448/ Spring Semester, 2005

Last Lecture. Lecture 17: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 4448/ Spring Semester, 2005 1 Lecture 17: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 4448/6448 - Spring Semester, 2005 2 Last Lecture Design Patterns Background and Core Concepts Examples

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 2 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 2 System I/O System I/O (Chap 13) Central

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information