Big Era Five Patterns of Interregional Unity 500 CE – 1500 ...
Unity - Software Design Patterns
-
Upload
david-baron -
Category
Software
-
view
152 -
download
2
Transcript of Unity - Software Design Patterns
Software Design PatternsHow I use them in Unity!
Me!
David Baron- Professional Game Developer- I’ve worked for Ubisoft, Eidos, Gameloft …- Currently specialization is VR / AR
Goals
What I’m covering?
- My observations of the rise of Unity within the indie game industry.
- How developers started integrated design patterns into the scripting engine.
- Only the simplest patterns that I find useful for indie game development.
What I’m NOT covering?
- The exact GoF definitions.
- Source-code or how to implement them.
- There’s people that know this stuff way better than me!
What are design patterns?
History
GoFGang of Four
AAA
C++
C#
LUA
Visual Scripting
Engine Programmer
Gameplay Programmer
Technical Director
Level Designer / Scripter
Core Implementations
Game System Implementations
Exposition & Wrapping
Sequencing & Integration
What do I code in Unity?
BehavioursAnimations, cycles, UI, NPCs ...
SystemsMechanics, services ...
ScenariosScene events, flow, paths,
narration ...
ToolsIntegration, debugging,
optimization ...
My rule of thumb
If I don’t recognize it after coding it then it’s not a pattern!
The Anti-Pattern
Spaghetti
Spaghetti- Public GameObject ….
- Reference hell!
- Abusing the inspector.
The Patterns
Singleton
Singleton- Anyways all GameObjects in the scene are
initialized.
- Easy access to an instance.
- But not everything needs to be accessible.
- Too many singles in one room!
Facade
Hide the nuts and bolts!
Facade- I see it being used in a professional contexts.
- Very good solution for exposing complex gameplay systems to scripters.
Managers & Facades- They usually synonyms but not always.
- Having too many managers is like having “too many cooks in the kitchen”.
Adapter
Adapter- I use when I’m in an advanced prototyping
stage but I want to avoid refactoring interfaces to related implementations.
- Adapter makes things work after they're designed.
Exploring
Mediator
Mediator- My biggest challenge is to find elegant ways for
game systems to communicate with each other while staying decoupled.
- The Mediator design pattern is used to handle communication between related objects (Colleagues).
- I NEVER used in production, at least not in an explicit way.
Decorator
Object Pool
References
- Derek Banashttps://www.youtube.com/playlist?list=PLF206E906175C7E07
- Decorator Design Patternhttps://sourcemaking.com/design_patterns/decorator
- Efficient WebVR Development Using the Adapter Pattern in Three.jshttp://hecodes.com/2016/08/efficient-webvr-development-using-the-adapter-pattern-in-three-js/