Introduction to Game Programming Autumn Game Programming Patterns and Techniques

Size: px
Start display at page:

Download "Introduction to Game Programming Autumn Game Programming Patterns and Techniques"

Transcription

1 Introduction to Game Programming Autumn Game Programming Patterns and Techniques Juha Vihavainen University of Helsinki Background literature Erich Gamma et al. (1994), Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley. The original source on design patterns. Vlissides John (1998), Pattern Hatching : Design Patterns Applied. Addison-Wesley. 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 design patterns, and how to use C# to code them Robert Nystrom (2014), Game Programming Patterns. Genever Benning. "A book for programming in general, not just for games" Juha Vihavainen / University of Helsinki 2

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 its organization (impl.) how to represent a shared global resource as an object a way to provide for theundoing 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, often as a set of collaborating objects (4) the consequences (pros and cons) of using the pattern Provides vocabulary: identify, understand, document, communicate 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]

3 Design patterns vs. idioms vs. frameworks (1) Idioms - describe techniques for expressing low-level, mostly language-dependent ideas (e.g., reference counts in C++) (2) Designpatterns - medium-scale, mostly language-independent abstractions (solution "ideas") usually depend on object-oriented mechanisms, and essential features can often be described with a simple UML class diagram (3) Software frameworks use patterns but consist of actual code with variant parts, into which the user can plug-in specific code to provide the required structure and behavior with their Hollywood principle: use callbacks for example, GUI libraries in object-oriented languages game engines, too Juha Vihavainen / University of Helsinki 5 The original uses a pointer variable to store the singleton object As a language-specific solution, use C++ static local variables class Singleton { public: static Singleton& instance ();... ;... // implementation file: Singleton& Singleton::instance () { // reference static Singleton instance; // created at first call of this routine return instance; Singleton (in C++) // and destructed after main Returns a reference: harder to destroy accidentally Need to disable constructors. In C#, can use a static class Juha Vihavainen / University of Helsinki 6

4 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 e.g., 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., often many conflicting trade-offs) Use simplicity as a major decisive objective often less code means easier to understand and maintain notnecessarilyeasyto achieve (at thefirsttry) Juha Vihavainen / University of Helsinki 7 Game programming patterns by (Nystrom, 2014) I. Introduction On architecture, performance, and games (see the previous slide) II. Design Patterns revisited for game programming Command: a request as an object, to queue or to support undo Flyweight: share common immutable data with similar objects Observer: list of observers to be notified of changes Prototype: an archetypical instance 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 (and which can be replaced) Juha Vihavainen / University of Helsinki 8

5 Sequencing and behavioral game patterns III. Sequencing Patterns More: Coroutine pattern (p. 143); Pipeline pattern/architecture Game Loop: any game/engine for sequencing & timing tasks) Update Method: any game/engine for requesting updates) DoubleBuffer: used by GPU for its frame buffer IV. Behavioral Patterns More: Pipeline pattern/architecture (p.281)? Customized metaobject Bytecode: code as data, and scripting for flexible behaviour SubclassSandbox: define behavior in a subclass using a special set of protected operations provided by its base class TypeObject: an object stores a reference to a type object that describes its inherent (and usually invariant) shared characteristics (data and behaviour) replaces ( static ) class Juha Vihavainen / University of Helsinki 9 Decoupling and optimization game patterns V. Decoupling Patterns More: Hierarchical Machine (layered / multitier architecture); Model-View; Typedmessage 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 (w/o binding to a specific implementation class, or way of access) VI. Optimization Patterns More: Pipeline pattern/architecture (p.281) Data Locality: prefer contiguous memory blocks (for cache) 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 (here we utilize locality, too) Dirty Flag: use cached data until base data is marked changed (..) Juha Vihavainen / University of Helsinki 10

6 Using contiguous layout for Data Locality An optimization pattern for graphics, physics, and other computationally heavy stuff with lots of data Some relevant game data Cache-friendly contiguous memory block Pointer chasing : traversing links in a graph-like structure may cause lots of cache misses 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 for each frame, the game updates every object splitting code into single-frame slices often makes it more complex for each frame, we need to store states to resume where left off coroutines would help here 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 Juha Vihavainen / University of Helsinki 12

7 Case: Unity engine and patterns Unity scripting is creating MonoBehaviour subclasses to define components for game objects Update operations implement any kind of game behavior and are always associated with Unity components A selection of Unity game programming patterns and idioms components in Unity how to access other game objects and components? prefabs in Unity (a version of the Prototype design pattern) Unity coroutine facility: an extension of Update pattern In Unity: scene = created level, project = available assets Juha Vihavainen / University of Helsinki 13 Unity game objects, components, variables Components are objects, too other game objects: parents and children Can be configuredat run time Physics materials a force slowing the movement of an object Other components: Camera, Audio Source/ Audio Listener 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. Allgame-specific variables and behaviours are defined via scripts and these are also attached to game objects as components Juha Vihavainen / University of Helsinki 14

8 Common Unity script idioms (C#) Accessing the game state of game objects, stored as parts of scripts GetComponent < ScriptId > ().variable = value; GetComponent < ScriptId > ().method (); other.getcomponent < ScriptId >().variable = v; target = anobject.getcomponent < ScriptId > (); // the same object // the same object // another object // cache the target pl = GameObject.FindWithTag ("Player").GetComponent<ScriptId> (); Scripting things to happen in the future: Invoke ("Method", 2.0f); InvokeRepeating ("Heal", 2.0f, 2.0f); void Start () { Destroy (gameobject, 5.0f); For alternative solutions can use Unity coroutines. Note. Names of game objects are not necessarily unique. // call in 2secs // call every 2 secs // will live only 5secs Juha Vihavainen / University of Helsinki 15 Unity prefabs (prefabrications) Prototypedesign 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 created in the scene and stored as an asset in the project, instantiated in Editor or at runtime a prefab is actually a reusableprototype game object to create a prefab, we drag a game object from the hierarchy view (or the scene view) into the project view can then 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 16

9 (1) Manipulating prefabs in Unity Editor (IDE) 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 To manually create and place prefab instance into the initial 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. Works OK since components uniquely determine their owner game object Juha Vihavainen / University of Helsinki 17 (2) Instantiating prefabs at run time Of course, we could create and carefully build all needed game objects from scratch using normal script code (e.g., factory methods) Prefabs are prebuilt game objects & their components that are as such reusable throughout the game (and for other games, too) In the UnityEditor: 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 18

10 Drag prefab to a variable, to be instantiated at run time E.g., in Shooter script, a prefab is stored in a variable bullet Juha Vihavainen / University of Helsinki 19 Background on C# iterators and coroutines (1) TheIterator design pattern: C#: 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 But no stack later, the execution is continued at that same precise point & state C# provides a coroutine facility for its iterator abstraction so that the iteration over all elements can be written as one single routine = algorithm that yields the values one-by-one (in a loop):.. while(morevalues) { value :=producenext; yieldreturnvalue;.. yield return may appear anywhere in the method. May have multiple yield return statements in the method Juha Vihavainen / University of Helsinki 20

11 Iterators in C# Here s a simple example: public class MyCollection: IEnumerable { Producer int[] data = { 1, 2, 3 ; public IEnumerator GetEnumerator() { // a Factory method Consumer foreach(var i in data) yield return i; for more technical details, see: /IteratorBlockImplementation.aspx The actual iterator object A collection that has an iterator // iteration spec. that // 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;.. // implicit Juha Vihavainen / University of Helsinki 21 Example: scripting a sequence of heavy tasks Consider the following Unity C# script, with actions spanning multiple subsequent frames (i.e., multi-frame) Need to check the current state using UnityEngine; using System.Collections; public class Example : MonoBehaviour // script component int state = 0; void Update () if (state == 0) // the current state of computation // called by the game loop // or can use a switch do some calculations; state = 1; // explicit state transfer return; if (state == 1) // resume others do more calculations; state = 2; return; Juha Vihavainen / University of Helsinki 22

12 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; // means: pause until next frame do more calculations;... yield return null; // pause until next frame... A coroutine must be explicitly created and started (see next slide) Juha Vihavainen / University of Helsinki 23 Using coroutines (1/3) Update () is executed each frame (unless the game object is inactive or the script component is disabled) Unity uses the C#'s iterator/coroutine facility to implement multiframe-spanning coroutines for game objects (for their scripts) Now we can have different actions happening at any intervals May improve performance by executing logic as a coroutineless often than each frame, say only every five seconds coroutine private void Start () { StartCoroutine(Calculation ()); IEnumerator Calculation () { while (true) {... run my game logic; yield return new WaitForSeconds(5.0f); Note that it is a call A subclass of YieldInstruction, anything else is mostly ignored 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 24

13 Using coroutines (2/3) We can do long computations (AI decisions, path calculations) over several frames with coroutines A call, again void Awake () { StartCoroutine(Calculate ()); IEnumeratorCalculate () { create initial setup for computations; while(not finished) { dosomecalculations; // doherea partialtaskat a time yieldreturnnull; // 0 ornull: skipto thenextframe Debug.Log("Coroutine is completed"); enabled = false; // disable this script Note. Coroutines are always executed only after all the Update functions. Note. The C# yield break statement ends coroutine (e.g., inside a loop). The suspended coroutine is again called by Unity, in the next frame, and the loop continues Juha Vihavainen / University of Helsinki 25 Using coroutines (3/3) void Start () { StartCoroutine(Init()); IEnumerator Init() { Debug.Log("Initializing"); // first state yield return new WaitForSeconds(3.0f);... Debug.Log("Initialization completed"); // initial calculations StartCoroutine(Running()); // goto next state... IEnumerator Running() { Debug.Log("Running"); yield return new WaitForSeconds(5.0f);.. Debug.Log("Running completed"); StartCoroutine(GameOver()); //... "State machines" via coroutines technique/pattern/idiom // more calculations Like the State pattern but instead of a subobject changes active coroutine Juha Vihavainen / University of Helsinki 26

+ Typed Message [Vlissides, 1998]

+ Typed Message [Vlissides, 1998] Background literature Introduction to Game Programming Autumn 2016 04. Game Programming Patterns and Techniques Juha Vihavainen University of Helsinki E. Gamma et al. (1994), Design Patterns: Elements

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

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

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

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

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

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

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

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

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

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

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

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

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

CHAPTER 6: CREATIONAL DESIGN PATTERNS

CHAPTER 6: CREATIONAL DESIGN PATTERNS CHAPTER 6: CREATIONAL DESIGN PATTERNS SESSION III: BUILDER, PROTOTYPE, SINGLETON Software Engineering Design: Theory and Practice by Carlos E. Otero Slides copyright 2012 by Carlos E. Otero For non-profit

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

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

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

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

Tuesday, October 4. Announcements

Tuesday, October 4. Announcements Tuesday, October 4 Announcements www.singularsource.net Donate to my short story contest UCI Delta Sigma Pi Accepts business and ICS students See Facebook page for details Slide 2 1 Design Patterns Design

More information

3 Product Management Anti-Patterns by Thomas Schranz

3 Product Management Anti-Patterns by Thomas Schranz 3 Product Management Anti-Patterns by Thomas Schranz News Read above article, it s good and short! October 30, 2014 2 / 3 News Read above article, it s good and short! Grading: Added explanation about

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

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

More on Design. CSCI 5828: Foundations of Software Engineering Lecture 23 Kenneth M. Anderson

More on Design. CSCI 5828: Foundations of Software Engineering Lecture 23 Kenneth M. Anderson More on Design CSCI 5828: Foundations of Software Engineering Lecture 23 Kenneth M. Anderson Outline Additional Design-Related Topics Design Patterns Singleton Strategy Model View Controller Design by

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

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

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

administrivia today UML start design patterns Tuesday, September 28, 2010

administrivia today UML start design patterns Tuesday, September 28, 2010 administrivia Assignment 2? promise to get past assignment 1 back soon exam on monday review slides are posted your responsibility to review covers through last week today UML start design patterns 1 Unified

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

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

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

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

What is Design Patterns?

What is Design Patterns? Paweł Zajączkowski What is Design Patterns? 1. Design patterns may be said as a set of probable solutions for a particular problem which is tested to work best in certain situations. 2. In other words,

More information

Design Patterns. CSC207 Fall 2017

Design Patterns. CSC207 Fall 2017 Design Patterns CSC207 Fall 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe the

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

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1 What is a Design Pattern? Each pattern Describes a problem which occurs over and over again in our environment,and then describes the core of the problem Novelists, playwrights and other writers rarely

More information

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico Modellistica Medica Maria Grazia Pia INFN Genova Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico 2002-2003 Lezione 9 OO modeling Design Patterns Structural Patterns Behavioural Patterns

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

Design patterns. OOD Lecture 6

Design patterns. OOD Lecture 6 Design patterns OOD Lecture 6 Next lecture Monday, Oct 1, at 1:15 pm, in 1311 Remember that the poster sessions are in two days Thursday, Sep 27 1:15 or 3:15 pm (check which with your TA) Room 2244 + 2245

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

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

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

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

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

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

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

Design Patterns. CSC207 Fall 2017

Design Patterns. CSC207 Fall 2017 Design Patterns CSC207 Fall 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe the

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

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

The GoF Design Patterns Reference

The GoF Design Patterns Reference The GoF Design Patterns Reference Version.0 / 0.0.07 / Printed.0.07 Copyright 0-07 wsdesign. All rights reserved. The GoF Design Patterns Reference ii Table of Contents Preface... viii I. Introduction....

More information

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D Slide 1 Design Patterns Prof. Mirco Tribastone, Ph.D. 22.11.2011 Introduction Slide 2 Basic Idea The same (well-established) schema can be reused as a solution to similar problems. Muster Abstraktion Anwendung

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object

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

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

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate UNIT 4 GRASP GRASP: Designing objects with responsibilities Creator Information expert Low Coupling Controller High Cohesion Designing for visibility - Applying GoF design patterns adapter, singleton,

More information

Design Patterns. James Brucker

Design Patterns. James Brucker Design Patterns James Brucker 1 Reusable Ideas Developers reuse knowledge, experience, & code Application Level reuse a project design & code of a similar project Design Level apply known design principles

More information

Introduction to Testing and Maintainable code

Introduction to Testing and Maintainable code Introduction to Testing and Maintainable code Reasons not to write unit tests 1. I don't know how to write tests. 2. Writing tests is too hard. 3. I don't have enough time to write tests. 4. Testing is

More information

Last Lecture. Lecture 26: Design Patterns (part 2) State. Goals of Lecture. Design Patterns

Last Lecture. Lecture 26: Design Patterns (part 2) State. Goals of Lecture. Design Patterns Lecture 26: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Last Lecture Design Patterns Background and Core Concepts Examples Singleton,

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

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

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

What are the characteristics of Object Oriented programming language?

What are the characteristics of Object Oriented programming language? What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is

More information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

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

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

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? Patterns are intended to capture the best available software development experiences in the

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecture 14: Design Workflow Department of Computer Engineering Sharif University of Technology 1 UP iterations and workflow Workflows Requirements Analysis Phases Inception Elaboration

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

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

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

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

L18.1 Introduction... 2

L18.1 Introduction... 2 Department of Computer Science COS121 Lecture Notes: L18 Iterator Design Pattern 8 September 2014 Copyright c 2014 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents L18.1 Introduction.................................

More information

Lecture 13: Design Patterns

Lecture 13: Design Patterns 1 Lecture 13: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2005 2 Pattern Resources Pattern Languages of Programming Technical conference on Patterns

More information

COMP-520 GoLite Tutorial

COMP-520 GoLite Tutorial COMP-520 GoLite Tutorial Alexander Krolik Sable Lab McGill University Winter 2019 Plan Target languages Language constructs, emphasis on special cases General execution semantics Declarations Types Statements

More information

Pattern Resources. Lecture 25: Design Patterns. What are Patterns? Design Patterns. Pattern Languages of Programming. The Portland Pattern Repository

Pattern Resources. Lecture 25: Design Patterns. What are Patterns? Design Patterns. Pattern Languages of Programming. The Portland Pattern Repository Pattern Resources Lecture 25: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Pattern Languages of Programming Technical conference on Patterns

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

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

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

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

LABORATORY 1 REVISION

LABORATORY 1 REVISION UTCN Computer Science Department Software Design 2012/2013 LABORATORY 1 REVISION ================================================================== I. UML Revision This section focuses on reviewing the

More information

Design Patterns. CSC207 Winter 2017

Design Patterns. CSC207 Winter 2017 Design Patterns CSC207 Winter 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe

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

Design Patterns. "Gang of Four"* Design Patterns. "Gang of Four" Design Patterns. Design Pattern. CS 247: Software Engineering Principles

Design Patterns. Gang of Four* Design Patterns. Gang of Four Design Patterns. Design Pattern. CS 247: Software Engineering Principles CS 247: Software Engineering Principles Design Patterns Reading: Freeman, Robson, Bates, Sierra, Head First Design Patterns, O'Reilly Media, Inc. 2004 Ch Strategy Pattern Ch 7 Adapter and Facade patterns

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

Inheritance STL. Entity Component Systems. Scene Graphs. Event Systems

Inheritance STL. Entity Component Systems. Scene Graphs. Event Systems Inheritance STL Entity Component Systems Scene Graphs Event Systems Event Systems Motivation: Decoupling events from where they are sent and where they are processed. It facilitates communication between

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

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

Creational. Structural

Creational. Structural Fitness for Future of Design Patterns & Architectural Styles Design patterns are difficult to teach, so we conducted a class collaboration where we all researched and reported on a variety of design patterns

More information

Applying the Observer Design Pattern

Applying the Observer Design Pattern Applying the Observer Design Pattern Trenton Computer Festival Professional Seminars Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S. in Computer Science Rutgers

More information

CS 247: Software Engineering Principles. Design Patterns

CS 247: Software Engineering Principles. Design Patterns CS 247: Software Engineering Principles Design Patterns Reading: Freeman, Robson, Bates, Sierra, Head First Design Patterns, O'Reilly Media, Inc. 2004 Ch 1 Strategy Pattern Ch 7 Adapter and Facade patterns

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY

EINDHOVEN UNIVERSITY OF TECHNOLOGY EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)

More information

Design Pattern: Composite

Design Pattern: Composite Design Pattern: Composite Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. Motivation

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

2.1 Design Patterns and Architecture (continued)

2.1 Design Patterns and Architecture (continued) MBSE - 2.1 Design Patterns and Architecture 1 2.1 Design Patterns and Architecture (continued) 1. Introduction 2. Model Construction 2.1 Design Patterns and Architecture 2.2 State Machines 2.3 Timed Automata

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

Refactoring Without Ropes

Refactoring Without Ropes Refactoring Without Ropes Roger Orr OR/2 Limited The term 'refactoring' has become popular in recent years; but how do we do it safely in actual practice? Refactoring... Improving the design of existing

More information

Massive Documentation

Massive Documentation Massive Documentation Release 0.2 Inhumane Software August 07, 2014 Contents 1 Introduction 3 1.1 Features.................................................. 3 1.2 Getting Started..............................................

More information

CS 349 / SE 382 Design Patterns. Professor Michael Terry January 21, 2009

CS 349 / SE 382 Design Patterns. Professor Michael Terry January 21, 2009 CS 349 / SE 382 Design Patterns Professor Michael Terry January 21, 2009 Today s Agenda More demos! Design patterns CS 349 / SE 382 / 2 Announcements Assignment 1 due Monday at 5PM! CS 349 / SE 382 / 3

More information

SOFTWARE PATTERNS. Joseph Bonello

SOFTWARE PATTERNS. Joseph Bonello SOFTWARE PATTERNS Joseph Bonello MOTIVATION Building software using new frameworks is more complex And expensive There are many methodologies and frameworks to help developers build enterprise application

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