
What Programming a Game in 48 Hours Taught Me About Programming Games - pertinhower
http://www.jeffwofford.com/?p=1495
======
zeteo
>if I could transfer the pace of production from Ludum Dare into my normal
work, I would complete a game like House of Shadows in less than 2 months

While the article lists many plausible reasons why the pace of work turned out
to be faster on the shorter project, there is also one that is not mentioned
but perhaps the most important: complexity doesn't scale linearly. It's always
faster to write the first 1000 lines of code from scratch than to add 1000
lines to a project that is quite large already, mostly because each newly
added component has a growing chance to interact with an ever increasing
number of older components.

~~~
ha-ha-ha
Hah, very interesting.

On the other hand companies generally put their very best developers on new
products and features - i.e. writing those first 1000 lines. While the
mediocre devs get to extend and maintain those products/features, by copy
paste or what got you.

~~~
leokun
I have never heard of a place where "mediocre devs" get siloed off as a normal
way of operating a business. If you have under-performing engineers you should
change your hiring and think about mentoring or exits for those you have
already.

~~~
fournm
It's more common in enterprise-y settings, since you don't have to pay them as
much. Hire a few senior people to do the heavy lifting and stick all the
maintenance programming stuff on the others.

~~~
leokun
Do they know they are considered mediocre? I think I might change my career if
I ended up like that.

------
jongraehl
The linked [http://strlen.com/java-style-classes-in-c](http://strlen.com/java-
style-classes-in-c) was both horrifying and tantalizing. I'd expected a
preprocessor that generates appropriate .hpp/.cpp, but instead I learned about
yet another corner of C++ I hadn't exactly induced from experience.

~~~
eliasmacpherson
Have a look at juce_amalgamated.cpp in the JUCE library for a real world
example of this. The author of this java style classes article has taken one
extreme view and I have taken another, that no code, inline or otherwise
belongs in a header. Just declarations all the way.

It's remarkable that modifying C++ headers is such a chore that it comes up as
a reason for getting something done in a tiny fraction of the time for a
roughly comparable task.

~~~
Groxx
> _It 's remarkable that modifying C++ headers is such a chore that it comes
> up as a reason for getting something done in a tiny fraction of the time for
> a roughly comparable task._

Couldn't agree more. Though I don't find it all that painful - lots of
editors/IDEs have a 'go to header file' shortcut that makes this take a couple
seconds at worst.

But then I have repeatedly wondered why IDEs don't seem to have a way to
synchronize your cpp changes to your header automatically. Rename function in
.cpp -> automagically rename function in .h. That's all you really want a lot
of the time.

~~~
eliasmacpherson
It's not the editing of the header that's the problem, it's doing the edit
correctly so that the program still builds. I call it include hell.

In addition changing a header file can at times trigger a lengthy build.

Visual Studio and ctags based 'IDE' style features allow you to go to
definitions or declarations fairly easily.

Unless I'm mistaken I think the eclipse CDT for c++ can change/refactor file
and header as you wish for. [1] [2]

[1]
[http://help.eclipse.org/helios/topic/org.eclipse.cdt.doc.use...](http://help.eclipse.org/helios/topic/org.eclipse.cdt.doc.user/tasks/cdt_t_refactoring.htm)

[2] [http://r2.ifs.hsr.ch/cdtrefactoring](http://r2.ifs.hsr.ch/cdtrefactoring)

I'm unaware of anything that can change function prototypes correctly, but
maybe eclipse CDT can do it.

~~~
Groxx
> _In addition changing a header file can at times trigger a lengthy build._

Well yeah, but that's true for doing it by hand too. If it's _that_ slow, you
won't have automatic builds on anyway, and you can usually cancel it if you
need the CPU for some other reason (in which case, again, why do you have
automatic builds on).

And even if it were only a 90% thing, that's a 90% savings. I mean, literally,
if you change the name _alone_ , change the header name. You get immediate
notification that other locations might need changing if/when the build fails.
Similarly for argument order / name (type will probably cause build failures).

But all those build failures would happen _anyway_ if you changed it by hand,
so it's not any different, just faster. Isn't faster the goal here?

~~~
eliasmacpherson
I'm not making a distinction between manually editing and automated editing of
a header file. Both are a PITA.

Changing the header name sounds like a reasonable suggestion, but I don't
think it's a goer with large projects.

The problem with headers is that as soon as you are doing anything beyond
trivial you can get in to a big fight with the compiler, leading to the
following sorts of problems:

[http://stackoverflow.com/questions/12573816/what-is-an-
undef...](http://stackoverflow.com/questions/12573816/what-is-an-undefined-
reference-unresolved-external-symbol-error-and-how-do-i-fix)

When these problems are C++ template related, then you have to remember
exactly what you changed and where because even on the intel compiler, the
compiler isn't really going to tell you what's wrong.

------
jamii
Similarly, Eskil Steenberg talked about building tools for doing simple things
quickly rather than for doing complicated things at all.

[http://www.youtube.com/watch?v=f90R2taD1WQ](http://www.youtube.com/watch?v=f90R2taD1WQ)

His main point is that building a game is no longer about what you can do, but
rather what you can get done.

------
graeme
Does anyone have a reliable system for creating artificial deadlines?

There are no external constraints on my work. When one artificially arises, I
get my best work done, quickly. It doesn't burn me out because a rest comes
afterwards.

I have no idea how to replicate this urgency consistently.

~~~
eitland
The Pomodoro Technique is a winner for quite a few of us.

Also reading up on perfectionism might be interesting (hint: it often doesn't
end with a perfect result but it is always time consuming.) YMMW.

~~~
tehwalrus
The drawback with pomodoro in Programming is Flow - If it takes even 5 minutes
to "ramp up" your brain back into the problem space, then you're throwing away
10 minutes every half hour (and that estimate was highly optimistic) - and
you're doing that _deliberately_.

Much better to eliminate distractions, in my experience (selective site
blocker, headphones with white noise or coffee noise or wordless trance, and
an IDE that never stalls.)

~~~
Bjartr
>IDE that never stalls

Why I hate Eclipse

------
thenomad
As someone who works in another legendarily slow, computer-heavy artform (3D
animation), this was a really fascinating read.

His point about metawork really hit home hard. I'm at the end of a 4-year
project now, and I'd estimate 90% of what I'm doing is what he calls metawork.

The major takeaway I got from it was that I should try doing some 48-hour
projects myself - or perhaps find some 48-hour film competitions to enter -
and see what the results are.

And, of course, write them up as a blog entry.

------
agentultra
If you liked ActionScript but want to get back some performance I would
recommend checking out NME. It looks a lot like ActionScript but outputs C++
(among others) and can be compiled as usual. Not the best, hand-tuned, C++ but
probably good enough for a lot of projects.

~~~
dsirijus
It's OpenFL now, NME being just a native (cpp & neko) part of it.

------
bluedino
>> During Ludum Dare, I remained tightly interfaced with Flash. I was
continually in the midst of the edit -> compile -> test -> edit loop. >> This
was one of the largest reasons for the high pace of production.

I discovered this when I started building game ideas in Javascript instead of
Xcode. I'd have a skeleton pounded out in an hour or two, and I'd add features
in minutes instead of hours. I took a list of things that I though would take
me the weekend, and I completed them in an evening.

------
sanxiyn
"Do not read Hacker News".

~~~
graeme
Sound advice. I blocked it from my laptop. I still get much value from a daily
browse, but it's not a time filler. It grows.

------
polskibus
Can anyone tell me what's "Wouter’s dual-pass C++ class solution for game
objects." ?

~~~
veli_joza
There's link in article:

[http://strlen.com/java-style-classes-in-c](http://strlen.com/java-style-
classes-in-c)

You write all the code for your classes inside header files and include them
inside another class in main.cpp. That way you get around "declare before use"
rule using uncommon feature of C++.

------
Kiro
>I could drag a bitmap into Flash to import it, then place it, position it,
add filters, animate it, and attach the animations to code all in one tight
motion

I want a tool where I can do this but in JavaScript on a canvas.

~~~
ollerac
I haven't really had a chance to play around with it, but have you tried Adobe
Edge Animate?
[http://html.adobe.com/edge/animate/](http://html.adobe.com/edge/animate/)

------
d23
> Intensity of focus. Almost all my waking hours were dedicated to programming
> during the 48 hours of the contest. I even took less sleep. This intensity
> of focus allowed me to maintain contact with the concepts and issues in the
> game so that I was able to remain productive without costly ramp-up and
> ramp-down times.

Makes me wonder if it would make more sense to cram a 40 hour workweek into 3
days instead of 5. I think it'd be more enjoyable as well.

~~~
bartonfink
I'd like the option to do that at times, but I'm not so sure I'd stick with
that pace for good. I get a lot more pleasure out of evenings at home with my
family than I do out of that intensity of focus.

------
kayoone
consider checking out unity which has a very rapid testing flow and should be
even more productive than flash!

------
michaelochurch
Does game programming require C++? Ocaml can be just as performant, and
Clojure might also be a good candidate (high-level functional programming,
potential to get strong performance).

I admit that, for Java, the gain in language expressiveness isn't worth taking
the performance hit, because the former is so minimal. On the other hand,
moving to a truly high-level language with half-decent performance (e.g.
Ocaml, Clojure) might ameliorate the schedule slippages for which that
industry is known.

~~~
moconnor
Just to dispel a common myth: in general, Ocaml _cannot_ be as performant as
C++ today. As far as I'm aware, no Ocaml compiler performs auto-vectorization
of loops, which means no SSE for you, leading to a 3-4x slowdown on last-
generation CPUs and even more on future CPUs. Vectorization is a big deal if
you want to maximize performance.

I do agree, however, that this doesn't make C/C++ necessary for game
programming. That's probably why modern game engines let you write a great
deal of the game logic in a scripting language.

Of course, most C++ code I see - even in language performance benchmarks -
doesn't vectorize either. g++ isn't particularly good at it and most people
don't know how to do it.

~~~
zurn
3-4x game perf differences from CPU code autovectorization sounds way high?
From what I've seen you'd be pretty lucky to average 3x speedups on isolated
vector-friendly loops with hand rolled ASM, translating to much smaller whole
app speedups.

------
diydsp
Epic quote: >The C++ programmer is a deer sniffing the air for the scent of
boots and gunpowder: everything’s an opportunity for gain; everything’s an
opportunity for calamity.

------
roansh
>For the past several years I’ve spent most of my development time with C++11
in Xcode.

C++11 has been around since `past several years'!?

~~~
exDM69
> C++11 has been around since `past several years'!?

Yes, but it used to be called C++0x and the official spec was still in the
works. However, you could actually use most of the features in GCC and some
other compilers years before the spec was out.

