Game Design, Programming and running a one-man games business…

Steam Dev Days afterthoughts

(I’ve never done this before, but I’m typing this on the plane, so I have time for some detailed thoughts. Long post ahead!)
I’m returning from the first steam dev days conference (they will surely become regular). By now you will have heard all about attendees getting steam boxes & controllers, and the major announcements. I bet journalists have that stuff covered. I’m going to write up more strategic thoughts, combined with some thoughts on business in general that have weighed on my mind.

Linux.
This is the big takeaway for me. I’m not a big Linux fan. Nothing ‘political’, I’m just so used to windows. I’ve used windows constantly since windows 3.11. I don’t know anything about Linux, and I now have to learn. Valve have made this clear. Not ‘Linux is growing’ more ‘learn Linux now… today…’. Personally, I’m not too bothered by this, especially now I have a steam box. What this really means for me is OpenGL. My hand-coded directx engine is now looking like a bit of a dead end. This is unfortunate…

Steam Boxes.
Actually not a big deal for me, this shores up the PC gaming market share against console erosion, which is great. Will PC’s migrate into the living room? maybe… but not for text-heavy strategy games that I make. I think the impact for me may me minor. Ditto the steam controller, although this might be worth using for GSB 2.

Virtual Reality.
I didn’t attend a demo. I should have, stupidly assuming that being stereo-blind would rule me out, but fellow stereo-blind devs assure me its still amazing. I don’t make first person games, I make totally abstract ones, so again, maybe not a big impact for me.

Micro-transactions/economies/user-generated content.
Fascinating stuff, brilliantly presented, and a bit of an eye opener for me in how to do this stuff in a *nice* way. I am hugely motivated about doing work in this area in future. These were the most interesting talks for me, although I hear that the marketing panel was also amazing :D

Deeper Thoughts.
This is kinda separate. I need to add a disclaimer here so I can put these thoughts into context… Positech Games in recent years has become very very successful. I used to publish sales figures back in the day, but I don’t do that now. Things have ramped up big time. I am still basically a one man company, but with an increasing army of contractors and also automated systems and methods to boost my efficiency. As a result, things have gone kind of huge. Not notch level, but damn good.
This isn’t meant to be bragging, this is to put this next section into context.

A lot of things are happening in games. A lot of people are getting into the industry. The industry is growing, but also changing. There is a lot at stake. A well-placed solo indie developer can make or lose a million dollars or more based on a good or bad call. This is high stakes poker, or in some cases roulette. We are playing with live ammunition now. I love metaphors.
I have decisions to make about company growth, platforms, investment, languages, genres. These decisions will make or lose those millions of dollars. The stress and pressure related to those decisions is massive.

Intuitively, I know that I’m fine. Positech has a great financial base. I’m not about to bet my house on a game release, or lose everything if I get things wrong. I have no employees I might have to fire. In many ways I’m lucky, and can relax… but frankly, I like to win. That doesn’t mean at the expense of anyone, I don’t need others to lose, if that makes sense? The most adrenaline-packed and rewarding strategy game I play is called ‘running positech games’. I want to make the right calls and win, it’s burned into me at some primeval level. As a result, I take these decisions incredibly seriously. This leads to intense pressure and stress, that is outwardly completely invisible. I take from this two things:

1) Company executives earn their money. It’s very easy to look at people who run a bank or huge company, in their chauffeured car and executive hotel suite and million+ dollar salary and think that life’s easy for them and anyone can do it. No. There is more to an easy life than having great food and a nice car. Those big salaries come with epic responsibilities and incredible pressure and stress. I cannot imagine how much worse it is at the billion-dollar 10,000 employee level. Get it wrong there and you can kill of thousands of jobs. Intense Pressure. I don’t begrudge anyone in that situation their big salary and aston-martin. I’m surprised there are not more CEO suicides, to be blunt.

2) This can’t be healthy. I’ve taken the opportunity in the last year to have my heart and blood pressure checked. Both were absolutely fine. I could maybe lose a little bit of weight, but generally I’m healthy. This is great, and also very surprising to me. It’s something I try to keep an eye on. I am acutely aware of the fact that high stress and pressure is bad, and I don’t want to be the guy with the highest sales figures in the morgue. So far I seem to be balancing it well, but it isn’t easy. I slept for just 3 hours last night, purely due to stress and pressure. Rare, but still bad. I guess I’m trying to max out all my Kudos 2 stats at once, I want to be healthy, happy and successful. Not easy :D

So there you go, my first post-steam conference thoughts. Maybe a bit scattergun, but I thought I’d jot them down while they are fresh. I have a lot more to say about Linux, but I’ll save that for the next post…

TL ;DR: Linux is coming, Positech is selling lots, This is stressful and creates pressure, but I’m somehow still healthy!

Off to the land of the free!

I’m on a panel about game marketing at steam dev days:

http://www.steamdevdays.com/

steam

So I’m mixing it in with what you slackers call a ‘holiday’. Thus, I’m about to leave this stormy wet windy weather behind me to enjoy the sun-drenched countryside around seattle. See you all soonish!

What’s really holding you back?

This is personal-development, motivational (kinda!) stuff. If you read my blog for code tips, move on :D

I read a great article in the Sunday papers (yup, real dead tree reader here), basically bemoaning the contrast between immigrants arriving to the UK, and some (not all) people in the UK. The article centered around a Romanian immigrant who had come to the UK  ‘hoping to get a job washing cars’. It was basically a pro-immigration and a ‘what’s wrong with British kids these days’ article, and I found myself agreeing with it strongly.

I’m not going to pretend that I am a kid from a gangster-strewn housing project who had to battle drug addiction and homelessness yet still managed to make indie games. My background is probably average for a kid born in the late 60s/early 70s in London. I went to an ordinary state school, then college, then university (neither parent had gone to university). My local state school was good, but not without problems. At the time, I thought my life was pretty ordinary, perched halfway between the less well-off kids on local state-owned estates, and the children of TV scriptwriters and actors who made up the other half of the class.

Now, living where I do, I get to meet the people who would never have sent their kids to the school I went to. They have more money, it’s as simple as that. They have incredibly nice polite children who have the best possible start in life. I’m not criticizing them one bit, but it makes me realize that actually, by some standards, I started my life at a relative disadvantage.

Boo-hoo.

(If you want a more extreme version of this story, read ‘anyone can do it’ by Duncan Bannatyne. His background was way harsher than mine (poverty as a kid, no real education, military prison…) and his success is way greater (he’s older than me though so… :D). I bet if Duncan Bannatyne heard me describe my teenage years he’d think I was a spolit brat. And of course, if we go to certain countries in the developing world, we would find a lot of kids who cannot believe that all of us here can rely on food and shelter *every day*.)

In short, there is always someone worse off than you, and better off than you. Some people may have an advantage over you. The games industry is centered around certain physical hubs. San Francisco is one, Seattle is now one, London is one, and Guildford certainly was. If you are an English-speaking kid in San Francisco you already have huge advantages over a lot of other people, you just don’t realize it. You take those advantages for granted.

My parents taught me to read and write young, and encouraged me to work hard at school and get good grades. that was invaluable. A guy I met when I was a musician gave me a lot of confidence, and working as a musician always boosts your confidence. The two most valuable gifts I’ve had that have helped me get where I am are an early start on reading, and confidence. That’s it.

We had no computers in my school, we were taught nothing about them. There was no internet. if you wanted to learn about stuff not from school, you walked or cycled to the library. Somehow, it was still possible for me to learn how to code. All I needed was motivation, and confidence, and I had those already.

These days every kid has a super-computer in their pocket, and the internet lets you learn about ANYTHING at the touch of a button. Yet this does not happen. kids could learn quantum physics for free using wikipedia, but they play angry birds or watch youtube. Access to knowledge has never been cheaper, easier, more convenient or more democratic. I seriously doubt you learn *that much* in an oxbridge university classroom that cannot be learned online.

The new dividing line between the talented, the capable, and the employable will not be related to their background, their school, or their parents wealth. This is becoming *less* relevant. The difference is going to be motivation, confidence, and a willingness to work. The reason you don’t understand quantum physics, is you haven’t bothered to investigate it. There is simply no other answer. I have no excuse for any gap in my knowledge, and I know it. I don’t blame anyone but me. And tools? if you are a software developer or artist there are a crazy amount of free tools. In short, a lot of the excuses I might have thrown around as a kid for not achieving what i wanted to just do not apply, at least in the IT world.

Summary: If you have kids, teach them to read young, and give them confidence, everything else is probably trivial by comparison And remember that if they have healthy food and a roof over their head, you are already giving them a better start in life that most. If you spend your days as an adult blaming your situation on X or Y, take a second a look and ask yourself what really holds you back.

It’s probably just you.

Am I wrong? If so, say so.

 

Thoughts on multi-threaded 2D game development in directx9

Am I the only person doing this? probably. I often am. Most people have moved on from DX9 (I know it so well there is big opportunity cost to updating) or use OpenGL, and very few people are doing 2D games where performance is an issue. I am taking early steps with Gratuitous Space Battles 2, and my aim is to have it run at 60 FPS on average hardware with 2 1920×1080 monitors. I also intend to get it running ok for bigger setups too. That’s a lot of pixels, and due to all sorts of fancyness I’m adding to GSB 2.0, it means a lot of processing. a REAL lot.

So…multithreading! it’s about time i ventured forth. To date, my only multi-threading efforts have been the asynch server communication in GSB 1.0 for challenge uploads etc, and the loading screen for GTB and Democracy 3. Actual mid-game multihthreading has scared me until now.

I hate middleware so I’m not using any libraries, just raw calls to CreateThread, TerminateThread and so on… This might make it more complex, but means I have complete control over stuff. My first experiments were not exactly encouraging. I attempted to speed up the position calculations of asteroids. Now to cut a long story short, I use D3DTLVERTEX style stuff (not hardware Transform and lighting) and for good reason i won’t bore you with. The upshot is, I have a lot of non-directx transform stuff to do for anything drawn on the screen.

An ideal case for multithreading!

threads--friend--grey-cat--thread_3218279

So I wrote code to split up the asteroids into 8 chunks (test case of an 8 core chip), and gave each processor a list of asteroids to process. Result? SLOWER. Actually quite a bit slower. Some fiddling with AQTime (My profiler) let me analyze cache misses for each thread, and I also profiled it as 1 thread. The cache miss rate went through the roof. Basically, my transform code was relying on some global camera data, and I suspect that either:

a) Referencing he camera data was a bottleneck with each thread blocking each other from getting it or…

b) The memory locations of the asteroid transform data was laid out in such a way that all the different threads kept fighting for the same cache lines and generally getting in each others way.

I spent a lot of time reading and fiddling and decided that it wasn’t working (although did manage a decent few speedups in other ways). I then decided that if lots of threads sharing the same job wasn’t going to help, maybe lots of threads doing different (unrelated) jobs would…?

And this is more of a success. I have a function called ProcessFrame() which does a lot of non-directx stuff, such as the aforementioned asteroid transforming, updating engine glows, updating explosion plumes, particle effects and distortion waves blah blah… Until recently, it just did them one after the other. I then realized that although a lot of them accessed the same data (camera position stuff mostly), none of them altered it, and the tasks were quite discrete.  So I packaged them up and sent them to different threads, and then spun in the main thread waiting for them to finish. result? 21% faster. yay? not bad, but not 800% faster, which would have been theoretically do-able(not really but…)

Of course the missing link was that I am then left waiting for the slowest thread. Plus if I have more than 8 tasks, I run out of CPUs. So I re-coded it to have a queue of tasks, and when a thread finished a task, it checked the queue, and only reported it was done when the queue was empty. This was way more efficient, and easier to scale to available cores. Result? 41% faster!

Now obviously a 41% processing speedup is good (although this is pre-render, not render, so probably only a 20% FPS boost) but I can’t help thinking that if not 800%, a 200% speedup of that bit of code must be possible. Debugging cache-misses is hard, as even aqtime will bluescreen occasionally on windows 7 when profiling it. I’m pretty sure it’s some cache, false-sharing issue going on.

In the meantime, GSB is now faster as a result, even if i spend no more time attempting to multithread it (and i will… I’ve only just got going). Anyone else attempting this sort of thing?