Skip to content

Commit 2de5020

Browse files
committed
Modernize:
- Change font links to https since browsers disable mixed security now. - Migrate build script to Python 3. - Update to jQuery 3.6.0.
1 parent 54ac84a commit 2de5020

37 files changed

+1305
-2090
lines changed

asset/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ blockquote {
177177
code {
178178
color: hsl(200, 20%, 40%);
179179
font: normal 15px $mono;
180-
white-space: nowrap;
180+
white-space: pre;
181181
}
182182

183183
a code {

asset/template.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
the viewport. -->
1010
<meta name="viewport" content="width=device-width, initial-scale=1"/>
1111
<link rel="stylesheet" type="text/css" href="style.css" />
12-
<link href="http://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
12+
<link href="https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
1313
<script>
1414
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1515
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -19,7 +19,7 @@
1919
ga('create', 'UA-42804721-1', 'gameprogrammingpatterns.com');
2020
ga('send', 'pageview');
2121
</script>
22-
<script src="jquery-1.10.1.min.js"></script>
22+
<script src="jquery-3.6.0.min.js"></script>
2323
<script src="script.js"></script>
2424
</head>
2525
<body id="top">
@@ -40,6 +40,6 @@ <h1 class="book"><a href="/">Game Programming Patterns</a>{{section_header}}</h1
4040
</nav>
4141
</div>
4242
</div>
43-
<footer>&copy; 2009-2015 Robert Nystrom</footer>
43+
<footer>&copy; 2009-2021 Robert Nystrom</footer>
4444
</body>
4545
</html>

build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
python script/format.py $@
2+
python3 script/format.py $@

html/acknowledgements.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
the viewport. -->
1010
<meta name="viewport" content="width=device-width, initial-scale=1"/>
1111
<link rel="stylesheet" type="text/css" href="style.css" />
12-
<link href="http://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
12+
<link href="https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
1313
<script>
1414
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1515
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -19,7 +19,7 @@
1919
ga('create', 'UA-42804721-1', 'gameprogrammingpatterns.com');
2020
ga('send', 'pageview');
2121
</script>
22-
<script src="jquery-1.10.1.min.js"></script>
22+
<script src="jquery-3.6.0.min.js"></script>
2323
<script src="script.js"></script>
2424
</head>
2525
<body id="top">
@@ -49,23 +49,19 @@ <h1 class="book"><a href="/">Game Programming Patterns</a></h1>
4949
up the incentive of a writing schedule, but with readers patting my back when I
5050
finished each chapter, I had more than enough motivation.</p>
5151
<aside name="editor">
52-
5352
<p>What I didn&#8217;t lose was a copy editor. Lauren Briese showed up just when I
5453
needed her and did a wonderful job.</p>
5554
</aside>
56-
5755
<p>They call this &#8220;self publishing&#8221;, but &#8220;crowd publishing&#8221; is closer to the mark.
5856
Writing can be lonely work, but I was never alone. Even when I put the book on a
5957
shelf for two years, the encouragement continued. Without the dozens of people
6058
who didn&#8217;t let me forget that they were waiting for more chapters, I never would
6159
have picked it back up and finished.</p>
6260
<aside name="colm">
63-
6461
<p>Special thanks go to Colm Sloan who pored over every single chapter in the book
6562
<em>twice</em> and gave me mountains of fantastic feedback, all out of the goodness of
6663
his own heart. I owe you a beer or twenty.</p>
6764
</aside>
68-
6965
<p>To everyone who emailed or commented, upvoted or favorited, tweeted or
7066
retweeted, anyone who reached out to me, or told a friend about the book, or
7167
sent me a bug report: my heart is filled with gratitude for you. Completing this
@@ -78,6 +74,6 @@ <h1 class="book"><a href="/">Game Programming Patterns</a></h1>
7874
</nav>
7975
</div>
8076
</div>
81-
<footer>&copy; 2009-2014 Robert Nystrom</footer>
77+
<footer>&copy; 2009-2021 Robert Nystrom</footer>
8278
</body>
8379
</html>

html/architecture-performance-and-games.html

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
the viewport. -->
1010
<meta name="viewport" content="width=device-width, initial-scale=1"/>
1111
<link rel="stylesheet" type="text/css" href="style.css" />
12-
<link href="http://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
12+
<link href="https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
1313
<script>
1414
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1515
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -19,7 +19,7 @@
1919
ga('create', 'UA-42804721-1', 'gameprogrammingpatterns.com');
2020
ga('send', 'pageview');
2121
</script>
22-
<script src="jquery-1.10.1.min.js"></script>
22+
<script src="jquery-3.6.0.min.js"></script>
2323
<script src="script.js"></script>
2424
</head>
2525
<body id="top">
@@ -39,21 +39,17 @@ <h1 class="book"><a href="/">Game Programming Patterns</a><span class="section">
3939
about how terrible (or awesome) design patterns and software architecture are,
4040
it will give you some ammo to use.</p>
4141
<aside name="ammo">
42-
4342
<p>Note that I didn&#8217;t presume which side you&#8217;re taking in that fight. Like any arms
4443
dealer, I have wares for sale to all combatants.</p>
4544
</aside>
46-
4745
<h2><a href="#what-is-software-architecture" name="what-is-software-architecture">What is Software Architecture?</a></h2>
4846
<p><span name="won't">If</span> you read this book cover to cover, you won&#8217;t come
4947
away knowing the linear algebra behind 3D graphics or the calculus behind game
5048
physics. It won&#8217;t show you how to alpha-beta prune your AI&#8217;s search tree or
5149
simulate a room&#8217;s reverberation in your audio playback.</p>
5250
<aside name="won't">
53-
5451
<p>Wow, this paragraph would make a terrible ad for the book.</p>
5552
</aside>
56-
5753
<p>Instead, this book is about the code <em>between</em> all of that. It&#8217;s less about
5854
writing code
5955
than it is about <em>organizing</em> it. Every program has <em>some</em> organization, even if
@@ -65,10 +61,8 @@ <h2><a href="#what-is-software-architecture" name="what-is-software-architecture
6561
<span name="suffered">bad</span>, the best you could hope to do for them is take
6662
them out back and put them out of their misery.</p>
6763
<aside name="suffered">
68-
6964
<p>Let&#8217;s admit it, most of us are <em>responsible</em> for a few of those.</p>
7065
</aside>
71-
7266
<p>A lucky few have had the opposite experience, a chance to work with beautifully
7367
designed code. The kind of codebase that feels like a perfectly appointed luxury
7468
hotel festooned with concierges waiting eagerly on your every whim. What&#8217;s the
@@ -93,10 +87,8 @@ <h3><a href="#how-do-you-make-a-change" name="how-do-you-make-a-change">How do y
9387
you need to <span name="ocr">load</span> all of the relevant pieces of it into
9488
your primate brain.</p>
9589
<aside name="ocr">
96-
9790
<p>It&#8217;s weird to think that this is literally an OCR process.</p>
9891
</aside>
99-
10092
<p>We tend to gloss over this step, but it&#8217;s often the most time-consuming part of
10193
programming. If you think paging some data from disk into RAM is slow, try
10294
paging it into a simian cerebrum over a pair of optical nerves.</p>
@@ -109,14 +101,12 @@ <h3><a href="#how-do-you-make-a-change" name="how-do-you-make-a-change">How do y
109101
<span name="tests">tests</span> and send it off for code review, you often have
110102
some cleanup to do.</p>
111103
<aside name="tests">
112-
113104
<p>Did I say &#8220;tests&#8221;? Oh, yes, I did. It&#8217;s hard to write unit tests for some game
114105
code, but a large fraction of the codebase is perfectly testable.</p>
115106
<p>I won&#8217;t get on a soapbox here, but I&#8217;ll ask you to consider doing more automated
116107
testing if you aren&#8217;t already. Don&#8217;t you have better things to do than manually
117108
validate stuff over and over again?</p>
118109
</aside>
119-
120110
<p>You jammed a bit more code into your game, but you don&#8217;t want the next person to
121111
come along to trip over the wrinkles you left throughout the source. Unless the
122112
change is minor, there&#8217;s usually a bit of reorganization to do to make your new
@@ -127,11 +117,9 @@ <h3><a href="#how-do-you-make-a-change" name="how-do-you-make-a-change">How do y
127117
<p><span name="life-cycle"></span></p>
128118
<p><img src="images/architecture-cycle.png" alt="Get problem &rarr; Learn code &rarr; Code solution &rarr; Clean up &rarr; and back around to the beginning." /></p>
129119
<aside name="life-cycle">
130-
131120
<p>The fact that there is no escape from that loop is a little alarming now that I
132121
think about it.</p>
133122
</aside>
134-
135123
<h3><a href="#how-can-decoupling-help" name="how-can-decoupling-help">How can decoupling help?</a></h3>
136124
<p>While it isn&#8217;t obvious, I think much of software architecture is about that
137125
learning phase. Loading code into neurons is so painfully slow that it pays to
@@ -165,15 +153,13 @@ <h2><a href="#at-what-cost" name="at-what-cost">At What Cost?</a></h2>
165153
well and <em>keep</em> it organized throughout the thousands of little changes that
166154
make up a development cycle.</p>
167155
<aside name="maintain">
168-
169156
<p>The second half of this&#8202;&mdash;&#8202;maintaining your design&#8202;&mdash;&#8202;deserves special
170157
attention. I&#8217;ve seen many programs start out beautifully and then die a death of a
171158
thousand cuts as programmers add &#8220;just one tiny little hack&#8221; over and over
172159
again.</p>
173160
<p>Like gardening, it&#8217;s not enough to put in new plants. You must also weed and
174161
prune.</p>
175162
</aside>
176-
177163
<p>You have to think about which parts of the program should be decoupled and
178164
introduce abstractions at those points. Likewise, you have to determine where
179165
extensibility should be engineered in so future changes are easier to make.</p>
@@ -190,12 +176,10 @@ <h2><a href="#at-what-cost" name="at-what-cost">At What Cost?</a></h2>
190176
modularity doesn&#8217;t end up being helpful, it quickly becomes actively harmful.
191177
After all, it is more code you have to deal with.</p>
192178
<aside name="yagni">
193-
194179
<p>Some folks coined the term &#8220;YAGNI&#8221;&#8202;&mdash;&#8202;<a href="http://en.wikipedia.org/wiki/You_aren't_gonna_need_it">You aren&#8217;t gonna need
195180
it</a>&#8202;&mdash;&#8202;as a mantra to use
196181
to fight this urge to speculate about what your future self may want.</p>
197182
</aside>
198-
199183
<p>When people get overzealous about this, you get a codebase whose architecture
200184
has spiraled out of control. You&#8217;ve got interfaces and abstractions everywhere.
201185
Plug-in systems, abstract base classes, virtual methods galore, and all sorts of
@@ -217,7 +201,6 @@ <h2><a href="#performance-and-speed" name="performance-and-speed">Performance an
217201
dispatch, interfaces, pointers, messages, and <span name="templates">other
218202
mechanisms</span> that all have at least some runtime cost.</p>
219203
<aside name="templates">
220-
221204
<p>One interesting counter-example is templates in C++. Template metaprogramming
222205
can sometimes give you the abstraction of interfaces without any penalty at
223206
runtime.</p>
@@ -230,7 +213,6 @@ <h2><a href="#performance-and-speed" name="performance-and-speed">Performance an
230213
decision of which class to call at <em>compile time</em> when the template is
231214
instantiated.</p>
232215
</aside>
233-
234216
<p>There&#8217;s a reason for this. A lot of software architecture is about making your
235217
program more flexible. It&#8217;s about making it take less effort to change it. That
236218
means encoding fewer assumptions in the program. You use interfaces so that your
@@ -300,12 +282,10 @@ <h2><a href="#the-good-in-bad-code" name="the-good-in-bad-code">The Good in Bad
300282
there&#8217;s a <em>chance</em> you&#8217;ll end up having to keep it around, you may have to
301283
defensively write it well.</p>
302284
<aside name="throwaway">
303-
304285
<p>One trick to ensuring your prototype code isn&#8217;t obliged to become real code is
305286
to write it in a language different from the one your game uses. That way, you have to
306287
rewrite it before it can end up in your actual game.</p>
307288
</aside>
308-
309289
<h2><a href="#striking-a-balance" name="striking-a-balance">Striking a Balance</a></h2>
310290
<p>We have a few forces in play:</p>
311291
<ol>
@@ -315,12 +295,10 @@ <h2><a href="#striking-a-balance" name="striking-a-balance">Striking a Balance</
315295
<li>We want to get today&#8217;s features done quickly.</li>
316296
</ol>
317297
<aside name="speed">
318-
319298
<p>I think it&#8217;s interesting that these are all about some kind of speed: our
320299
long-term development speed, the game&#8217;s execution speed, and our short-term
321300
development speed.</p>
322301
</aside>
323-
324302
<p>These goals are at least partially in opposition. Good architecture improves
325303
productivity over the long term, but maintaining it means every change requires
326304
a little more effort to keep things clean.</p>
@@ -342,12 +320,10 @@ <h2><a href="#striking-a-balance" name="striking-a-balance">Striking a Balance</
342320
that. A field you can master in a week is ultimately boring. You don&#8217;t hear of
343321
someone&#8217;s distinguished career in <span name="ditch">ditch digging</span>.</p>
344322
<aside name="ditch">
345-
346323
<p>Maybe you do; I didn&#8217;t research that analogy. For all I know, there could be avid
347324
ditch digging hobbyists, ditch digging conventions, and a whole subculture
348325
around it. Who am I to judge?</p>
349326
</aside>
350-
351327
<p>To me, this has much in common with games themselves. A game like chess
352328
can never be mastered because all of the pieces are so perfectly balanced
353329
against one another. This means you can spend your life exploring the vast space
@@ -369,7 +345,6 @@ <h2><a href="#simplicity" name="simplicity">Simplicity</a></h2>
369345
code, but a good solution isn&#8217;t an accretion of code, it&#8217;s a <em>distillation</em> of
370346
it.</p>
371347
<aside name="simple">
372-
373348
<p>Blaise Pascal famously ended a letter with, &#8220;I would have written a shorter
374349
letter, but I did not have the time.&#8221;</p>
375350
<p>Another choice quote comes from Antoine de Saint-Exupery: &#8220;Perfection is
@@ -378,7 +353,6 @@ <h2><a href="#simplicity" name="simplicity">Simplicity</a></h2>
378353
<p>Closer to home, I&#8217;ll note that every time I revise a chapter in this book, it
379354
gets shorter. Some chapters are tightened by 20% by the time they&#8217;re done.</p>
380355
</aside>
381-
382356
<p>We&#8217;re rarely presented with an elegant problem. Instead, it&#8217;s a pile of use
383357
cases. You want the X to do Y when Z, but W when A, and so on. In other words, a
384358
long list of different example behaviors.</p>
@@ -411,11 +385,9 @@ <h2><a href="#get-on-with-it,-already" name="get-on-with-it,-already">Get On Wit
411385
</li>
412386
</ul>
413387
<aside name="think">
414-
415388
<p>Trust me, two months before shipping is <em>not</em> when you want to start worrying
416389
about that nagging little &#8220;game only runs at 1 FPS&#8221; problem.</p>
417390
</aside>
418-
419391
<ul>
420392
<li>
421393
<p>Move quickly to explore your game&#8217;s design space, but don&#8217;t go so fast that
@@ -438,6 +410,6 @@ <h2><a href="#get-on-with-it,-already" name="get-on-with-it,-already">Get On Wit
438410
</nav>
439411
</div>
440412
</div>
441-
<footer>&copy; 2009-2014 Robert Nystrom</footer>
413+
<footer>&copy; 2009-2021 Robert Nystrom</footer>
442414
</body>
443415
</html>

html/behavioral-patterns.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
the viewport. -->
1010
<meta name="viewport" content="width=device-width, initial-scale=1"/>
1111
<link rel="stylesheet" type="text/css" href="style.css" />
12-
<link href="http://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
12+
<link href="https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic|Source+Code+Pro|Source+Sans+Pro:200,300,400,600,400italic,600italic|Rock+Salt" rel="stylesheet" type="text/css">
1313
<script>
1414
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1515
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -19,7 +19,7 @@
1919
ga('create', 'UA-42804721-1', 'gameprogrammingpatterns.com');
2020
ga('send', 'pageview');
2121
</script>
22-
<script src="jquery-1.10.1.min.js"></script>
22+
<script src="jquery-3.6.0.min.js"></script>
2323
<script src="script.js"></script>
2424
</head>
2525
<body id="top">
@@ -60,6 +60,6 @@ <h2><a href="#the-patterns" name="the-patterns">The Patterns</a></h2>
6060
</nav>
6161
</div>
6262
</div>
63-
<footer>&copy; 2009-2014 Robert Nystrom</footer>
63+
<footer>&copy; 2009-2021 Robert Nystrom</footer>
6464
</body>
6565
</html>

0 commit comments

Comments
 (0)