Game development patterns and best practices: better games, less hassle
Gespeichert in:
Hauptverfasser: | , |
---|---|
Format: | Buch |
Sprache: | English |
Veröffentlicht: |
Birmingham
Packt
April 2017
|
Schlagworte: | |
Online-Zugang: | Inhaltsverzeichnis Klappentext |
Beschreibung: | vi, 375 Seiten Illustrationen, Diagramme |
ISBN: | 9781787127838 |
Internformat
MARC
LEADER | 00000nam a2200000 c 4500 | ||
---|---|---|---|
001 | BV044419687 | ||
003 | DE-604 | ||
005 | 20220309 | ||
007 | t | ||
008 | 170721s2017 a||| |||| 00||| eng d | ||
020 | |a 9781787127838 |9 978-1-78712-783-8 | ||
035 | |a (OCoLC)1002247340 | ||
035 | |a (DE-599)OBVAC13733314 | ||
040 | |a DE-604 |b ger |e rda | ||
041 | 0 | |a eng | |
049 | |a DE-355 |a DE-1102 | ||
084 | |a ST 324 |0 (DE-625)143660: |2 rvk | ||
100 | 1 | |a Doran, John P. |d 1987- |e Verfasser |0 (DE-588)1041915187 |4 aut | |
245 | 1 | 0 | |a Game development patterns and best practices |b better games, less hassle |c John P. Doran, Matt Casanova |
264 | 1 | |a Birmingham |b Packt |c April 2017 | |
300 | |a vi, 375 Seiten |b Illustrationen, Diagramme | ||
336 | |b txt |2 rdacontent | ||
337 | |b n |2 rdamedia | ||
338 | |b nc |2 rdacarrier | ||
650 | 0 | 7 | |a Programmierung |0 (DE-588)4076370-5 |2 gnd |9 rswk-swf |
650 | 0 | 7 | |a Computerspiel |0 (DE-588)4010457-6 |2 gnd |9 rswk-swf |
689 | 0 | 0 | |a Computerspiel |0 (DE-588)4010457-6 |D s |
689 | 0 | 1 | |a Programmierung |0 (DE-588)4076370-5 |D s |
689 | 0 | |5 DE-604 | |
700 | 1 | |a Casanova, Matt |e Verfasser |4 aut | |
856 | 4 | 2 | |m Digitalisierung UB Regensburg - ADAM Catalogue Enrichment |q application/pdf |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=029821318&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |3 Inhaltsverzeichnis |
856 | 4 | 2 | |m Digitalisierung UB Regensburg - ADAM Catalogue Enrichment |q application/pdf |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=029821318&sequence=000003&line_number=0002&func_code=DB_RECORDS&service_type=MEDIA |3 Klappentext |
999 | |a oai:aleph.bib-bvb.de:BVB01-029821318 |
Datensatz im Suchindex
_version_ | 1804177714173706240 |
---|---|
adam_text | Table of Contents
Preface___________________________________________________________________________i
Chapter 1: Introduction to Design Patterns________________________________________9
Chapter overview 9
Your objective 10
What are design patterns 10
Why you should plan for change 12
Understanding UML class diagrams 13
Relationships between classes 14
Inheritance 14
Aggregation 15
Composition 17
Implements 18
Separating the why and the how 19
Understanding the separation of concerns 19
An Introduction to interfaces 20
Polymorphism refresher 20
Understanding interfaces 22
The advantages of compartmentalizing code 24
The structure of the Mach5 engine 25
Mach5 core engines and systems 26
The app 26
The StageManager 26
The ObjectManager 27
The graphics engine 27
Tools and utilities 28
The problems with using design patterns in games 28
Setting up the project 29
Summary 37
Chapter 2: One Instance to Rule Them All - Singletons____________________________39
Chapter overview 39
Your objective 39
An overview on class access specifiers 40
The static keyword 41
Static keyword inside a function 42
Static keyword in class definitions 44
Static as a file global variable 46
Pros and cons of global variables 46
What is a Singleton? 46
Keeping the single in Singleton 50
Deleting our object correctly 52
Learning about templates 53
Templatizing Singletons 56
Advantages/disadvantages of using only one instance 60
The Singleton in action - the Application class 60
Summary 64
Chapter 3: Creating Flexibility with the Component Object Model________________65
Chapter overview 66
Your objectives 66
Why a monolithic game object is a bad design 67
The monolithic game object 67
The problem with object behavior 70
The benefits of the monolithic game object 71
Why inheritance hierarchies are inflexible 72
Organizing the code by what it does, not what it is 76
Avoiding the Diamond of Death 80
The Strategy pattern and the Decorator pattern 81
The Strategy pattern explained 82
The Decorator pattern explained 84
The Component Object Model explained 88
Implementing the Component Object Model 91
Implementing components 98
Creating and removing objects and components 100
Performance concerns 103
Summary 105
Chapter 4: Artificial Intelligence Using the State Pattern____________________107
Chapter overview 108
Your objectives 108
The State pattern explained 108
Introduction to State Machines 109
An overview of enumerations 110
Acting on states 111
Issues with conditionals 117
Expanding on the State Machine 120
The State pattern in action - the M5StateMachine class 124
The State pattern in action - StageManager 132
Issues with FSMs 135
Summary 135
Chapter 5: Decoupling Code via the Factory Method Pattern__________________137
Chapter overview 138
Your objective 138
The trouble with switch statements 139
The Dependency Inversion Principle 142
The Factory method pattern 146
The Static Factory 148
The Dynamic Factory 149
Creating our Stage Builders 151
The template builder 153
Creating the Dynamic Factory class 154
Using the Dynamic Factory 159
Creating a component and Object Factory 161
The Templated Factory 162
Architecting versus over-architecting 165
Summary 166
Chapter 6: Creating Objects with the Prototype Pattern_____________________169
Your objectives 170
The trouble with using a factory for game objects 170
Using builders with objects 172
Solution - reading from files 175
The Prototype pattern explained 176
The virtual constructor 178
The problem with constructors 181
The benefits of a virtual constructor 182
We don t need to know the type 182
No need to subclass 185
It s easy to make exact copies 185
Examples of the clone method in Mach5 186
The Gfx and collider components 187
Cloning an object 191
Choosing a copy constructor 192
Covariant return types 194
Loading archetypes from a file 196
Archetype files 196
The object manager 197
Summary 201
Chapter 7: Improving Performance with Object Pools_______________________203
Chapter overview 203
Your objectives 204
Why you should care about memory 204
The Object Pool pattern explained 205
Implementing a basic object pool 207
Operator overloading in C++ 212
Building the object pool for Mach5 216
Issues with object pools 225
Summary 226
Chapter 8: Controlling the Ul via the Command Pattern____________________227
Chapter overview 228
Your objectives 228
How can we control actions through buttons? 228
Callback functions 230
Repeated code in the component 235
The Command pattern explained 237
Two parameters and beyond 240
Pointers to member functions 242
Pointer to member command 244
The benefits of the command pattern 248
Treating a function call like an object 248
Physically decoupling the client and the function call 249
Temporal decoupling 250
Undo and redo 250
Easy Ul with commands in Mach5 252
Using commands 255
Summary 257
Chapter 9: Decoupling Gameplay via the Observer Pattern__________________259
Chapter overview 260
Your objectives 260
How gameplay creeps into every system 260
Hardcoding requirements 262
Polling 263
The Observer pattern explained 264
The Subject and Observer 264
---------------------------------- [iv] ------------------------------------
The Player 266
The Observers 268
Push versus Pull 272
Benefits of using the Observer pattern 274
Problems using the Observer pattern 275
Dangling references 275
Overuse 276
Implementing interfaces 277
When to notify 278
Summary 278
Chapter 10: Sharing Objects with the Flyweight Pattern________________________28^
Chapter overview 281
Your objectives 282
Introductions to particles 282
Implementing particles in Mach5 283
Why memory is still an issue 289
Introduction to the Flyweight pattern 290
Transitioning to ParticleSystems 291
Creating different system types 291
Developing the ParticleFactory 293
Using the ParticleFactory 294
Summary 302
Chapter 11: Understanding Graphics and Animation______________________________303
Chapter overview 303
Your objectives 304
Introduction to monitor refresh rates 304
What is a pixel? 305
The horizontal and vertical blank 307
Refresh rate 309
Double buffering 312
The back buffer 313
VSync 315
Triple buffering 318
LCD monitors 322
Time-based movement and animation 322
Frame-based movement 323
Time-based movement 324
Summary 329
Chapter 12: Best Practices____________________________________________________331
[v]
Chapter overview 332
Your objectives 332
Learning fundamental code quality techniques 332
Avoid magic numbers 333
White space 336
Indentation 338
Blank lines and spaces 339
Comments and self-documenting code 341
Commenting 343
Learning and understand the uses of the const keyword 345
Const function parameters 346
Const classes as parameters 349
Const member functions 350
Problems with const 354
Learning how iteration can improve your game and code design 356
The game development cycle 357
Production phase 357
Prototyping 358
Playtesting 359
Conducting a playtest 359
Iteration 361
Meeting milestones 362
Learning when to use scripting in a game 362
Introduction to assembly 363
Moving to higher-level programming languages 363
Introducing the compiler 364
Introduction to scripting languages 365
Using interpreters 366
Just in time compilation 366
Why use a scripting language? 367
When to use C++ 368
Compiled versus scripting 368
Summary 369
Index 371
[vi]
Came Development Patterns
and Best Practices
You ve learned how to program, and you ve
probably created some simple games at
some point, but now you want to build
larger projects and find out howto resolve
your problems. So instead of thinking like
a coder, you might now want to think like
a game developer or software engineer. To
organize your code well you need certain
tools, and that s what this book is all about.
You will learn techniques to code quickly
and correctly, while ensuring your code is
modular and easily understandable. We
will start with the core game programming
patterns, but not in the usual way.
We will take the use case strategy
with this book. We will take an AAA
standard game and show you the hurdles
at multiple stages of development.
Similarly, various use cases are used to
showcase other patterns, such as the
adapter pattern, gameplay prototype
pattern, the flyweight pattern, and the
observer pattern.
Lastly, we ll go over some tips and tricks on
refactoring your code to remove common
code smells and make it easier for others
to work with you. By the end of the book
you will be proficient at using the most
popular and frequently used patterns with
the best practices.
Things you will learn:
• Learn what design patterns are and
why you would want to use them
• Reduce the maintenance burden with
well tested, cleaner code
• Employ the singleton pattern
effectively to reduce your
compiler workload
• Use the factory pattern to help you
create different objects with the same
creation logic and reduce coding time
• Improve game performance with
Object Pools
• Allow gameplay to interact with
physics or graphics in an abstract way
• Refractor your code to remove
common code smells
|
any_adam_object | 1 |
author | Doran, John P. 1987- Casanova, Matt |
author_GND | (DE-588)1041915187 |
author_facet | Doran, John P. 1987- Casanova, Matt |
author_role | aut aut |
author_sort | Doran, John P. 1987- |
author_variant | j p d jp jpd m c mc |
building | Verbundindex |
bvnumber | BV044419687 |
classification_rvk | ST 324 |
ctrlnum | (OCoLC)1002247340 (DE-599)OBVAC13733314 |
discipline | Informatik |
format | Book |
fullrecord | <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01721nam a2200361 c 4500</leader><controlfield tag="001">BV044419687</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20220309 </controlfield><controlfield tag="007">t</controlfield><controlfield tag="008">170721s2017 a||| |||| 00||| eng d</controlfield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">9781787127838</subfield><subfield code="9">978-1-78712-783-8</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)1002247340</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)OBVAC13733314</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield><subfield code="e">rda</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="049" ind1=" " ind2=" "><subfield code="a">DE-355</subfield><subfield code="a">DE-1102</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 324</subfield><subfield code="0">(DE-625)143660:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Doran, John P.</subfield><subfield code="d">1987-</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)1041915187</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">Game development patterns and best practices</subfield><subfield code="b">better games, less hassle</subfield><subfield code="c">John P. Doran, Matt Casanova</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">Birmingham</subfield><subfield code="b">Packt</subfield><subfield code="c">April 2017</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">vi, 375 Seiten</subfield><subfield code="b">Illustrationen, Diagramme</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Programmierung</subfield><subfield code="0">(DE-588)4076370-5</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Computerspiel</subfield><subfield code="0">(DE-588)4010457-6</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="689" ind1="0" ind2="0"><subfield code="a">Computerspiel</subfield><subfield code="0">(DE-588)4010457-6</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2="1"><subfield code="a">Programmierung</subfield><subfield code="0">(DE-588)4076370-5</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2=" "><subfield code="5">DE-604</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Casanova, Matt</subfield><subfield code="e">Verfasser</subfield><subfield code="4">aut</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">Digitalisierung UB Regensburg - ADAM Catalogue Enrichment</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=029821318&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">Digitalisierung UB Regensburg - ADAM Catalogue Enrichment</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=029821318&sequence=000003&line_number=0002&func_code=DB_RECORDS&service_type=MEDIA</subfield><subfield code="3">Klappentext</subfield></datafield><datafield tag="999" ind1=" " ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-029821318</subfield></datafield></record></collection> |
id | DE-604.BV044419687 |
illustrated | Illustrated |
indexdate | 2024-07-10T07:52:28Z |
institution | BVB |
isbn | 9781787127838 |
language | English |
oai_aleph_id | oai:aleph.bib-bvb.de:BVB01-029821318 |
oclc_num | 1002247340 |
open_access_boolean | |
owner | DE-355 DE-BY-UBR DE-1102 |
owner_facet | DE-355 DE-BY-UBR DE-1102 |
physical | vi, 375 Seiten Illustrationen, Diagramme |
publishDate | 2017 |
publishDateSearch | 2017 |
publishDateSort | 2017 |
publisher | Packt |
record_format | marc |
spelling | Doran, John P. 1987- Verfasser (DE-588)1041915187 aut Game development patterns and best practices better games, less hassle John P. Doran, Matt Casanova Birmingham Packt April 2017 vi, 375 Seiten Illustrationen, Diagramme txt rdacontent n rdamedia nc rdacarrier Programmierung (DE-588)4076370-5 gnd rswk-swf Computerspiel (DE-588)4010457-6 gnd rswk-swf Computerspiel (DE-588)4010457-6 s Programmierung (DE-588)4076370-5 s DE-604 Casanova, Matt Verfasser aut Digitalisierung UB Regensburg - ADAM Catalogue Enrichment application/pdf http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=029821318&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA Inhaltsverzeichnis Digitalisierung UB Regensburg - ADAM Catalogue Enrichment application/pdf http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=029821318&sequence=000003&line_number=0002&func_code=DB_RECORDS&service_type=MEDIA Klappentext |
spellingShingle | Doran, John P. 1987- Casanova, Matt Game development patterns and best practices better games, less hassle Programmierung (DE-588)4076370-5 gnd Computerspiel (DE-588)4010457-6 gnd |
subject_GND | (DE-588)4076370-5 (DE-588)4010457-6 |
title | Game development patterns and best practices better games, less hassle |
title_auth | Game development patterns and best practices better games, less hassle |
title_exact_search | Game development patterns and best practices better games, less hassle |
title_full | Game development patterns and best practices better games, less hassle John P. Doran, Matt Casanova |
title_fullStr | Game development patterns and best practices better games, less hassle John P. Doran, Matt Casanova |
title_full_unstemmed | Game development patterns and best practices better games, less hassle John P. Doran, Matt Casanova |
title_short | Game development patterns and best practices |
title_sort | game development patterns and best practices better games less hassle |
title_sub | better games, less hassle |
topic | Programmierung (DE-588)4076370-5 gnd Computerspiel (DE-588)4010457-6 gnd |
topic_facet | Programmierung Computerspiel |
url | http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=029821318&sequence=000001&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=029821318&sequence=000003&line_number=0002&func_code=DB_RECORDS&service_type=MEDIA |
work_keys_str_mv | AT doranjohnp gamedevelopmentpatternsandbestpracticesbettergameslesshassle AT casanovamatt gamedevelopmentpatternsandbestpracticesbettergameslesshassle |