The Internet and Social Justice

So yeah, been an interesting few days. Well, “interesting” is not really the word. “Bloody scary” is probably closer to the mark.

I refer, of course, to the whole Social Justice Warrior scene between Zoe Quinn and her ex boyfriend.

To recap, her ex – Eron Gjoni – put up a blog where he basically accused her of sleeping around, while making sure he knew of her feelings on infidelity. This then got picked up by 4Chan and Reddit, who made it out to be more than it was – a simple case of loose morality and bad judgement on her part – and made it into “Game dev sleeps with journo to get coverage”. Which it wasn’t and never was, as Eron himself pointed out.

But then, the avalanche of social warriors, who are fearless behind their anon email addresses, start harassing Zoe in unbelievable ways. Those women who come to her defense also get attacked – one even having to leave her home after the death threats.

Now, lots of people have had a lot to say about this – mostly picking sides. Some are all about the fact that Zoe invited this on herself, behaving as she did. Some are all about the over reaction of the internet based social warrior, who appears to be consist of mostly white guys who are deeply misogynistic and have anger issues.

I have my own thoughts, and I’m going to get them out here.

Firstly, this is not about “Slut Shaming” as some people describe it. Lets deal with this. Firstly, the word Slut is bullshit. It means nothing. It’s a derogatory term for a woman who sleeps around. The word for that for men is “Stud”. It’s a double standard that is horseshit. Women are looked down on because they sleep around, while men are venerated for it. It’s just so apparent crap, yet it perpetuates itself. The least said about this the better. We can all just agree it’s shit and move on. So lets remove the word Slut from this.

When Eron did was “Hypocrisy shaming”. Zoes behavior was, at best, hypocritical. Lets be clear on that too. She made great capital about fidelity, then didn’t live up to those statements. That’s at best hypocritical and at worst, extremely damaging to your significant other – to the point where the relationship fails, as is the case here.

Now I don’t really want to harp on about morality and/or sleeping around, suffice to say, whatever a relationship is between two people, it’s up to them and no one else. Common western civilization dictates that a relationship between two people that is romantic tends to be monogamous. That’s the default state, as agreed by pretty much everyone out there. It’s what we are brought up with and defined as. Now that doesn’t make it right at all – just what you would reasonably expect of a relationship. Now if two people don’t want to do that, then it’s entirely their decision to alter those parameters and make it whatever they want it to be. They get to define what their relationship actually is, no one else, and more power to them. If they want to open up their relationship, then that’s fine.

But it does take two to tango in that regard. One person cannot do that and expect the other to just go along. Both have to know and agree, or it doesn’t work, as it hasn’t here.

I totally get how Eron feels about this – it’s very apparent in his blog posts. He’s upset, bewildered and probably very angry, and making this behavior public is probably his only recourse here.

I would imagine that he feels he is just making her behavior public, holding it up to the light so others can make their own judgements. Of course it’s rendered in such a way as that he controls the interpretation, but still, I would imagine that’s his mindset.

But.

The fact is, The internet has no middle ground. It just doesn’t. The reaction from anonymous commentators has to been to vilify Zoe, his Ex and to basically eviscerate anyone who disagrees with that analysis. Nasty emails, threats and so on.

What Zoe did was bad, but it in no way justified the backlash she is getting. It’s outrageous. It’s life threatening. It’ll destroy her in ways that she in no way deserves.

But there it is. The crux. The word “Deserve”.

What do we do here? As a society? Her behavior was crap, there’s no real getting around that. But proportionate to this response? Not even remotely. She’d have had to kill people to deserve this reaction. This is just angry boys, who have finally realized that life isn’t like an 80′s romantic comedy, and they aren’t going to get the prom queen to suddenly come to the realization that they are “the one” and are pissed off about it.

It’s made worse because it’s video game related, and by definition, lots of the audience is angry 12 year olds who have too much testosterone and have no outlets to let it out; we’ve done a great job as a civilization removing those, over the past few years, via concerned mothers. So your audience for this starts out being skewed, which just fuels the fire.

There are those who say “She doesn’t deserve to be even mentioned” – which is a valid view point; her behavior was to one person – her significant other – not the rest of us. Why should we be involved in this? It doesn’t effect us?

Others would say it does, because what she does in her personal life apparently spills out in to her professional one. Hypocrisy is hypocrisy, and as such, when it’s discovered, it should be brought out into public. Other wise the behavior goes on. This is the driving force for things like Watergate and Snowden.

The question is, what do we do when the behavior is bad, but the only punishment for it – the unleashing of the Social Justice Warriors is far worse than the crime?

That’s where we are right now. The internet, as it’s structured now, gives these cowards (and I use the word advisedly) a place to strike and hide. Society, as a whole, develops these kinds of people because parents are generally too busy to actually instil some social values in their kids (or, worse still, have a wry smile when it happens). This issue is not about to go away and regrettably, loose groupings of people who oppose it are far outnumbered by those perpetrating it. Or to put it another way, those who do it have already justified it in their minds. Missives like this are not going to change anyone’s core beliefs that it’s their right to vilify people.

So what is the solution? We shouldn’t be hiding this kind of behavior, but equally, the response is too outrageous to even contemplate?

My personal feeling is that what this particular situation has taught us is that we will HAVE to hide this kind of thing. Or at least, not make it public in the way it has been. The internet Beast is just a thing of evil, with a mind of it’s own, and it’s simply too aggressive and too random to be unleashed.

I don’t like it; I feel justice as much as the next person – but I don’t honestly see what alternatives there are.

Thoughts?

Posted in Game Development commentators | Leave a comment

Vertex and Pixel Shader Primer

This is intended for those artists and students who have heard the terms Pixel and Vertex Shader, but aren’t really sure what they do or how they work.

Now this is very high level, and doesn’t get into the specifics too deeply, just because that’s an abyss that definitely looks into you as you look into it.

The idea is to just get the concepts across, rather than go too deep.

So lets get started.

A vertex shader and/or a pixel shader (sometimes called a fragment) shader is a very small, self contained program, that runs on the actual graphics card – using the graphics card GPU and not the main device CPU, that manipulates vertices and then, at a lower level, the actual pixel being rendered.

Complicated eh? Yeah, that doesn’t really explain it very well. So, assuming you have _some_ degree of understanding of how 3D models get transformed, what you are doing in the vertex shader is doing the 3D math that takes a normal 3D models vertices, and then applies all the complex 3D math of moving it in space, rotating  and doing other things, like animation, to each vertex of the model.

So, for example, if you have a 3d model of a cube, it has eight vertices, one for each corner.

On the Graphics card, it’s going to run the vertex shader 8 times – once for each vertex. You have to feed the vertex program stuff like the transformation matrix and the 3d->2d matrix, and then the vertex shader itself does the work for you – all on the graphics card and not taking up precious main CPU resources.

Once each vertex has been transformed into a screen coordinate set, the graphics card now knows exactly what pixels on screen are being drawn. It knows that it’s drawing a flat triangle between points x1,y1, and x2, y2 and then x3, y3. So from that it does what is called a raster scan – ie lines usually from left to right on screen, for each line the triangle covers for each pixel in that triangle.

And here’s where it gets clever – for each pixel it’s rendering, it calls the pixel shader. At the vertex level, you are doing 3D math on vertices that make up a model. At the pixel shader level you are doing color math on individual pixels.

So, the GPU does the vertex shaders first, to transform all the 3D vertices into final 2D screen positions – discarding polygons that are back facing once the 3D model has been transformed – then it does the pixel shaders – one for each pixel it’s rendering on this specific render call.

As an aside, shaders are generally written in straight C, and do have some helpful functions built in you can call – like dot product, cross product, sin, cos, arc etc and other helpful math features. But generally, you write the code to do the math yourself.

Generally you package up vertex and pixel shaders up together – in OpenGL for example, you feed OpenGL the ascii code for each shader type, let the OpenGL driver actually compile it to machine language the GPU will understand, then you tie the two together inside the OpenGL Drive, so when you say “Please render this object” and feed it the vertex array and Texture coordinates, the GPU knows “I should use this vertex shader and this pixel shader to attempt to draw this thing”.

So, basically, for each object you want to render – each combination of texture, vertices, stuff-you-want-to-do-to-move-the-object – you have to specify to OpenGL which vertex / pixel shader combination you want it use on the graphics card to actually render that set of data. You can have lots of these small programs loaded into the graphics card at once, at run time you are just picking which set you want to use for any given render call.

Now, there are some other interesting aspects. For example, you can actually pass in variables to these little graphics card programs – you can set up variable types in the programs themselves, and then, at render time, for each rendered model, send the programs different sets of variables. Kinda of like how you can use command line arguments to send to a command line program.

So, you could send in a different set of lights for each model being rendered; in fact, most systems already do this. Why? To explain that, we need to go into what pixel shaders can do in a little more detail.

A pixel shader defines the final color value of each pixel being rendered for the current model being displayed. So the pixel shader is called once for every pixel rendered in that model.

Now these things aren’t free. The GPU is now doing logic processing for every pixel rendered. The more logic you want to do – for example, the more lights you want to have falling on that pixel being rendered, – the more time each pixel takes to render. And the GPU only has so much time to go around. Oh, it has a hell of a lot of time; GPU’s are VERY quick – but the more pixels you want to render, and the higher the resolution you want to render it at, the more time it takes. You can only paint the screen so many times before you run out of GPU time because each pixel is taking a while to process.

It’s for this reason that lots of systems have different types of lights affecting different parts of the scene – you might have expensive pixel shaders for character models, and way less expensive ones for the environment. Even then, the characters – when being rendered – will often only take the 4 or 6 closets lights as program variables because a) doing more than 6 lights is too cost prohibitive in GPU time and b) because there’s a limit to how much data you can actually send a pixel shader from the main program per call.

Interestingly, the pixel shader is not responsible for certain hardware type operations – alpha blending, for example, is still handled at the purely hardware level. You do not, in a pixel shader, sample the screen and then mix that into the resulting pixel color value to make alpha blending work. It’s still purely hardware that does that.

The pixel shader can see textures though – the simplest pixel shader simply samples the texture passed in to the render call, at the appropriate spot for each pixel being rendered (fed into the pixel shader by the hardware in the graphics card)  inside the texture, and then presents that to the end of the shader, which is the value that is then passed to the hardware to be written to the screen.

Another interesting fact is that pixel shaders – by and large, and certainly in OpenGL – cannot see the screen. They can only write to the screen, not read them.

So how to do clever effects like screen ripples, or heat haze? Where you are not rendering actual data to the screen, just affecting what is already there?

Well, in OpenGL, the solution is to never actually render to the screen in the first place. You render to a texture instead, then that screen texture can be passed in as a parameter to a pixel shader, so it is effectively writing to itself. Then, as a very last step, the entire screen textureis actually rendered to the real screen, so you can see the results.

So to do a small ripple effect, you’d start off by asking openGL for a new texture, but in a special way, so OpenGL knows you aren’t going to be feeding it texture data – it just creates the space for that texture internally, but doesn’t try and copy a loaded texture into it. Every time you render something, you point OpenGL at this texture as the destination, rather than the screen, then render normally, as you would if you were rendering to the screen, then when you are done, you render another quad over where you want the ripple to happen, pass in the screen texture as the source, and have the actual pixel shader do some cleverness about where it’s reading from the original texture, thereby writing over itself with itself as the source.

There are many clever things you can do with shaders – mix multiple textures together, pass in lights so you can calculate how light or dark a particular pixel should be – even generate color values on the fly without using textures at all.

The math can often get quite intense – lots of stuff has to be worked out per pixel in the shader and quite often what you have to work from in the first place is not a lot, so everything has to be regenerated per pixel. But the results can often be very impressive – and at no cost to the main CPU which can then go off and do other, more important things, instead.

Hope this is helpful.

Posted in Uncategorized | Leave a comment

Indies != AAA developers.

So I just read this article about why developers go from AAA to Indie, but not the other way around.

You can read it here. http://venturebeat.com/2014/07/18/why-triple-a-devs-are-going-indie-and-why-indie-arent-going-triple-a/view-all/

I think that as far as it goes, it’s on the money, but I don’t think it really covers some of the real reasons.

The reality is that publishers like Activision and EA are FAR more risk averse than their Hollywood counterparts. They are far more market research driven than Hollywood will ever be. Given that, they will never give the creative control necessary for someone like Cliff B. to persue exactly the game he wants to make.

Nor will a lot of the current Indie Auteurs out there – people like Phil Fish or Jonathan Blow – be given that opportunity due the incredibly bad professionalism they project. It’s an unspoken truism that the reality is that Ubisoft is never going to give Phil Fish a multi-million dollar budget and just say “run with it” because he’s inherently uncontrollable. More to the point, he’s a loose cannon and so are most of the indies out there.

Again, as something most people won’t or can’t say – the reason a lot of them are indies in the first place is not some love of the indie lifestyle – no one enjoys eating Ramen Noodles day in day out – but because quite a lot are inherently unemployable anywhere else. Most are unmanageable, have ego’s beyond belief and don’t really have the ability they imagine themselves to have. Of course most will deny that if asked – “Oh, I’m far happier being indie” but the reality is that, for a lot of them, they understand at a gut level they would never survive at the AAA level, nor be given the opportunity to do so. If you say you actively don’t want the opportunity, then you can’t be faulted for not being offered it.

Being Indie is a skill set that does not scale. The whole point of being indie is to remain small and not have fifty people reporting to you. It means you are where the rubber meets the road of development, not viewing it from an ivory tower.

Another axis to consider is attention span. Indies, by definition, don’t spend three years on a game, doing the same thing all the time. They generally have an “A.D.D.-by-video-game-standards” attitude, where they want to be finished with what they are doing in six months and then onto the next idea they already had. There’s a lot of Shiny Object syndrome in Indie Development, and I can’t for the life of me decide if that’s good or bad. It’s good because lots of new things are constantly being tried, which expands the possibility space for what an Indie Game can be, but it’s bad because no one appears to have the discipline to actually polish something to the point where it’s a completed and good looking game.

Now the article does make mention of a couple of things – financial reward and creative control but it makes no mention of risk. It’s worth mentioning that the financial reward aspect is important. When you have to sue Activision for the $35m bonus you were supposed to get – but didn’t -, is it any wonder that most would prefer to have their hands on the purse strings directly? The reality is that for anyone other than the chief designer or Exec producer, there’s little hope of ever taking home “Fuck You” money from a project you’ve built for one of the large publishers. Activision didn’t get the market cap they have now by giving all the money to the team making the games, and nor would they want to. Why give that money to individuals who then have nothing pushing them to continue making those games for you?

In terms of risk, the fact is that for the individual small indie, the amount of risk in failure is usually measured in the impact for four or five people. If you fail at that AAA level, it means the loss of millions of dollars and possibly / probably the loss of a LOT of people’s jobs. People you don’t even know. People who didn’t choose to follow you, but are there because that’s what the company told them to do. That’s a HUGE thing to put on the shoulders of someone who isn’t used to it.

At the Movie level, directors can do that because the fact is that everyone under them knows this is a short term gig and will be moving on regardless; a failure at that level means they were still paid for their time, which everyone understood going in. A failure at the AAA game development level means that people are out of a job, unpaid and looking for a new one, potentially having to move across the country to do it.

Then there’s the other aspect of risk – or more accurately, fear. Fear of failure and ridicule. You can be a very successful at the indie level and still have a lot of failures and still be able to go to GDC and hold your head up high and not have people snickering when you leave the room.

You fail at the AAA level and that’s all you have to look forward to. The more of a personality you are, the more that’s likely to happen. Just ask George Broussard or John Romero about how that feels. The fact is that lots of Indie developers wouldn’t have the skill set or the desire and would be far to scared to take on a AAA team. They don’t have the team management skills, nor the ability to either inspire or pass on their game vision to the entire team, and they aren’t used to the concept of even having to try.

Lastly, there are dependency problems that Indies have with AAA developers. With AAA development, there are a TON of failure points, and often, as a AAA developer (even at the Exec Prod level), there are outside influences that you simply cannot affect. Marketing, for example. They decide the campaign they want to do, and you just have to sit there and watch. A bad campaign can be disastrous for a game that one hundred people have sweated blood for two years, and there is nothing you can do about it. AAA development has a lot more moving parts than a small indie game, and for an indie – who is used to handling marketing (in as far as they talk to the editors of all the gaming websites directly), having to outsource that to a group you have zero control over is a shock.

For the record, I’ve done both, and it’s definitely a different skill set for indie from AAA development. As someone who wants to be more self sufficient, not less, then Indie is definitely more towards my sensibilities. But everyone is different. There are definitely some Indie developers I know who could handle AAA – Robomodo is a case in point. They’ve handled some very large Tony Hawk projects for Activision-  and they are ready for it in terms of executive and corporate culture.

But the majority of indies who could handle it will almost certainly never get the chance, because their mentality is not indie enough to actually have the kind of success you need at the indie level to get noticed and move up. Indie is all punk rock, ignoring axis because you don’t have the bandwidth (e.g. Pure single player because you don’t have the programming ability to handle multi-player etc) and AAA development is trying to do everything right because so many other parts are dependent on it all working as a whole.

The fact is, there is a reason why Indies aren’t moving to the major leagues, and it’s because the things that make them successful at the indie level would NOT translate to success at the AAA level. And I think most indies, consciously or unconsciously, recognize that.

Posted in Game Development, Game Development commentators | Leave a comment

Interviewing Programmers – what every engineer should know.

I’ve been in a fair few interviews in my time, that’s for sure. Some good, some bad, some horrific. Sometimes that horrific situation has been my fault, and sometimes it’s been the interviewing party.

Anyway, over the years, I’ve learned what I like and what I dislike in a technical interview, and I thought I’d share some these thoughts. As a jobbing engineer, I like to think I’m kind of everyman. I have some math – I understand trig and all the rest of it, but I don’t spend that much time thinking about Big O notation (for a good reason – I wait for the profiler to tell me I’m spending too much time in a function before I worry about it’s speed) or stuff like that.

This is a long post – a big wall of text -, but hopefully it’s worth it.

Obviously some of this stuff is wish list and in some situations isn’t possible – preparation, for example, can only happen if you are forewarned. But most people are, and still don’t do it and it just smacks of disrespect.

General Observations

1) Prepare. Don’t walk into an interview without having looked at the resume of the person, and at least looked at the websites of places he’s worked. If there are things to see – a blog, a set of lecture notes, whatever, then look at them. From the interviewee position, there is nothing worse than the guy you need to impress rolling into the interview and desperately looking at a resume that it’s obvious he’s never even seen before.

Far too many interviews are basically just the interviewer reading a resume and groping for questions to ask about each of the jobs you’ve had. It smacks of disrespect, and that’s a killer in terms of the person trying to get the job actually wanting it.

2) Have some questions prepared. And I don’t mean of the technical variety, I mean of “Who are you?” variety. You are likely to be working in close proximity to this person – and may even be working with them directly – and as such, you need to understand if this person is someone you can work with. Whether they are likely to arrive stoned, or drunk. Whether they have flash points regarding C++ Code notation layout. Whether they are going to drone on and one about the band Gwar etc.
Basically, everyone need to get a handle on cultural fit for the individual, way beyond the root question of “Can they do the job?”

Some companies break interviews down into separating out different parts – person A does technical acumen, person B does cultural fit. This is not a good approach. What it does is concentrate all of the potential elements that go towards a “yes” answer in one persons hands. If one person doesn’t like that the interviewee doesn’t know dot product, he’s now in a position to completely torpedo that application, regardless of what everyone else thinks.

Now obviously not everyone can do technical acumen – you need to be an engineer to judge that – but everyone can ask some questions about what the candidate is into, what they like to do on their own time, what their favorite repository is, biggest mistake they’ve ever made and why they thought it was, and what they’d do about it now etc. Questions that talk to what that candidate is – or at least thinks they are – rather than just “Can you tell me the code for Dot Product?”

NOTE: Be careful that your personal questions aren’t too personal. Run them by other people (or HR) first, just to be sure you aren’t contravening a law when you ask about the candidates family (in actual fact, that’s a no no anyway).

3) Do some of your technical questioning before the person comes into the office. By the time they get to the office – and are taking up resources time to sit and talk to them – you should already be fairly confident they can do the job from a technical point of view. Make them do a test – and don’t ever do that test while they are in the office. That’s just wasting everyone’s time. The fact is, you’ll probably get one day to determine if this person is going to fit into your team. One day. So the last thing you want to do is waste  it, putting that individual in a room by themselves, while they knaw on a pencil trying to remember the syntax for using STL.

It’s also worth pointing out that tests like this are entirely artificial. The fact is, if you employ them, they are not going to be working like this day in day out. They aren’t going to be standing and writing code on a grease board in front of three board mid level engineers. They’ll be looking stuff up on the internet, trying stuff, refactoring it and so on. The only thing that on site tests really tell you about a candidate is whether or not they do well in high stress situations where you’ve got a bunch of other engineers standing watching you and judging you, and where you can’t look up stuff. If that’s how your company operates as a norm, then you’ve probably got more problems than worrying about how your interviews go.

4) Your technical questions are not a competition, nor are they an excuse to hand out “Find me a pebble” questions.

I’ve had situations where I’ve walked into the interview and it’s become instantly obvious that the person on the other side of the table has their own self worth issues and needs to prove some degree of mastery over me instantly in order that they dominate in some way. I literally had one guy correct the very first thing I said – where I was being generic – and I just looked at him. In that instant I knew I wouldn’t take the job even if I was offered it, if it meant working with this guy. Any human who feels the need to establish a pecking order in the first sentence is not someone I want to work for/with.

Also, when it comes to technical questions, a lot of engineers either have their own pet questions to ask – where in reality what they want to know is “do you think like me?” They have a question that can have many answers and they have a favorite answer and if you don’t get it, well, you’ve failed. The reality is you haven’t read their mind or come to the same conclusion they would have, ergo you aren’t as good as them.

The bottom line is, I probably know as many really-hard-to-answer questions as you do, and I can ask them back, because my time is valuable too. If all you want to do is establish a pecking order, well, I can do that too, and make you look as stupid as you are set on making me look. Then what?

For many engineers – particular those with fragile egos – interviews are about proving they are better than the candidate (mainly because a lot have a worry that they are not, even though they’ve already got the job) – even more about discovering if the candidate is good in his own right.

The fact is, even if he gives you a different solution, that’s ok too. Explore that. Don’t get frustrated that he hasn’t come to the solution you would. Thinking differently is ok, and will almost certainly get you out of a jam some day, when you can’t see a solution and someone else can.

Also, be sure that your questions can be worked out by the candidate, and don’t require an either “you know it or you don’t” question. Examples of that are asking someone to write an STL vector prototype. If you don’t remember that off the top of your head, then you’ve failed – because there’s no way to work it out. This is why some of the questions from Microsoft in the 90′s were such a hit – asking “How many ping pong balls fit in a 747?” for example, or “How many gas stations are there in Seattle?” – these are all questions where it’s more about working out ways to get an answer than it is about what the answer actually is.
The more a question relies on some esoteric knowledge, the less valuable it is, because what it’s really testing is “Has this candidate come across this before” and not “Can this candidate work it out if he’s not come across this before”, which is what you should want to know.

And while we are on that subject, the more obscure the knowledge you ask for is, the more you as an interviewer look like a prick for asking it – this goes along with with point 1), where I’ve seen a lot of engineers, struggling to retain coder dominance in the interview, resort to more and more weird and specific edge case questions in a way of tripping up an interviewee. And lets not kid ourselves, this is exactly what it is – it’s not “exploring the depth of this candidates knowledge” – it’s a way of the interviewing coder feeling better about himself because he knows some obscure fact that the interviewee does not.

Also, asking for equations sucks. It just does. No one writes equations in code. If you need to know if someone knows the code for line intersection, don’t ask for the equation. Ask them to write the code.

Which leads me on to…

5) Ask for what you want. Don’t be clever and ask a leading question and hope to gently push the individual into what you really want. I had a graphics engineer once ask me for an early box discard algorithm – which is 4 if-then’s and that’s it; can’t get much quicker than that – but he wanted something else. In the end, what he wanted was a binary search algorithm. It took half an hour of me trying to figure out what it was he actually wanted. When I finally worked out what it was, I gave him his binary search algorithm, and then said “Look, if that’s what you wanted, then ask me for it. Don’t make me spend half an hour wondering what it is you want.”

It was done purely for the sake of the engineer in question doing it, and I have to say, it pissed me off no end.

Convoluted and obscure questions just waste everyone’s time and you may think you are clever for asking it; more than likely you are making the candidate roll his eyes internally.

6) Sometimes, knowing what the use you put something to is more important that knowing how it is generated. For example, Dot Product. If an engineer can describe what a dot product is (e.g., it’s the difference of angle between two vectors, described as from -1 to 1.) and give you four or five usage cases for it, that is way more important than being able to write the code from memory.

Some engineers put great stock by remembering formula by rote, and while there is some value to this, again, this is not normal day to day coding situations. If I don’t remember the code for a dot product, I go look it up. I spend some time comprehending what it is, write the code in my way, and forget about it until I need to do it again.
There is an argument that if you remember the source code, you ‘know’ the code, but that’s not actually real. Most coders who remember the source code couldn’t tell you what happens if you feed a dot product two vectors that are *not* normalized. If you can’t do that, then you don’t understand the root math.

Questions like this tend to show up a lot because they are easy to validate – either you know it or you don’t. Questions that really plumb how someone works are far harder – and require a lot more effort on the part of the interviewer – to set up.

The answer “I’d look that up” IS a valid response, even if you are mortally offended that someone doesn’t know the exact same things you do – or worse still, doesn’t associate the same value to it that you do.

7) Understand that your value system – of what’s important or not – is not going to be the same for everyone. Value systems are generated via experience, and by definition, everyone’s experiences are different.

Therefore, quite a lot of people will have very different reactions to what they see based on their experience – and sometimes the situation they are in too. Reacting to finding an incomplete API is very different when you have a deadline to get something done by, and find it’s blocked by this, than it is if you are just perusing the API docs and find something not quite right in it.

The problem with engineers is that they tend to be very black and white in what they believe. Way X is the “one true path” and everything else is just not. Any one who comes at it from a different point of view is therefore wrong, and to be argued with, in order that they see the error of their ways. Missing the point entirely that a) no one is likely to be swayed by your superior knowledge (just pissed off instead) and b) sometimes there is more than one way to skin a cat, and that’s – god forbid – ok.

8) Understand the guy in front of you is sweating, and wondering what it is that you want to hear, and will attempt to give it to you, regardless of the reality of their beliefs.

It’s an unfortunate statement that most people who are interviewing need the job, and therefore will contort themselves to be anything they can discern that you need. If you ask them leading questions, they’ll pick up on it and then try and mold the answers to whatever it is that they think you want.

E.g. “How do you feel about unit tests?” – that’s a leading question, and the right answer here is obviously “They are great, I use them all the time“. And that’s almost certainly the answer you will get, regardless of whether the candidate hates them with a passion or not.

You just aren’t going to get the truth by asking questions like this – that’s the reality here.

It’s taken me 25 years of interviewing to understand that I need to be myself in an interview, and not try and be what the interviewer necessarily wants. If I’m hired, then I’m going to end up being me anyway, and if that’s not what they want or can deal with, then I’m better off knowing that immediately rather than uprooting my family and moving across the world to take this job, and then find out that I’m really not a fit.

I don’t want to give anyone a false impression of me, so I have to be myself. If it’s not a fit then a) either I’m really not a fit or b) the people interviewing me really don’t have a good understanding of what they want. Either way, I’m probably not going to be happy there, and neither are they, so bullet dodged by both parties.

But most people aren’t like that, unfortunately (at least, *I* think it’s unfortunate). They want / need the job too much, so they’ll twist themselves into whatever pretzel they think the interviewer wants and then get the job and have a disastrous time because they are now going to revert to type. Life is too short for that I’m afraid – but most people haven’t gotten to the point of having it happen to them repeatedly, and haven’t learned that lesson.

9) encourage them to ask questions.

And what I mean by that is not “Do you do crunch here?” The point I am trying to make is that they have as much right to test your technical acumen as you have to test yours.

A lot of engineers don’t get that an interview is a two way street. They think “Hey, you are trying to get a job here. You have to impress me and not the other way around. I’m the one asking the questions.” Well, I’ve taken two jobs in my life where I’ve not done a technical due diligence on whether the people I am going to work with can actually get the job done, and in one case, it resulted in me getting stuck in Arizona for five years (and counting). Sure, I want to ask you about your technical abilities, what your development process is, how you QA stuff, what some of the biggest hurdles you’ve hit have been. If only to get an idea if some of the experience I have will be helpful.

Some engineers have their noses put out of joint when the candidate starts asking penetrating questions – this is an attitude that needs to be beaten out of people. They have as much right to know that you are going to work well with them as you do to know if they will work with you. The more that right is denied, the more you look bad as a potential employer.

Some thoughts on things that might be helpful.

I heard a story once about an engineer who, in his technical interview, sat down opposite the candidate, and then declared “I am a debugger. There is code that is crashing. It’s supposed to do X, but crashes when we do Y. What do you do?”

The interviewee then asked for more details, and the interviewer said “I’m a debugger. I can’t answer those questions. You can’t ask Visual Studio those questions and get answers – what would you do with Visual Studio?”

Eventually, the interviewee got the hang of it, and started asking things of the debugger that the debugger was able to answer – “What’s the stack trace?”, “What are the local variable values?”, “What does the source code look like?” and so on.

This is an excellent way of assessing how a candidate thinks, but while it’s great, it’s not without it’s problems too. The interviewer has to have all this stuff in memory and be able to reproduce it accurately, based on questions he cannot predict, and that’s difficult. One wrong answer and the candidate might not be able to solve the issue at all.

But, what it does tell you is exactly what the candidate would do – and it’s done in such a way that the candidate is more interested in what is going in in the interview than they are sweating out what they think the interviewer wants to hear.

One of the techniques I use now is to sit with a candidate, and describe a current problem I am having – what I know about the problem space, what the solution needs to provide and then say “Ok, what do we do about this? Lets work together on this.”

The idea is to mirror the experience he’ll actually have if the two of you collaborated on some design or implementation aspect, and get to see what he suggests. See if it’s off the wall, or what you were thinking or if he see’s issues you didn’t.

At root, you are attempting to see what happens in the real world of development at your studio, rather than the mostly artificial situation that an interview really is. How they work, how they think and how they collaborate.

Some great questions I’ve seen in my time include this gem – “Tell me, if I hired you, what would I most regret about that decision in six months time?” It’s a terribly leading question and really puts people on the spot because I guarantee you, they won’t have a prepared answer for that one.

The interesting aspect of that question is not what the actual answer is, it’s generally how long they take in answering it. Too long, and they are trying to find something that’s positive that they think you’ll accept “Oh, I’m too much of a perfectionist”. Or too little, and they are riddled with faults and are very quick to point that out.

Speaking of questions, the questions “Describe your greatest success” questions are interesting, but I’m not sure what they tell you about a candidate vis-a-viz the job in hand? “Describe your greatest failure” questions are more useful, particularly when followed up by the relevant “What would you do to avoid this in future” and “How would you fix that situation now?”

Something else I try and do is relax the candidate a bit. Most are pretty uptight – they need the job and want you to like / respect them. They aren’t at their best in this situation – almost no one is, so its your job to get them to relax.

At some point you need to say to the candidate “Look, there are no right or wrong answers here. There is no answer that is going to get you definitely hired or not hired. We are here to see how you tick and where your technical limits are. It’s not a problem that you have them – everyone does, and it’s all to do with experience. I’m just interested to know where they are. If you don’t know something, that’s ok – you aren’t being judged on that – I’m more interested in how you deal with something when you don’t understand it. It’s more a combination of everything. So relax, lets get some work done!”

Asking their opinion on something – asking why they did something, not in an accusing way but in way that asks them about their experience that brings out their conclusion – will grant you far greater insights into the candidate.

Also, ask them if they have questions and give them time to ask them.

Ask them if they want water or the bathroom. People do need to pee.

Last, remember, while you are giving this person a job and it means you’ll see them every day – which in itself is a big deal – for them it may well mean selling a house and moving a family across or continent, or even country. This is a big fucking deal for them. Please treat it as such.

The bottom line is, have some respect for the people who are sweating bullets in front of you, hoping to god they don’t say something you violently disagree with. Because they have no clue what you expect, what you want to hear or what is going to make you drop that black ball in the sack.

Posted in Game Development | Leave a comment

Good Luck Cliff Bleszinski!

Hey, so my friend Cliff Bleszinski has announced a new games company, and intends to make an FPS. A fairly unsurprising event, to those that know him (and those that don’t, I guess).

Now, I’ve read some pretty vile bile regarding Cliff (and please not, I’m not referring to him as ‘CliffyB’ any more. He wants to be called Cliff – that’s his name – and I would like to respect that. God knows the guy has earned that respect.) and it’s pissing me off a bit.

Cliff really doesn’t need me to come to his defense really – he’s laughing all the way to the bank and frankly, he has a thick enough skin, belief in himself and his abilities, and the proof of having been instrumental in the development and production at least three very large Intellectual Properties that he’s doing just fine by himself.

But I can’t help myself. People who have a pop at him have no real idea of who he is at heart. What I see is a damn smart guy who loves what he does, and loves every aspect of it. He’s just both so enthusiastic and knowledgeable about what he does, it’s sickening in some respects. I wish I had a tenth of his knowledge or energy, frankly. The only two people I know who have the same level of experience and knowledge are George Broussard and John Romero (and seriously, spending an hour talking to this guy is like being dropped in the memory pool. He even remembers the balancing values for old RGP games. It’s astounding).

The fact is, yeah, Cliff has a hot wife. Far from people assuming he is lording it over them (which is an attitude that I’ve seen a bit), my feeling is “good for him. He’s proven it’s possible to be a geek and still have a life”. Cliff is something to aspire to be rather than “something to tear down”.

In my experience, people who have to tear others down do so because they realise – usually unconsciously – they’ll never attain those heights, are the worst of what humanity has to offer, and me being my fathers son, I cannot help but point that out. Particularly when it’s someone who so completely does NOT deserve that on the receiving end.

Sure, Cliff has a media presence too. So what? He’s a clever guy – he’s got an agent and that agent earns his keep. That’s why Cliff is on Jimmy Kimmel and you and I are not. It doesn’t hurt that he actually has a personality, is funny in person, and damn well knows what he is talking about.

Again, this should be something we all aspire to, not something to bitch about.

Cliff needs to be judged on the quality of his games, not whether Kotaku decides to feature him or not. The reality is that if you do that, the man comes out ahead in just about every way possible.

Anyway, again, Cliff doesn’t need me galloping to his rescue – but for what it’s worth, I wanted to say Congrats, and Good luck. Whatever he does, it’ll make a splash and be fun, that’s for sure.

Posted in Game Development | Leave a comment

Windows 8

The wife just got a new laptop and we it comes with Windows 8 on it – we are both (the two of us) just trying to get used to it.

Dear God Microsoft, what have you done?

This is just… a mess. A total, unadulterated cluster fuck. Of epic proportions. I can’t believe ANYONE let this go out the door as it is.

Removing the start button? Now, I get why. I get that it’s to force people into the new Metro front end. If you do that, and your applications are only accessible via that, then when you develop new app’s, they will automatically follow the Metro guidelines and then work on tablets like the surface.

And it’s an admirable goal – one OS that works the same on both PC and on tablets. It would leapfrog the IOS / OSX combination issue that Apple has, and put MS on top again.

Except…it sucks. The fact is, if I spend $2000 on a laptop, I don’t want it to be a glorified tablet. I am used to resizing windows and having lots of text, and that’s what I want. I have a way of working and you, as a company, trying to force me into a tablet approach is completely contrary to the way I have been working and want to work.

Removing window resizing for Metro Apps? Seriously? What fucking planet are you on?

Making it so I can’t get to the programs except for going through Metro? What the FUCK was wrong with the start button in the first place? Sure, it doesn’t work so much on Tablets. Who cares? On a table Don’t Have It. It’s not that much of a stretch.

Look, Microsoft, removing functionality that used to exist is not “innovation” – it’s just reducing the experience that people are expecting.

I mean, what you’ve done to Skype on Windows 8 just blows my mind. ALL of the useful functionality is just gone. I can’t reorder chat windows, it doesn’t tell me which chat has a new message, in fact, the options functionality is so hidden that I couldn’t find it at all, until I looked it up on my PC.

Seriously. This shit has got to stop. I get what you are trying to do, but I think we can all agree that a merged codebase for both tablet and PC is a disaster and it needs to be rethought from first principles. The fact is, tablets and PC’s are not the same. They just aren’t. I don’t want the same experience on my PC as I have on a tablet. I have greater resolution, I have a mouse and keyboard and I want to be able to arrange in a greater manner than a tablet really allows. Limiting me to the lowest common denominator just sucks, and I’m not thrilled about.

And removing the start button. Whoever even proposed that needs to be fired. Immediately.

Posted in Uncategorized | 2 Comments

A response to the awesome Fireproof blog post on Polygon

First, you need to read this. Fireproof ‘free-to-play binds the hands of dev’s who want to help”

It’s ok, because it’s very well written, very cognizant of the situation in mobile development today and very well argued. It’s a very good read and a refreshing perspective from someone who’s actually gone out there and done it.

Read it? Good. Because you’ll need to in order for what I have to say next to make sense.

I have to agree with quite a lot of it. In fact, all of it. I would far rather be making larger, single experience games than have to constantly be designing stuff with IAP as an integrated part of the experience, since that’s where I come from too.

But while I agree with everything said in that post, it’s also worth pointing out that within the context of the environment, some of the arguments are less persuasive.

Now, I don’t mean that to come out as ‘no, you are wrong’, because that’s not the intention at all. I LOVE the Room (finished it) and I have Room 2 on my ipad mini, but I haven’t started because I know that when I do, it’ll own me, and I just have too much to do in life right this second.

My point here is that with context, everything said I agree with. But context is larger than the article gives on. There’s risk, for example. While the mobile market is far broader than AAA console and PC development, it’s a lot shallower. What this means is that there aren’t the number of 12-16 year old CoD fanatics for Ipad Games as there are for the actual CoD games on Xbox and Playstation. A console is a dedicated games machine, mobile is not.

The fact is that deep investment in mobile is a scary proposition simply because there isn’t that rabid fanbase already there. Those that tried, as has been mentioned, treated it as a AAA platform and it…just isn’t.

Mobile gaming is very different from console gaming. When you console game, you sit down in front of your TV with a very express aim in mind – to play a game, usually for some period of time. Mobile is not like that. People pull their phone out at odd times, like in a waiting room or on a bus, and play for a very short period of time.

You can’t generate deep SkyRim like gameplay in that situation, because it relies on so much prior knowledge of the game and current situation that it takes 10 minutes to remember what you were doing and everything that pertains to that, and by the time you’ve done that, the Doctor is ready to see you now. By definition, since game play periods are unpredictable both in when they happen and duration, game play tends to be much lighter and more what we at Midway (back in the 90′s) call Dip Games. You can dip in at anytime, play for as long as you want, leave and when you come back, there is no repercussion to the game you are playing. Multi-player Quake is a perfect example of a dip game, as is Mortal Kombat.

Incidentally, it’s worth pointing out that The Room is inadvertently a Dip Game – something very specifically that works for random play times. The way it’s constructed – this puzzle leads into the next one, leads you into a nice area to put away the device. “I figured that out! Awesome! Lets put the tablet away and go to the grocery store now.” Etc.

Sure, this situation limits what you can do – you end up with a ton of asynchronous card game and turn based games – but that’s the reality of what the average gamer has time for. It’s not about “what they want”, it’s more about the realities of how they play and the attention span they have at the time of playing. There is some validity to the claim, although as has already been pointed out, that doesn’t invalidate the Polished Single Purchase game approach.

Another thing that plays into this is history. The fact is, smart phones were an evolution of existing phones, which were not designed to play games, but did anyway – witness Snake on the old Nokia phones. Phone users have been conditioned to accept that games will look a bit 1980′s, mainly because phones as a games platform hasn’t been oriented that way. We are now, for sure, or you wouldn’t be able to put games like The Room on it, but that conditioning has not gone away. People just don’t expect the same kind of graphical glory that they’d get on their console. If they did, they wouldn’t need the console in the first place, and while that is the inevitable conclusion (I’m with Ben Cousins on this), right now they need to justify the purchase of an XBox One AND an Ipad, so they play less graphical intensive games and accept it on the Ipad and then expect real time photo realism on the other.

That’s not to say that mobile games currently don’t have to look good, just that most developers aren’t spending their time on that because it’s, as it’s pointed out, there is the implicit “good enough” thinking in most mobile development.

Which brings us to the current generation of money men. Publishers, investors etc. The fact is that most of these people are not creative, and it’s foolish to expect them to understand what a creative needs to do to ensure polish. They are there to get the max return they can get for as little outlay as they can get away with. If the game looks a little shitter than it really needs to, whatever, we are still making money – expectations aren’t that high to begin with. It’s the race to the lowest common denominator that still makes them money. They are still in that mindset of “mobile games tend to look shitty” even more than the players are, to be honest, because they are seeing the cost of development of quality (of which, more in a bit).

As an example, I had a client for a year who was big into hunting games. When I looked at the codebase and what his games looked like, I gasped. It was horrible. No animation blending, no animation timing, lighting all wrong, GLsettings all incorrect etc. It was just awful. I looked at other hunting games and most of them were no better. I spent a year telling him that one month’s effort could upgrade his engine to the point where he would be head and shoulders better than the other games, and that he could own this genre with his offerings. But he just wasn’t interested – one month of me working on something that he couldn’t track as adding to his bottom line was unacceptable. You could get an entire game done in that time. Good enough paid the bills and reduced his outgoings, and that was that. (I actually added an animation blender to the codebase on my own, simply because I just couldn’t stand looking at it.)

There is a tendency to short term thinking in mobile that is a bit scary, but is also understandable because development times are so short in comparison. You get a game done in a month on mobile, so every day counts and if you need to do something that’s going to bust that deadline, well, lets put that off till the next game. Like I said, understandable, but coming from AAA, where polish is everything, it’s a hard pill to swallow.

Then there’s The Current Generation experience. While we are lamenting the lack of the One Sale situation that AAA (mostly) enjoys, it’s worth pointing out that the iphone is now seven years old. That’s seven years of a generation that is used to F2P and how IAP works. For the more casual gamers, this is a way of life. When they come to XBox and find the average game costs $60, it’s a shock. It’s certainly that way with my kids. They are now conditioned to expect this dribs and drabs kind of game play approach.

Now, that’s not an argument that F2P is “better” than a polished single purchase experience at all, just that it’s here now, and it’s not going away, and objecting to it is more than a little pointless. Sure, Polished Single Purchase is valid too, but it’s harder to be successful at it since there is an entire fan base that doesn’t want to pay $20 to play your game, but wants to try it for free and then very slowly pay out over time (usually without realising it). That’s a reality. That’s not a “You shouldn’t do it” argument, just a recognition that high quality (and usually high development cost, which often goes hand in hand – we’ll talk about that next) is a harder sell. It just is.

As an example, lets look at another extremely high quality game on Ipad – Republique. I know for a fact they’d have to sell multiple hundreds of thousands of copies to even break even on development costs. There’s little chance they will, but they do have episodic content to fall back on, since each episode won’t cost as much to make as the initial engine build. But the point is, it’s unlikely they will make their money back, at least initially.

I really know of only three games that have really had a large single player AAA like polished experience that have made serious bank on mobile, using the single purchase model. One is the Room, another is the Tiger Games set of games (most notably, Waking Mars) and the other is Infinity Blade (which, it should be pointed out, was financed as a mobile advert for Unreal on mobile, and has over $500k worth of assets in it – not that they didn’t make their money back, but it’s just not something your average mobile developer could either afford in the first place, nor afford to place that kind of risk on. Not when there are other, cheaper, methods of making a buck).

Which does neatly lead me into the last point I wanted to make, regarding development costs.

Barry mentions that The Room was made with a budget of $70k. That’s pretty damn impressive. I wouldn’t have imagined that was possible. I suspect it’s because they were all ex AAA developers, had good development habits, and knew exactly what they wanted to make up front. And that’s the rub.

Most mobile developers do not come from that background. The Tiger Games crew did, and it shows. What they produce is very AAA quality. The Republique crew did not, and their development costs were.. well, I don’t want to give away numbers that I got second hand anyway, but lets just say it wasn’t $70k. Way too few zeros there.

Most mobile developers, for better or worse, want to do the least they can and just get it done. Android is a nightmare since there are so many platforms and capabilities to handle and test, and IOS has it’s own issues when it comes to phones.

My point is that saying “We did it for $70k and had no marketing budget” is not the norm. Most developers could not have done it for that. And it strikes me that relying on that as a business practice is probably a bit foolhardy. The number one problem with the appstore is visibility, and going in blind is an invitation to be handed your ass. In this way, The Room IS an outlier, and protesting about it doesn’t change that. It got success by word of mouth and people like Nathan Fillon and Zack Levi (“Chuck”) talking about it on twitter (it’s certainly where I heard about it). Now quality is an influencing factor there, no doubt. They would not have been talking about it if it hadn’t hit a quality bar, but there are other high production value games that I don’t see them talking about – Republique etc. You can’t rely on this as a marketing solution. Getting lucky once with celebrities endorsing your product doesn’t make it repeatable. Although, to be fair, now FireProof is in the position it is, anything it announces is news now anyway, much like Epic. Anyone else announcing the Unreal Tournament new development would be buried on the back pages, but because it’s Epic, it’s front and center. And that is what it’s like for most of the other people.

Something like The Room would take most developers at least $200k to build, and that’s assuming there were no design direction changes along the way.

Now, that’s not to say it’s not possible. What I’m saying is that I think their experience is not necessarily the norm – there are some modifying circumstances -, BUT that other developers may/should need to be trying to replicate it. The problem with lack of experience is that you often don’t know what you don’t know. The issue is that of risk – banking success on a Polished Single Purchase is a higher risk than going the IAP route – there’s just reality to that statement. Both are fraught with failure, but since there are more success stories of IAP games being successful, what do you expect most mobile indies who have NOT come from AAA to do?

Now is that a self fulfilling prophecy? Possibly, but while it’s an interesting discussion, it’s also an academic exercise. The landscape is what it is by now. The more interesting question is, can this be changed? Which is (at least to me) the thrust of what the Fireproof blog post is about. It reads, to me, as “We did this, why can’t you?” and while there are some very specific conditions in how they did it, the point is well made. Why can’t we?

The answer is, yes, of course the landscape can be changed. Is it likely? Well, according to my magic 8 ball, the answer is “Ask again later”, which I’d say is probably right on.

But, it won’t change unless more experienced developers do take that same risk that the fella’s at FireProof did. So here’s to hoping they do.

Posted in Game Development, Game Development commentators | 1 Comment

Quaternions – a primer

What ARE quaternions? I mean, you hear them talked about – what actually are they, and what are they used for?

Here’s a brief description and some usage cases. Hopefully this will help for those struggling to understand what they are and how they are used.

Now, a quaternion, at root, is a direction (or, in math parlance, a vector – which is the same thing) and a rotation around that direction. What does that mean?

 

What is a vector?

It means this. Point your finger at something. Anything. Just point your finger. The direction your finger is pointed at is a vector. It’s a direction. In 3 dimensional terms, it’s a three value combination of up/down, left/right, and forward/back.

Imagine it this way. Imagine your hand is at position 0,0,0. It’s the ‘origin’. Now point your finger. The direction your finger is pointing at is expressed, in math, as a Y position (ie up/down), between -1 and 1. -1 would mean you are pointing exactly down. A 1 value means you are pointing directly up.

It’s the same for X (left and right) – it’s a value between -1 and 1, where -1 means you are going total left, and 1 which means you are going total right. As an aside here, there are some coordinate systems that allow for Left Handed Rotation. This means that what is considered ‘left’ is in actual fact a positive 1, not a negative 1. This means that the values for X are, effectively, flipped. It’s just one of those things that happens on occasion, no one really knows why or can explain it. It’s just one of those things you need to know up front, if you are using a left handed threaded coordinate system or not. Most systems, however, are right handed.

And similarly, for Z (depth or forward and backward). A -1 here means it’s coming out of the screen, towards you, wherever the camera is. A 1 here means it’s heading exactly away from you.

Note – it’s worth pointing out that it’s entirely possible for a vector to have a zero in one or two of the positions of the axis. So a vector of (1, 0, 0) is totally legal, and is saying, the direction is left. There is no up / down, and no back / forward values at all, we are just moving left.

A note on Normalizing.

Now, you’ll note that most of the examples I’ve given here are between -1 and 1 for each axis. Why is that? A vector coordinate does not actually need to be between -1 and 1, infact, it can be any set of numbers in there? A legal vector is x=100, y=200, z = 50. So why the insistence on keeping numbers between -1 and 1?

This is defined as normalizing. Well, it’s a little more complicated than that. A Normalized Vector is a vector where, if you add up each of the X, Y and Z values, they equal either 1 or -1. Or, to put it another way, if you define a vector direction as a Normalized Value, if you drew a line from 0,0,0 to the vector position, the length of the line would be exactly 1.

Now, interestingly, all vectors (IE all possible values of a vector, even those above 1) can be ‘normalized’. For example, a vector of 0.1, 0.8, 0.1 is the exact same as 100, 800, 100. One is just a ‘smaller’ version of the other. Or, to put it another way, normalized. To normalize a vector, it’s pretty simple. Take the length of the line from 0,0,0 to the vector position (and you can use Pythagoras’ theorem for that – length = sqrt of ((x * x) + (y * y) + (z * z))) and then divide each of the axis values by that value.

Now why bother? Why do we do this? Well, it’s because certain other things you can do with vectors – like dot product and cross product (math functions that I’m not going to go into now, but that are really useful down the line for trigonometry functions) – that rely on the vector being normalized to get useful results out of them. Normalized values are useful since all they represent in those conditions is a direction – not a position. They are, by definition, an offset from 0,0,0.  You can then multiply a normalized vector to get a line of any length, which is really useful for projecting out a position into the world.

Back to Quaternions.

So ok, we’ve defined what the vector, or direction part of a quaternion is – it’s a 3d point from 0,0,0, which is normalized – IE it’s a vector length of 1. What’s the rotation value and what does it mean? Let’s go back to the finger pointing exercise. Point your finger in a direction. Any direction. Now rotate your wrist. What happens is that your finger still points in the direction, but your wrist is rotated. So the rotation value of the quaternion is describing the rotation around the axis the vector is pointing at.

Why would we even care? The direction is still the direction – that hasn’t changed. Well, it has, actually, but in root ways of how it’s expressed. It still pointing in the same direction, but how that’s described at a math level has changed. Try this. point your finger in a direction, and now extend your middle finger left, and your thumb up. These represent the X and Y directions of the vector. The middle finger is pointing along the X axis, and the thumb represents the Y axis. Now rotate your finger again. You’ll notice that your thumb and middle finger are now pointing in different directions. This means that the rotation has done some weird things to what the quaternion now thinks is ‘up/down’ and ‘left/right’. If you rotate your wrist enough, X becomes Y, because now it’s pointing up, and Y becomes X, because now it’s pointing left/right. You can see how the rotation messes things up.

This becomes important when you start putting quaternions on top of quaternions. Because you’ve now altered the origin of rotation and vector direction, from the parent. I’ll go into that more in the next bit.

What can I use Quaternions for?

The most common use of quaternions is in animation systems. A quaternion can represent a bone position in a hierarchical model of bones in a skeleton (by hierarchical, I mean that bones have a parent / child relationship. A wrist bone is parented by the forearm, and that in turn  is parented by the upper arm / shoulder bone. You end up with a tree of bones, each having children and parents. The reason for this is that bone positions / orientations are additive. This means that each bone inherits both rotation and raw position from it’s parent. If you rotate a shoulder, then all the bones underneath it move along with it, because they are attached to their parents. Then each bone underneath rotates itself, and adds that to the rotation the parent already has.).

So for each bone, you don’t have a position – since you don’t need that. Your original skeleton definition already has position offsets for each bone from it’s parent, and those offsets don’t change, frame to frame. The length of bones doesn’t change – it’s a set thing for all animations.  What you do have, per bone, is a quaternion, which describes the angle and rotation of each limb, relative to it’s parent, based on where the end of the parent bone ends up being in the world. So, to put it in more real world terms – I know that my upper arm is of length 10 units, because that’s in the root skeleton definition. I also know that the default direction of the shoulder bone is straight out in X (this is because root skeletons define the arms as being flat out, stretched out to the side. This is known as the T Pose. No one knows why this is the default definition of a skeleton, but it is.) Now, when I have a quaternion, the rotation in the bone is an offset from the raw skeleton position. So in order for the bone to point down, as it would do for a ‘normal’ stance for the skeleton, we would need to rotate the bone down by 90 degrees. So the resulting quaternion would look like this – with a vector of (0, -1, 0) and a rotation of 0, since we aren’t rotating the bone at all – just giving it a new ‘direction’. This is saying “Point the bone down”.

What then happens is that, knowing the bone length is 10, you’d take the parent model position of the shoulder (which, again, we’d know from the root skeleton definition), get the quaternion vector position, scale that by 10, and then add that to the shoulder position, and that gives us the new position of where the upper arm ends – ie where the forearm begins.

This is better than storing a real transformation matrix per bone (which can do the same thing, but in different ways) for two reasons. One is that it’s smaller. A real matrix is 4×4 floats -  12 floats in total. Per bone. If you have fifty bones in a model (and that’s a conservative estimate for a biped, for example, once you start including fingers), that’s 50×12 floats (or 50*12*4 = 2400 bytes) per frame of animation. A quaternion is only four floats per bone, so the math means that a single frame of animation is considerably smaller – 50*4 floats (or 50*4*4 = 800 bytes per frame). That’s a saving of 1600 bytes per frame, which if you have thousands of frames (and most modern games do), is a significant saving.

But the other reason is even more significant. Matrices cannot be interpolates, and quaternions can.

What does that actually mean though? I mean, it sounds good, but it’s really gobbledygook, isn’t it? Lets go through it.

In our animation example, imagine we have three frames of animation. The animation frequency is 12hz. That means we have a different frame of animation every 5 frames, assuming we are running at 60 fps. So for 5 frames, we display frame 1, then on the 6th frame, we start displaying frame 2, and on the 11th frame, we display frame 3 etc.

But that’s not how animation systems actually work. What they do is actually interpolate between frames, based on how close you actually are to each frame.

So in our example, we have five frames of display, but not enough animation frames for each frame of display. So what animation systems do is take a percentage of frame 1 and frame 2, dependent on how close the rendered frame is to either, and then add those together. That’s not really any clearer, is it?

Ok, so in our example, we are rendering 5 frames, using frame 1 of the animation. But what we actually do is for frame 1, we are rendering 100 percent of the first frame of the animation. For frame 2, because we are moving on in time, towards frame 2, we take 4/5 (or 80%) of what frame 1 represents, and then 1/5 (or 20%) of what is in frame 2, and add them together, to generate a merged frame from frame 1 to frame 2. We are, in effect, generating a new frame of animation from two others. This is called Linear Interpolating, or in game dev parlance, Lerping.

The actual effect is basically saying “Take the rotation and the vector of frame 1, scale the vector and rotation by 0.8, then do the same for frame 2, only scale it by 0.2, then add those two together, re-normalize the vector, and that’s your interpolated frame”.

Then, for frame 3, the amounts you scale by change, so now it’s 0.6 for frame 1 and 0.4 for frame 2, because we are now getting further away from frame 1 and closer to frame 2. And so on.

The thing is, you can do this interpolation for quaternions. You cannot do this for matrices, because you end up potentially flattening the matrix (you don’t need to know what this means, just that it’s bad) and so this is one important way that quaternions score over ‘real’ matrices.

Drawbacks of using Quaternions

1) They don’t have position built in. They are purely a direction and rotation. Root position needs to be held elsewhere. A ‘real’ matrix has position built in (which is one reason why it’s larger). But this is by design, since Quaternions are designed to be used in hierarchical situations, where the result of the parent would dictate where it’s starting position in the world actually is.

2) They don’t have scale built in. A ‘real’ matrix has scale built in, for each axis (so you can scale a model by each axis individually. So you can say “I want this model to be fatter on the X Axis, but not on the Y or Z axis”, and a matrix can handle that -  a quaternion cannot. Incidentally, you may ask why you’d want to do that. Well, it’s a way of being able to scale a rendered model to your view port aspect ratio. Models are built assuming that the window they are being displayed on is 1:1, so it’s a square. The moment that is no longer true, you need to cope with that in code. One way to do it is to affect the X and Y scale values of a matrix, to ‘stretch’ out a model, so it fits in the display correctly. Most games do NOT do this, and that’s ok too. But a matrix approach enables you to do this.

Now, there ARE things that a quaternion can do to represent scale. We talked about the quaternion vector component being normalized – ie a vector length of 1. What if that is not true? What if we have a vector that is not a length of 1? What if it’s 2? Or 20? Well, the practical effect is that this is a way of storing scale. The scale itself is whatever the difference is of vector length from 1. So if the vector length of the vector stored in the quaternion is 10, then the scale is 10. Now, this is different from how a matrix stores scale, because a matrix stores scale per axis – ie it has different scale values for x, y and z. A quaternion scale affects x, y and z at the same time. It’s a scale of the length of the vector along the vector. In our animation example, it would make a limb longer, not just fatter along one axis.
Ok, so that’s a basic primer of what a quaternion is, what it can do, and what some of the advantages and disadvantages are. Hope that helps.

Posted in Animation, Game Development | Leave a comment

We need more assholes in the game industry!

Wait, what???

Surely we need less assholes in the industry, not more? What kind of idiot says we need more??

OK, so let me define some terms for you.

When I say asshole, I mean vision holder, for on large projects, they need to be the same thing – or at least considered the same thing by the team.

The reality is that large projects need a vision holder that has passion in his project, totally believes in what he is making, has a firm vision of what that looks like and has the forceful personality to push his team into making what he envisages.

And, when you say no to people, when you say “No, this needs to be this way, this is what I see in my head. Make that happen”, you become an asshole.

People have accused David Jaffe of being this – of being a dictator on the original God of War, but my view is that GOW would not have turned out like it did without a forceful and competent personality like David on the case. He knew what he wanted to make and he set out to make it and he followed what he believed was right. And the results speak for themselves.

Incidentally, it’s my view that this is why David did not follow up, by leading GOW2 – because he specifically did not want to be ‘that guy’. I think he’s very uncomfortable being portrayed as “that asshole in charge”, because once you know him, you know that’s entirely a false persona. He’s just gives a shit about what he’s making.

Now the reality of game development is that it’s filled with passionate people. The more engaged you are in what you are doing, the more you care about it, and the more you want it to be the best it can be, and you probably have a vision for that (or, in the case of coders, how it is best implemented). The problem comes when that passion and desire / vision is incompatible with the main vision holder – putting frogmen into Bioshock might be ‘cool’ to you, but it’s not what the main guy wants to see. So out they go. And it sucks to you, because it was your baby, so the main guy is obviously An Asshole.

The guys up top have to be confident in their decisions and forceful enough that when they kill someone’s baby, it stays dead. And that’s hard – very hard – to do without being an asshole.

I’ve met exactly three people who can do it – one is Phillip Rosedale, creator and Chairman of the board at Linden Lab, another is Will Wright, who can cut your legs out from under you with one concerned question, and the last is Matt Booty, who was the sound manager at Midway when I was there, rose up to be CEO and is now at Microsoft, heading up Mobile Dev Rel.

So while it’s entirely possible to make games and be the vision holder without being an asshole, the reality is that most people are going to have to be perceived as an asshole to get the job done, in time, to sufficient quality, because that’s the only thing that passionate people will respond to.

I think that almost every awesome game – save, perhaps, Half Life – can trace its development roots to one guy with a pushy personality who saw what he wanted and made people give it to him.

Now, of course, giving absolute authority to anyone is also a danger. Absolute power corrupts absolutely, right? And yeah, if the guy in charge is an asshole, produces his product and it’s crap, well, then we all have a problem, right? How do you deal with that?

Dunno, honestly. Worth asking the question though.

Posted in Game Development | Leave a comment

Javascript – my experience

Recently I’ve been working on a project that is Javascript based. I’ve never done Javascript before, but I know PHP pretty well, so how hard could it be? It’s just another language designed for building web pages, right?

Yeah, my own casual arrogance here just bit me in the ass big time.

Javascript is to PHP what C++ is to Basic. Javascript carries within it several paradigms that you just have to get your head around.

There are some that are relatively easy, and now I know about them, I do actually miss them when I go back to C++ or Objective C – Promises are a case in point.

Promises are where you can ask Javascript to do a bunch of functions, one after the other, and feed the results of one into another. It’s really useful for doing back and forth with a webserver, for example. Normally I have block code indented to do it, and the XCode debugger fails in those situations. With Promises, I don’t have to worry.

I’ve had to get my head around the concept of local Javascript and server side javascript. I had no idea that javascript websites physically download javascript code to the client in the background. That was a stunner.

But all that being said, because of what Javascript is – basically a thin access layer to data structures, with some logic thrown on top – writing JS can be a monumentally frustrating experience.

The fact is, JS is abstract. Very abstract. You can call functions using variable names. All data structures are, effectively JSON objects (which makes sense, since JSON actually stands for Javascript Object Notation). You don’t serialise anything, and being able to see inside data structures can be…problematic, to say the least.

The entire language is something that it’s extremely difficult to work out, just from looking at code; you have to already know the language to understand what is going on, because it’s all so abstract. It’s almost as impenetrable as Perl.

How it integrates into HTML is another of those things that either you know or you don’t – it’s nigh on impossible to work out why anything is done the way it is just from looking at samples.

Javascript strikes me as being an extremely powerful language, but it has a cost of entry that is far far greater than those of traditional languages, even for an experienced programmer. It’s equal “Oh, that’s cool!” with “What the HELL is going on here??” moments.

I suspect more familiarity will help. Either way, it’s been a learning experience…

Posted in Game Development, Web Dev | Leave a comment