
How I wrote Game Programming Patterns - munificent
http://journal.stuffwithstuff.com/2014/04/22/zero-to-95688-how-i-wrote-game-programming-patterns/
======
hawkharris
This was a great post. I enjoyed the book, and it's always interesting to hear
about a writer's process. Everyone tackles the big challenge in a different
way.

The only detail I disagree with is the one about telling your friends and
family what you're doing as a way to keep motivated. A few years ago I read a
paper about the psychological effects of talking about goals. [0]

The takeaway was that, for most people, sharing a goal provides a sense of
satisfaction and self-validation. While it is pleasing, the sensation makes us
significantly less likely to accomplish goals such as writing books, losing
weight, etc.

Again, I enjoyed the post very much and don't mean to nitpick. I just think
this is another interesting perspective to consider when you're setting out to
tackle a big goal.

[0] Unfortunately, my memory is failing me, but if anyone knows of the paper -
or an article or paper along these lines - please feel free to contribute.

~~~
shabble
> _Unfortunately, my memory is failing me, but if anyone knows of the paper -
> or an article or paper along these lines - please feel free to contribute_

I believe it's normally referred to as the "Substitution effect", there's a
paper by Gollwitzer _et al_ called "When Intentions go Public"[1] that might
be the one you're thinking of?

[1]
[http://www.psych.nyu.edu/gollwitzer/09_Gollwitzer_Sheeran_Se...](http://www.psych.nyu.edu/gollwitzer/09_Gollwitzer_Sheeran_Seifert_Michalski_When_Intentions_.pdf)

------
michael_nielsen
Awesome post. I'm finishing my third book, and totally recognize the agonizing
over whether the book will ever get done!

On not using a conventional publisher: my first two books were with mainstream
publishers (Cambridge University Press and Princeton University Press). For my
third book I decided to self-publish online only, because that makes it
possible to integrate animations, interactive Javascript, and so on. Four
publishers have asked about publishing paper editions of the book, but it's
hard to imagine going back to the printed page as the primary target medium.
Having the web as the primary target is so much more powerful.

~~~
jmount
Michael Nielsen as in "Quantum Computing and Quantum Information"? If so great
book.

~~~
michael_nielsen
Thanks!

~~~
mjburgess
I'm just replying to you so I can say to people that I've replied to you :)

Nielsen & Chuang is one of the bibles of my universities physics dept.!

------
jarrett
For anyone wondering about the book itself: It covers a lot of very practical,
nuts-and-bolts challenges in structuring a game's codebase. It doesn't succumb
to the temptation of architecture astronautics.[1] It's more like, "I'm about
to type out a class that handles keyboard input. How should I write it?" For
that reason, I found it to be one of the most helpful references on game
programming I've yet discovered.

[1]
[http://www.joelonsoftware.com/articles/fog0000000018.html](http://www.joelonsoftware.com/articles/fog0000000018.html)

------
mandlar
This was a fantastic read! Congratulations on finishing your book.

Ever since John Resig wrote about Write Code Every Day [1], I've fallen into
the habit of writing some code on a new side project of mine. Every day, at
least 30 minutes of work. Not saving up things to do for the weekend makes it
a lot less stressful and has increased my productivity significantly. And
whatever I've been working on is constantly on my mind instead of put aside
until the weekend or some other period of free time. I'm definitely reaping
the benefits of not "breaking the chain."

[1] [http://ejohn.org/blog/write-code-every-day/](http://ejohn.org/blog/write-
code-every-day/)

------
backwardm
Thanks for taking the time to write this post. It was incredibly motivating to
me. A weird side effect is that I now have a scanner in my Amazon shopping
cart. Once it arrives, I will start a chain where I doodle something every
day, scan it and post it online. I am going to read your book so I can learn
more about programming patterns in general—I'm not so interested in
programming games yet. Reading the first few chapters, I can tell I'm going to
learn a lot.

Also, you can put your own animal drawing on your cover now—and you get to
choose which animal!

I'm looking forward to reading new posts about how you need to call your bank
every few days to make more room in your account due to all the book sales.
Congratulations on getting to done.

~~~
munificent
> It was incredibly motivating to me. A weird side effect is that I now have a
> scanner in my Amazon shopping cart. Once it arrives, I will start a chain
> where I doodle something every day, scan it and post it online.

This is awesome!

I used to draw (hence the hand-drawn illustrations in the book), but it's one
of the many hobbies that didn't make the cut after I had kids. As someone who
spends way too much time staring at a screen, there's something really
therapeutic about actually working with my hands in an analog medium.

~~~
backwardm
I started out as a graphic designer as well, then gradually moved into
programming. I have four kids (evenly spaced between 2 and 11), so I know how
you feel about extra time for fun hobbies like drawing. (we are a few weeks
away from our first dog too.)

Your post reminded me that I shouldn't be spending all of my time in code
working on client projects. Yes, it pays the bills, but I should (need to) do
a little drawing each day to keep that part of me alive. It's not as big as
writing a book, but it will be fun to see how long I can keep the chain going.

I also agree with your comment about screens vs. paper—I have one of those
fancy Wacom drawing tablets, but it doesn't come close to the feel of a nice
sharp 4H pencil or Pilot v5 pen on copy paper.

Thanks again for the inspiration.

------
protonfish
I had been wondering if writing a book on GitHub in markdown was a legitimate
idea or just based on my inexperience with other writing tools. I still don't
know, but the author's work has convinced me that's how I want to do my next
writing project.

~~~
munificent
Yes, I really loved the workflow I ended up with. Putting it on GitHub has
been hugely helpful. I merged four pull requests and closed twenty bugs this
morning. How awesome is that?

~~~
protonfish
It really is wonderful to work on documents with git and markdown is the
perfect pairing of text format. There seems to be a huge opportunity waiting
for someone to make a GitHub marketed to non-techie writers.

~~~
bowerbird
if you already know git (or github), it'll work for books.

but i doubt it's the best change-tracking system for them.

too much irrelevant crap, and it doesn't cut to the heart of those things that
actually need to be done for a book.

plus, most writers will never slog through learning github.

to make a system that is writer-friendly _and_ does what a book-writing
change-tracking system ideally _should_ do, you'd have to hack github so much
that -- in the end -- it would have been order-of-magnitude simpler (and
better) to program a purpose-built system instead, from scratch.

and yes, i told loren this from day one.

he didn't believe me then.

but if you ask him now, i'll bet he won't be quite so sure.

and by the time he's done, i have no doubt he will agree.

yes, writers need a version-control system.

but no, it is most definitely _not_ github.

-bowerbird

~~~
imarg
What you say is interesting, but how much time would he have lost before he
could launch if he had to write a system from scratch?

On the other hand when using something ready like git allowed him to launch
quicker. If he gets traction he can always write a new system later, if not
then he has saved up on a lot of time.

~~~
bowerbird
perhaps you meant penflip's loren, not the original poster?

if so, then yes, what i'm saying exactly is that _loren_ could have saved
himself time and trouble, in the long run, by coding a purpose-built system,
instead of hacking github.

what it would've cost him, however, is the huge "jumpstart" he received by
proclaiming his goal as "github for writers".

the kneejerk response to that, from the tech circles, was something that
created huge word-of-mouth and mind-share, not to mention a great starting
user-base, of technoids.

but that was months ago, and now there's some sense of "whatever happened to
penflip?" and when he goes out to sell the system to writers, the "github"
label will not be a benefit at all. (if anything, it will be a liability; but
i think in general writers are fully unaware of it.)

all of this is my opinion. you, like loren, may disagree.

-bowerbird

------
lukeholder
Wow, this is the best insight into the struggles of writing a book I have
read. I started a book and quit on the first real hurdle. This post really
stirred up something in me - about finishing something for the first time in
my life. Thanks for sharing.

------
n1ghtmare_
This is extremely inspiring. I've been on a streak ever since I read John
Resig's post and your comments about your book. I'll be writing code for my
side project every day, at least 30 mins. I don't know what it is ... But I'm
really freaked out of breaking the chain, it keeps me really motivated. I love
it.

------
jypepin
This book looks really cool and I've always been interested in reading more
about game programming. Is there a way to grab this as a pdf instead of only-
online content?

~~~
munificent
Not yet, I'm working on that now.

~~~
jypepin
awesome thanks for the answer! I subscribe to your ebook mailing list, would
be awesome to have a update about the pdf through that funnel!

~~~
munificent
> I subscribe to your ebook mailing list, would be awesome to have a update
> about the pdf through that funnel!

That's one of the main reasons the list exists. :) The day the books are
ready, you'll know.

------
_pmf_
> The last game I worked on, Henry Hatsworth in the Puzzling Adventure

Ah, you're that guy! I bought HHitPA because I read a reddit post by you
(presumably) about it.

------
niix
Great post and insight. I'm excited to start reading your book.

------
Remnant44
Just wanted to say nice work. I was browsing GPP the other day and I found it
to be a valuable reference, and not just for game programmers.

On a different note, welcome to the Pacific Northwest!

~~~
munificent
Thanks! Moving to Seattle was weird: I felt like it was the place I'd always
wanted to live even though I barely even knew it existed until a few years
ago.

------
robomartin
Reading it now. Thanks for sharing. I have a couple of book projects I've been
pecking away at for a couple of years. This will help.

Please consider changing your site so it can be resized (two finger zoom) when
viewed on an iPad. The font is on the border of being small. I often do my
reading late at night. When tired I find it easier to make pages fill the
screen side-to-side in landscape mode. Thanks.

------
marvy
This is somewhat off-topic, but if the author is still reading these comments:
in the chapter on bytecode, it seems that an obvious alternative was
overlooked. Don't implement your own little language. Take one that's already
there. Lua, Python, JavaScript, there are lots of them! Why not?

~~~
munificent
I think it mentions Lua and a few others. I think the chapter is equally
applicable to those too. It's as much about how to implement _your_ language
as it is about how _those_ languages were implemented.

(In particular, I learned much of what I know about bytecode VMs from Lua's
implementation.)

~~~
marvy
Yes, you mentioned them. But what surprised me is that you never suggested
using them, instead of implementing your own. I understand that sometimes
implementing your own is the way to go, but surely sometimes it makes sense to
just use Lua?

