Category Archives: Games

Limbo

Limbo is a game that has been released on Xbox Live Arcade some time ago, but I've only now found time to play it.

It is a very nice game - albeit a bit on the short side: it took me about 5 hours to finish it. But this is the only negative bit I can think of. Everything else about the game is very nice. It is very polished and it's a charm to play. You have to think about the puzzles for some time but the learning curve is okay and there were no unfair bits.

The game is black-and-white only (with shades of gray) and you play a boy that apparently got lost in a forest (that is how it starts) and you want to get out.

The game mechanics are very simple: you can only move around, jump and hold on to things to drag them around (or press buttons, etc). In this regard the game is very similar to Another World (another very good game worth playing).
The puzzles are all phyiscs-based and because of this the aforementioned fairness is achieved: sometimes you just have to think a bit longer how to solve a puzzle but it is always logical.

YouTube Preview Image

The game is somewhat violent because it works using the "learning by dying" principle and if you don't enable the gore filter, you'll see the poor boy being halved, stabbed, squashed,... many times. However, since he is only a black shape, it's okay and won't put you off playing. The game uses many (and only) auto-saves to track your progress and you never feel punished for dying because you'll get another try straightaway without having to replay more than a few seconds.
"learning by dying" works really well (and is also used in Another World): You don't have to worry about a "health bar" or rewind time or...

The difficulty of the game is just right and it gets harder as you progress through the world: you get to use more objects to solve the puzzles or will have to think of new ways to use physics to achieve your goals. However, one annoying bit is that also autosave points get moved further apart even when there is no need for it. This only happens in the last few "chapters" of the game though.

All in all it is very much a game worth playing and a very polished experience - kudos to the developers!

Rotation of Low Order Spherical Harmonics

I'm currently working at university on implementing Light Propagation Volumes. The paper makes extensive use of spherical harmonics while the implementation uses the first two bands.

Below is a visualization of the first 4 bands of the SH basis functions (created using Mayavi):

sh0to3

The first 4 bands of the spherical harmonic basis functions

As you can see the first two bands are 4 functions, so 4 coefficients to store which conveniently fits into one RGBA texture.

One of the main transformations that is performed in the LPV paper is the rotation of the spherical harmonics representation of a clamped cosine lobe (that represents surface lighting) onto a normal vector direction.  It took me a while to figure out, but actually it's quite easy, which is why I write about it :-)

The analytical presentation of the first four base functions is simple:

S_0 \left( x, y, z \right ) = \frac{1}{2 \sqrt{\pi}}
S_1 \left( x, y, z \right ) = - \frac{\sqrt{3}}{2 \sqrt{\pi}} y
S_2 \left( x, y, z \right ) = \frac{\sqrt{3}}{2 \sqrt{\pi}} z
S_3 \left( x, y, z \right ) = - \frac{\sqrt{3}}{2 \sqrt{\pi}} x

To evaluate lighting with SH for some direction v, you first determine the coefficients/weights of the SH basis functions and then sum them up.

 L = \sum_i s_i \, S_i \left( v \right )

Let's assume we know the coefficients  s^z_0, s^z_1, ... of the clamped cosine lobe around the z axis, then we can determine the lighting in direction v for the cosine lobe around the normal n by transforming it into the space where the normal coincides with the z axis (ie rotate n onto the z axis):

 L = \sum_i s^z_i \, S_i \left( R_{n \to z} \, v \right )

where  R_{n \to z} is a rotation matrix that rotates n onto z.

The idea is to expand  S_i \left( R_{n \to z} \, v \right ) and rewrite it in terms of  S_i \left ( v \right ) .

Before doing this, let's first take a look at the coefficients of the clamped cosine lobe:

\begin{align*} 
s^z_0 &=\frac{ \sqrt{ \pi } }{ 2 }\\ 
s^z_1 &= 0\\ 
s^z_2 &= \sqrt\frac{ \pi }{3}\\ 
s^z_3 &= 0\\ 
\end{align*}

The y and x direction are 0 because the cosine lobe is centered isotropic around the z axis:

So let's look at the expanded version of this formula if  r_1^T ,  r_2^T ,  r_3^T are the row vectors of the matrix,
 v=\bigl(\begin{smallmatrix} 
x\\ 
y\\ 
z 
\end{smallmatrix}\bigr) and  R_{n \to z}=\left(\begin{smallmatrix} 
r_1^T\\ 
r_2^T\\ 
r_3^T 
\end{smallmatrix}\right ) , then:

 L = \sum_i s^z_i \, S_i \left( R_{n \to z} \, v \right ) = \sum_i s^z_i \, S_i \left( \left(\begin{smallmatrix} 
r_1^T \, v\\ 
r_2^T \, v\\ 
r_3^T \, v\end{smallmatrix}\right ) \right )
\begin{align*} L &= s^z_0 \, c_0\\ 
&+ s^z_1 \, (-c_1) \, r_2^T \, v \\ 
&+ s^z_2 \, c_1 \, r_3^T \, v\\ 
&+ s^z_3 \, (-c_1) \, r_1^T \, v 
\end{align*}

Since  s^z_1 = 0 and  s^z_3 = 0 :

 L = s^z_0 \, c_0 + s^z_2 \, c_1 \, r_3^T \, v = s^z_0 \, c_0 + s^z_2 \, c_1 \, r_{31} \, x + s^z_2 \, c_1 \, r_{32} \, y + s^z_2 \, c_1 \, r_{33} \, z

  L = s^z_0 \, S_0 \left ( v \right ) - s^z_2 \, r_{32} \, S_1 \left ( v \right )+ s^z_2 \, r_{33} \, S_2 \left ( v \right ) - s^z_2 \, r_{31} \, S_3 \left ( v \right )

Now the question is: what is the third row of  R_{n \to z} ? If we look at the inverse matrix instead:  R_{z \to n} , we can immediately see that its third column has to be n, because  R_{z \to n} \, \bigl(\begin{smallmatrix} 
0\\ 
0\\ 
1 
\end{smallmatrix}\bigr) = n by construction. Since rotations are orthogonal matrices, the inverse is the same as the transposed, so we can deduce that the third row of  R_{n \to z} is the same as the third column of  R_{z \to n} ,  that is: n. Thus with  n = \bigl(\begin{smallmatrix} 
n_x\\ 
n_y\\ 
n_z 
\end{smallmatrix}\bigr) we get:

  L = s^z_0 \, S_0 \left ( v \right ) - s^z_2 \, n_y \, S_1 \left (  v \right )+ s^z_2 \, n_z \, S_2 \left ( v \right ) - s^z_2 \, n_x  \, S_3 \left ( v \right )

So the SH coefficients of the clamped cosine lobe along n are:

 
s^n_0 = s^z_0 = \frac{ \sqrt{ \pi } }{ 2 } \\ 
s^n_1 = - s^z_2 \, n_y =  -\sqrt{ \frac{ \pi }{3} } \, n_y \\ 
s^n_2 = s^z_2 \, n_z = \sqrt{\frac{ \pi }{3} } \, n_z \\ 
s^n_1 = - s^z_2 \, n_x = - \sqrt{\frac{ \pi }{3}} \, n_x

This is it :-)

Cheers,
Andreas

PS: a few screenshots from the LPV project:

GPUPropCopy 0616
noLPV
LPV32P128C

noLPV_2LPV32P128C_2

Sploidz Revisited (Unofficially)

I've already written about the semi-conductor project and how I've written some Flash animations/applications for it. Of course, I'm more interested in making fun stuff´, so I decided to put my knowledge to good use and write a small game to see how difficult/awkward Flash actually is.

To sum it up, it is somewhat awkward, at least if you use the IDE itself. FlashDevelop still is as nice as ever, but you can quickly develop games nonetheless. I prefer Torque Game Builder though in retrospect.

Before I continue talking about the development itself, let's take a look at the actual game. Sploidz was the first game I wrote using Torque Game Builder for Joshua Dallman, and since I still had all the assets in my subversion repository, it was an easy decision to try and port this game. If you want to play it, you can download it for free here.
I haven't ported everything: I've just rewritten the main characteristic features that make up Sploidz's code in ActionScript.

Without further ado´ here is the game:

Click to open Sploidz in its own window

Because the art is still copyrighted and I haven't heard back from Joshua yet ´, I decided to create a free version that only uses "coder art" - in this hand-drawn coder art :-)

Some´ have said that this version looks cuter, decide for yourself:

Click to open SploidzCC in its own window

Below you'll find a description of the development and at least one helpful trick and most importantly a link to the source code of the "copyright-free" version.

Because the orginal version is way too difficult to be really fun, I actually sat down one more time and added code to make the platform slower if you're in danger of losing (up to 3 times slower):

Click to open SploidzMoreFun in its own window

Read more »

Fast Forward

I've quite a few things I've wanted to write about a long time ago and I actually started working on them and taking notes, etc. but never found time for one reason or another to write and publish the actual posts.
So this is meant as fast forward of all these text bits.

Movies and Games

Memento

One awesome movie. I've seen it twice already and I still love the movie and its plot. I don't want to spoil too much of the story, but some will probably inevitable.

A few bullet points:

  • Telling a story in reverse is pretty cool in itself and perfect for the movie
  • I wonder if one could use this kind of plot for a game, too, but it would make the plot quite linear because the player could only do things that won't change the outcome of the future (i.e. what he has already played).
  • If the game is linear though and goal based it could be possible easily because you would replay it like a movie. If it's plot-centric, it could be fun and create a kind of suspense similar to Memento.
  • Fahrenheit would be a game that is plot-centric like that..
  • The movie depicts a chaotic system: small imprecision leads to huge consequences ("Don't believe his lies").
  • One of the impressions I liked most is the way you have to constantly reevaluate everything you have seen so far because of some new piece of information from the past which totally changes the whole movie a whole time.
  • It's kind of difficult to remember the movie at first because the human brain is not used to this presentation of causality (seeing the effect before the cause).
  • The movie gets you thinking about what defines yourself - what are you if you can't remember things anymore and how do you define yourself through your memory.
  • A few weeks ago I read a psychology case book that contained a case similar to Memento. Alcoholics sometimes damage their brain through alcohol abuse and lose all ability to memorize anything new. Their long-term memory only works up until some point of time and after that they won't remember anything. They constantly live at that moment and will be lost forever.

Fahrenheit

Fahrenheit is a pretty cool. Like many movies it is excellent for 90% of the playtime and then it suddenly starts to suck and/or becomes very weird story-wise.

It's not a typical game as more a cinematic experience that does a good job at combining gaming aspects with a very advanced plot and some pretty awesome action scenes.

I've really enjoyed the game and just like Omikron: The Nomad Soul (an earlier game by developer Quantic Dream) it's positively refreshing and different.

Some random notes:

  • Vista compatibility sucks. I had to download a hacked binary to make it start at all on Vista. Otherwise it ran fine except for one crash that was due to my notebook overheating slightly.
  • Like in many other games you can't skip cut scenes or dialogs easily which is annoying if you just want to replay a chapter up to a certain point
  • More annoyingly it seems that if you replay an earlier chapter, you have to replay the ones following it, too. Be careful with that :-|
  • As said - the story is awesome until you have played 90% of the game then it turns a bit into being on the bizarre side of things´.
  • Also "Hiding at Tiffany's" is awful. If you ever play the game be ready to replay it a few times:
    You have to hide at Tiffany's place from someone who is searching for, and you have 30 seconds or so to find a hiding place, after which the person starts searching for.
    The problem is that you don't know where the person will search for you and if you are caught, you obviously won't see where he would search afterwards, so you have to replay the same part quite a few times if you have bad lack and I think it was one of the more frustrating parts.
  • Zero Punctuation has a good review of the story issue of Fahrenheit hidden in his review of Condemned 2, it is also funny, so it's certainly worth watching :)
  • The way the controls work in Fahrenheit is also pretty interesting. The wikipedia article about Fahrenheit has a good description of it in its Gameplay section.

Books

The Pragmatic Programmer

Last year I think I wrote that I had started reading "The Pragmatic Programmer". I actually finished reading it quite a while ago, but here are a few remarks about it:

  • It's a good and nice read and the book contains lots of helpful suggestions and things to keep in mind when coding or designing software or even just when you want to communicate with co-workers, etc.
  • It's a "common sense" book - similar to Code Complete - and when you read it, you'll often think "that's straight-forward" or "that's the logical thing to do", but it still valuable to have all that common sense written down somewhere and to be able to look at it now and then in search for inspiration.
  • It's not as useful as Code Complete though, which was a real eye opener (and still is) and it's not going to improve your coding style a lot or the way to think about code design.

OpenGL Superbible

I've bought the "OpenGL Superbible" and it's a pretty good book if you want to learn OpenGL or read a light text about certain advanced OpenGL features before rolling up your sleeves and digging around in the extension specs. It's written like a big and pretty complete tutorial and the latest edition is a lot better suited for the new features than, say, the latest edition of the OpenGL Programming Guide (which is pretty horrible - I've read through the sixth edition and it's pretty much the second edition plus a paragraph tacked on here and there and long explanations of deprecated features).

The only part of the book that is really, really weak and totally useless is the part about GLSL and shader programming. It contains a short description about GLSL and while the chapter summary mentions functions like glUniform and co, the function is not mentioned anywhere in the chapter nor does it provide even one example on how to set or access vertex attributes or uniforms, which is essential.

If you want to learn about GLSL and shader programming in OpenGL I can only recommend the OpenGL Shading Language and the GLSL language specifications.

Multi-Core Programming

First don't buy this book. It's from Intel Press (you can read the book description here) and it's ridiculously expensive for the content it provides.

I got it for free at university presentation from Intel and have read through most of it in the last weeks and really - if you want to learn about OpenMP and threading techniques and tools, there are better sources available online for free.

Real-Time Rendering

This book on the other hand is awesome - buy it if you are interested in computer graphics and want to understand the underlying principles better.
It's well-written and presents lots of advanced computer graphics topics in a very understandable way. Especially the chapters about local and global illumination and the physical base of them are very good. It is good starting point to look for resources and papers and the book's homepage is also pretty useful: http://realtimerendering.com/.

Crysis notes - random

Last week I had the joy of playing and beating Crysis (you'll find out later why I emphasize that I beat it). While playing I took some notes, which I want to share with you (some might be funny facts, others might show why Crysis sucks and others could be proof for some awesomeness that you can - still? - find in the game).

First off though, this is going to contain lots and lots of spoilers, so just lemme put up a

SPOILER ALERT

sign before continuing.

Read more »

Halo: Combat Evolved

Yay, I've finally found time to play through Halo 1 for the PC. To be honest I didn't even know that I owned the game a few days ago, but when I looked through one of my drawers, I found it together with Supreme Commander and GTA: San Andreas \o/

To make playing it look like work or at least like something worthier than just playing, I've taken notes occasionally and here they are:

  • The vehicles are very easy to steer: they always automatically try to drive towards your current view direction and you only use forward and backward to accelerate and slow down. I was used to ETQW's steering system and it took me some time to get used to, but it's pretty ok for the game.
  • I like to use my rifle as club. For the first half of the game I had a really closed-combat fighting style: start shooting while running on and when you need to reload or simply are near enough, hit the enemies with your gun before jumping to cover. It was very effective against Grunts and against Elites, too, since my timing was right most of the times and I was there, when their shield broke down.
    The ability to throw grenades and shooting at the same time (pretty much) also increased combat speed a lot and made everything more fluid, because I was able to react to everything always in an effective way.
    The Flood was pretty scary at first, because I had to learn a totally different combat technique and after getting used to it during the first few hours, I took me a bit to keep my distance again. After getting the shotgun and surviving the Library level fighting against the Flood became fun or at worst slightly boring and annoying, though I still have to watch out to prevent myself from becoming surrounded.
    I think, it is a pretty neat idea to make the Flood monsters get up again after being shot for the first time. It facilitates being surrounded and increases the risk of being overrun.
  • Level design is pretty weird sometimes. And with weird I mean repetitive - just look at the Library level to see the beauty of copy'n'paste. The last level, where you have to drive the buggy through a weird obstacle course that makes no sense whatsoever is pretty awkward, too - the buggy is a bit to wide to be driven through everything elegantly using the controls and I got stuck all the time. Moreover the buggy is too slow for all the little ramps you can find and I was left wondering why they put them there (maybe the buggy's speed was changed after the level was designed?)
  • I don't like checkpoints. Especially when they're used to tune the game difficulty by spreading them lighter in later levels >_<

So far, so good. I like Halo a lot and although some levels seemed a bit stretched (Library again), playing it was fun. I don't know, what I'm going to play next, but I think that maybe I should spend some of my time coding again - nah, just joking, next I'm going to play Call of Duty or more Sam & Max...

Cheers,
Black

Mirror's Edge

Mirror's Edge is one awesome game.
There is hardly any information out about the game yet and the official homepage is lacking but if you're interested, there is at least one good fansite (I haven't checked for others yet) and a few trailers that really make me want to see more (or work for DICE - you decide..).

Check out the trailers:

YouTube Preview Image
YouTube Preview Image
YouTube Preview Image
YouTube Preview Image

If you're interested in some additional thoughts, please continue and read on:

Read more »