@agatestudio 
Game programming 
Restya 
Producer 
Agate Studio
GAME PROGRAMMING PATTERNS 
Restya – TDS Agate Oktober
Why?
Chapters 
Design Patterns Revisited 
Sequencing Patterns 
Behavioral Patterns 
Decoupling Patterns 
Optimization Patterns
We’ll be focussed on 
Design Patterns Revisited 
Command 
Flyweight 
Observer 
Prototype 
Singleton 
State
Design Pattern
Design Pattern? 
general reusable solution to a commonly occurring problem within a given context in software design
Command 
Commands are an object-oriented replacement for callbacks
Command: Configuring Inputs
Command: Directions for Actors 
Pass the object that we want to order
Command: Undo and Redo
Flyweight
Observer 
An object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.
Observer: The Observer
Observer: The Subject
Prototype
Not Using Prototype
Using Prototype
Using Protoype
Prototype: Spawn Function
Prototype: Templates
Prototypes for Data Modelling
Singleton 
Ensure a class has one instance, and provide a global point of access to it.
Singleton +/- 
It doesn’t create the instance if no one uses it 
It’s initialized at runtime 
You can subclass the singleton 
It’s a global variable 
They make it harder to reason about code 
They encourage coupling 
They aren’t concurrency- friendly 
It solves two problems even when you just have one 
Lazy initialization takes control away from you 
Why we use it 
Why we regret using it
State
State Pattern 
Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
State Pattern (2)
Static State
Instantiated State
Enter and Exit Actions 
But we want each state to control its own graphics
Enter and Exit Actions (2)
Source: http://gameprogrammingpatterns.com/ 
Udah Gitu Aja

Game Programming Pattern by Restya