

The Next Mainstream Programming Language: a game developer's perspective - georgecmu
http://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf

======
MichaelGG
I'm pretty sure this is old and well known, but here are some highlights. This
is from the founder of Epic Games, which makes Unreal Engine, which runs tons
of modern games. Thus, it's from someone doing real-world work with high
performance requirements.

Here are some highlights:

\- "Gladly sacrifice 10% perf for 10% higher productivity"

\- "Never use assembly language"

\- 50% of bugs are array indices, null pointers, integer overflow,
uninitialized vars

\- Suggests dependent types to solve array bounds issues

\- 90% of integers are array indices, 80% could be dependently-typed

\- For loops: "40% are functional comprehensions, 50% are functional folds"

\- Gameplay code is hard to make concurrent - thousands of mutable objects,
updated tens of times per second, each update touches many other objects

\- Suggests transactional memory: 2-4X perf overhead is acceptable if code can
scale to many threads

\- "Garbage collection should be the only option"

\- "Syntax requirement: Must not scare away mainstream programmers"

~~~
iman
This question has been bugging me in my mind ever since I first saw this
presentation back in 2005:

What integer value in a game gets so big that it can potentially overflow a 64
bit integer?

I've literally been thinking about this question for years and I can't think
of a single case. Bignums are pretty much only used in scientific computations
and the only thing in a game that would come close to this would be
encryption, in which case the programmers would know what they are doing and
wouldn't mistakenly used fixed size integers.

(Of course back in the day integer overflow bugs in games were everywhere, one
awesome example being level number 256 in pacman)

~~~
orangecat
_What integer value in a game gets so big that it can potentially overflow a
64 bit integer?_

2^64 meters is only around 1900 lightyears, which is woefully insufficient for
a galaxy-scale RTS.

~~~
zach
But a game that uses integer meters for coordinates has galaxy-scale problems
of another kind.

~~~
stcredzero
I've tried to write a space game, and let me tell you, 32 bit floating point
is _woefully_ inadequate. Unfortunately, most 3D hardware at the time was
built around 32 bit floats. Those only give you about 1 in 100,000 resolution.
I had to create scaled-down "billboards" for nearby celestial objects and park
them 1000's of kilometers away. (When they were actually 10's or 100's of
kilometers away.)

Even 64 bits wouldn't allow for a naive implementation of a realistically
scaled space game. There would still have to be a lot of optimization tricks
played.

EDIT: I realize that the parents posts are talking about Integers, but you
can't send those directly to the GPU!

------
zbanks
Was I the only one surprised by the Haskell praise? Sure, I love Haskell, but
I didn't realize it catered so well to game developer.

He _does_ point out a few of the downfalls of Haskell, but there seems to be
some positive element there.

~~~
nash
I thought everyone liked Haskell...

I had assumed the problem was being able to use it when we liked.

------
blasdel
From 2005, so you'll have to add a zero onto the end of stats like _"Current
GPUs are 16-wide to 48-wide!"_

Wonder if this is still true: _"Factoid: C# exposes more than 10 integer-like
data types, none of which are those defined by (Pythagoras, 500BC)."_

~~~
snprbob86
9 primitive types: [http://msdn.microsoft.com/en-
us/library/exx3b86w(VS.100).asp...](http://msdn.microsoft.com/en-
us/library/exx3b86w\(VS.100\).aspx)

System.Numerics.BigInteger: [http://msdn.microsoft.com/en-
us/library/system.numerics.bigi...](http://msdn.microsoft.com/en-
us/library/system.numerics.biginteger.aspx)

I'm sure there are more.

------
kunley
Old but useful -- and nice to read it again from 2010 perspective.

------
mark_l_watson
That was a good (if old) presentation. I worked for a few years in the
entertainment industry (Nintendo U64 and PC games, virtual reality projects
for Disney and SAIC) and it is an experience that I can recommend to any
computer scientist because there are so many interesting problems to solve.
Anyway, if you can take a few years off from whatever career path you are on,
you will enjoy the experience.

------
esad
Off topic, but it always surprises me how someone with all this knowledge can
..well, use Comic Sans for the presentation. While I understand that it's
about games and that Comic Sans is supposed to be perceived as a "fun" font,
this is really an odd choice.

