Intro To Game Architecture: Jeff Ward Associate Programmer Bethesda Game Studios
Intro To Game Architecture: Jeff Ward Associate Programmer Bethesda Game Studios
Jeff Ward
Associate Programmer
Bethesda Game Studios
My Talk
Sorry.
Your First Engine
Renderer Creature
Player
3DObj AI
2DObj
Items Bullets
Sound
Input File Loader
3dSnd
Stability
Reusability
Cohesion
Orthogonally
A well architected system is
easy to understand, change,
debug, and reuse.
Principles of OOP
Basics
Encapsulation
Inheritance
Polymorphism
Principles of good design
Reduced coupling
Increased reliability
Increased reusability
$10 word - orthogonality
Encapsulation
Creature Creature
Inheritance
Creational pattern
Only one instance of the object exists
Private constructor with public accessor (usually
Class::Instance())
Really nice name for a global
Often overused, and often not a real solution
Singletons translate well to factories
Singleton Example
Behavioral pattern
Inform multiple dependant objects of changes
Usually implemented as Subject and IListener
objects
Listeners add themselves to subjects
When a subject changes, all listeners are notified.
Great for message queues
Message Queues
NPCs
MVC
Model View Controller
Architectural pattern
Keeps data and representation separate
Model = data, view = representation
Controller is what sends messages to the model and
view.
Advantages
One data, multiple views
Data manipulates data, and doesn’t care if its being viewed
Change renderers without changing anything else
MVC Example
IResource
File Facade
Sound
Input File Loader
3dSnd
Best Practices
Management idea
That there is a technique that is more effective than any
other technique at delivering positive results.
Something you don’t have to do, but it’s a good idea.
They’re like design patterns on a small scale.
Two books:
Pragmatic Programmer by Andrew Hunt and David Thomas
C++ Coding Standards: 101 Rules, Guidelines, and Best
Practices by Herb Sutter and Andrei Alexandrescu
Examples of Best Practices
Management Best Practices
Use version control
Do automated testing
Have automated builds
Coding Best Practices
Prefer compile / link time errors to run time errors
Give one entity one cohesive responsibility
Prefer composition to inheritance
Always code for concurrency (in terms of
architecture)
Best Practices
[email protected]
http://www.jeffongames.com