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

At last reaching code size issues

For indie games, my games are pretty big in code terms. By the standards of big triple A games, they are fairly simple. The problem with any game, is not really the lines of code as such, but the interconnections and complexities.

Now, if you have coded big systems for ages, you get used to writing very modular stuff. All my games are split into SIM and GUI classes, which in theory have very very little overlap. The problem is, that games of the sim/management genre become more and more intertwined between those two concepts. This means lots of unintended side-effects, and that often means more bugs. It also means a lot of possible permutations to test, and that invariably leads to more bugs.

In theory, I suspect the real answer to scaling up code is to go beyond merely thinking in a modular way, and to write totally distinct programs, or at least DLLs. Having a clearly defined interface between the Sim, the UI and the gameplay rules is very handy and if you actually stick the GUI in a separate project, it makes it easier to stick to that with real discipline. That also makes it easier to have people port your game, switch to a different graphics API, or mod the game. To be honest, I’m not as good at this stuff as I should be, and the campaign code for GSB is bringing that home. It’s been far too tempting for me to just stick a bunch of spaghetti into the GUI code for a dialog box that does some SIM stuff. I re-designed various code today to make it more organised, but I should probably do quite a bit more of it.

I wish I’d coded totally open AI that could have been scriptable, or at least existed as a DLL that modders could expand. Coding that sort of stuff is normally a full time job for someone for a year though, so you can imagine why I didn’t do it :D

Why GSB is not like a normal RTS (deliberately)

Have you seen korean starcraft players?

http://kotaku.com/5580080/korean-gamers-are-faster-than-a-speeding-bullet

fast huh?

Although it’s impressive, and kinda funny, it’s also a bit depressing and kinda sad. I like to see the RTS genre as a mostly ‘S’, and not so ‘RT’. If I was 14 years old, I’d think differently, but I’m not. One thing spending your teenage years learning neoclassical heavy metal does, is to teach you that someone with more free time than you is going to be faster than you. Always.

When I was at Elixir, I worked on a game that got canned, which was like speedball. it seemed to be a really strategic game. The player who won was the cleverest, the most strategic thinking. It played a bit like real-time chess. The reaction-time and number-crunching side of it was minimal, it was an ‘outwit-the-enemy’ style game. I liked it.

GSB doesn’t care how fast your reactions are. You can be 55 years old and have arthritis, you can still design a kick-ass fleet, and a cunning challenge.  I know starcraft is a massively popular game, and they know what they are doing, but you can only really design good games if they are games you personally enjoy playing. I can’t compete in FPS games or arcadeish super-fast RTS games, but I can compete happily in GSB. I also like the asynch nature of online challenges, because it eliminates the asshole attitdue of many online RTS players, who drop connections when losing or mock you during in-game chat,

I met the guys from introversion for lunch today. Had a good chat about games and indieness. It’s always refreshing to chat to people who understand what it is you do, and do something similar.

The idiot box

How much TV do you watch? If you are like me, you are watching less and less. It seems to get less appealing every month, let alone each year. I’m sure eventually my TV will be used for DVDs, and maybe the news.

One of the TV progs in the UK that is supposedly for grown up, intelligent people who want to know what’s going on in the world is Newsnight. It’s a lateish-night politics and current affairs program. The last time I saw it, they were doing an item on the upcoming voting reform referendum, and whether or not it would cause a split in our governing coalition. How did they present this serious and deep issue?

By an animated cartoon showing the two leaders as john travolta and olivia newton john, and playing the music from grease. Oh, granted, there may have been a few minor nuggets of actual commentary about the topic, using short words and visual aids, but I still felt like it was aimed at the 4-8 year old market, who should definitely be in bed at that time.

British TV is increasingly embracing it’s role as ‘the idiot box’. Not only are a lot of the subjects covered by TV purely for bored idiots, but even the stuff that you would think was serious, or needed in depth coverage is treated as some sort of lame comedy routine. Maybe some clever TV analysts have discovered that everyone with college education or higher just doesn’t watch it anymore, so they just cater to the lowest common denominator? Silly visual gimmicks seem to assume that the entire audience has attention defecit disorder.

Maybe I’m weird, but I can cope with watching someone sitting still, talking to camera for ten minutes in a normal voice about something that is really interesting. When I read a book, the book doesn’t have little animations, or cartoons, or wave its arms about wildly every sentence to keep my attention. Books can’t do that, so they compete merely by having good content. It really doesn’t matter how much you wiggle your head and wave your arms as you talk, if you have nothing to say, nobody cares. We get closer to this mitchell and webb parody every day…

How to stay motivated whilst programming a game

Lots of people want to know the answer to that question. Most indie games fail. Most indie projects never get completed. I don’t have any way to prove that, but any indie game veterans will know it’s true. Here are my top tips. Some of them may seem like they de-motivate, rather than motivate, but I get motivated by knowing how important and serious it is for me to work hard. Most indies don’t realise how hard they are going to have to work, and how good their game has to be.

1) Code something you like.

Just because you did your research and can prove that a poodle simulator is the best choice for the current games market, doesn’t mean you want to program one. You might kid yourself that you can see it as a ‘mere engineering challenge’, but you won’t. Getting out of bed when nobody forces you to, with no deadline and no boss, to go code poodles probably won’t motivate you for a solid year. Pick something you are passionate about. I love sci fi and space battles, so making gratuitous space battles was a no-brainer. On a related note, save up some ‘fun’ coding for when motivation is low. Feeling keen? code the save game system and the options menu. Get them out of the way.

2) Surround yourself with inspiration

I listen to music from star wars or star trek when coding easy stuff or doing art. Coding scrollbars can seem dull, but the music reminds me these are spacefleet scrollbars and that makes it ok. The people who play your game won’t see the code, only the art and the game, so keep a picture of the final ‘atmosphere’ of your game in your head all the time. Does your pc desktop wallpaper not reflect the mood of your game? why not?

3) Keep a log of what you did each day.

Sometimes its easy to think the day was wasted, that nothing got done. I have lists of things to do for my games like this:

  • Fix bug with plasma torpedoes
  • Resize scrollbars
  • Add tooltips to buttons
  • Add transition to options screen

At the end of the day my log looks like this:

  • **DONE**Fix bug with plasma torpedoes
  • **DONE**Resize scrollbars
  • **DONE**Add tooltips to buttons
  • **DONE**Add transition to options screen

And that makes me realise how much I got done. You get a tiny adrenaline rush by crossing things off a todo list. Make one each day. Make the entries small, simple items, rather than huge projects. It should always be possible to cross something off each day.

4) Do some shiny

Mr Spock would code the entire game engine, get the gameplay balanced using just coder art, then add the graphical fluff last, to minimize re-doing work. I used to assume that made sense too. I used to rail against Lionhead for having so much artwork, code and music done before we were even sure how the game played. So much work got thrown away. Now I realise it’s important for your motivation to have something that looks and plays nice ASAP. The GSB campaign add-on hasn’t got all its gameplay coded yet, but theres a gratuitous map-zoom effect in already, plus background music. Having those things there keeps me positive about how cool the final game will look. There really is a good reason to code some shiny stuff in the first 25% of your project. Just don’t go mad.

5) Hard lessons in money

I gave a talk at a conference recently about the reality of indie games as a business. To be short and sweet, you need to sell a full-price game direct to a customer every 45 minutes, or you probably won’t make a career as a  full-time indie. That means at the very least someone grabbing your demo every 240 seconds. When you keep this in mind, you realise you need to make your game really good. Better than it is. You need to do better, just to survive in this market.

6) Stay aware how high the bar is (know your competition)

Don’t forget that for most gamers, the competition isn’t other indie games, but AAA games, or even other activities, TV, movies, etc. When I worked on the battles for GSB, I spent very little time looking at rival games, and virtually no time looking at indie space games. I compared it to the best sci-fi battle scenes I knew of, by ILM. Yes, you have to pick your battles, and graphics might not be one of them. Spiderweb compete on game length, Dwarf fortress on gameplay depth. Whatever it is that you are competing on, you need to ensure you aim as high as you can. Also remember that your game isn’t measured against the best game there is right now. It’s measured against the best game when your’s gets released…

8) Take short breaks.

Get away from the PC for a short while, so when you come back, you are fresh, keen and energised. Physical activity is a good idea. I do archery now and then. It’s ideal because it involves standing upright, concentrating on a distant object, and 100% focus on what you are doing. It’s the perfect sport for desk-bound geeks

===

Staying motivated is hard. Everyone has the same problem. Often, its the deciding factor between getting your project done or not. High motivation trumps everything. There are indies making games who are homeless (yes really) and who had to make them ‘undercover’ in Cuba. They still got stuff done. Lack of experience, lack of money, lack of time, can all be overcome by sheer bloody determination, if you can summon it. Now stop reading this, and type out tomorrows todo list.

Crappy windows code

Soo… some people have a bug in GSB where in fullscreen mode, the titlebar of the windows ‘window’ is still there, but invisible, meaning you can accidentally hit the close or miniomize buttons, or worse-still, double click and then ‘maximise’ the already fullscreen window.

I have encountered this a few times in GSB myself. but cannot reproduce it right now. It’s certainly not reliable. And it’s annoying. I would love to fix it. I’m pretty sure its something to do with the windows code that selects either a windows style or windows class.

currently I use:

wcex.style            =    CS_CLASSDC | CS_DBLCLKS;

and

HWND gWnd = CreateWindow(appname,appname,
 WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
 0,0, width, height, GetDesktopWindow(), NULL, hInstance, NULL);

Both chunks of code I haven’t changed in ages. I suspect the code is wrong, but am finding it impossible to find what is ‘correct’. Looking at the directx samples makes me want to cry. In amongst 500,000 pages of incredibly convoluted, confusing, totally over-engineered MFC style bullshit that they call ‘DXUT’, there is a hint that microsoft themselves use just CS_DBLCLKS and WS_OVERLAPPED. The thing is WHY? There is no documentation. In the old days, directx5 used to tell us we need to use WS_TOPMOST or somesuch.

You would imagine that as 95% of people using directx write games, and 90% of them want to, at some point, run fullscreen, that the directx docs would have a line saying “for fullscreen apps, you need to select these options for your window”. No such clues have emerged though.  Another evenings trolling through coding forums no doubt…