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

World War 2 (executive summary)

I’ve been reading a huge 5 or 6 volume book called ‘World War II’. A bit of an arrogant title, assuming you can cover the whole topic, but it was written shortly after the war by Winston Churchill, so he’s allowed some slack. Obviously it’s insanely long, and I’m only on volume 3, but it’s fascinating stuff, especially when you are working on a battle game :D.
Here is some of the stuff that has stood out as interesting to me so far.

1) Invasion of Poland my ass. We get taught in school that this is when WW2 started, but thats bullshit. Hitler had already frogmarched into a number of countries by then, and Mussolini had been misbehaving too. We didn’t officially declare war with Germany until then, but the idea that this was sudden or even slightly unexpected is wrong. There was tons of obvious buildup.

2) Everyone thought England was fucked. The Germans assumed they could conquer us, The Americans had strong doubts we will hold out any longer than the French. (They wouldn’t send us arms that they secretly thought would end up in the hands of conquering Germans).  The global consensus was that England would fall next, and Hitler would have the whole of Europe soon. Nobody took seriously the idea of the Brits fighting to the death.

3) The British Navy was fearsome. We kicked ass in terms of naval combat. The Germans didn’t really try to engage the royal navy, because they were just outgunned and they knew it. The story of ship v ship combat (ignoring subs) for the first part of the war, was the royal navy tracking down enemy ships and sinking them. No wonder we have this ‘brittania rules the waves’ lyric.

4) The battle of britain was vital purely because it stopped Germany having air cover for a seaborne invasion of the UK. They knew their ships wouldn’t make it over the channel without air superiority, which is why they tried to take out our air force. The whole bombing of cities was just plan B after it was obvious that an invasion was impossible

5) The Italian army was rubbish. Really hilariously bad. There were some engagements where it was literally a 100 to 1 ratio of British troops lost to Italians killed or captured. That’s just laughable. This isn’t knocking the Italians, it’s probably just that the average Italian soldier wasn’t as keen on the war as the Duce. Good for them!

6) Churchill was on the ball. This was not some upper class twit drinking port and leaving the war to the military. He was intimately aware of troop dispositions, strategy, diplomacy, economics, and always hassling everyone to get things done better, faster, and with more enthusiasm. He was determined to take the fight to the enemy, and a big believer in using new technology to win the war.

It’s especially amazing to read Churchills multi-thousand page history of the war, know all about Bletchley park, and notice he never even hints at what went on. Talk about keeping a secret…

I’m sure in 4 years time when I finally finish the books, I’ll have more to report :D If you have a million hours of free time, I recommend it as a fascinating read.

I’m working on the UI for a custom challenge editor thing…

Fixing a single GSB bug

Step 1:
Where is the game crashing? it crashes here:
void GUI_TitleBar::SetTitle(std::string str)
on an assert
GASSERT(Width > 0);
Width is clearly not set right when we set the title. Cue lots of hunting through every window that uses that code to check that they never set their title when they are yet to set their width. No luck.

Step 2:
Sudden realisation that the window width is a red herring, it’s the titlebar width itself that isn’t set. Sudden discovery that a function in the dialog class is virtual, but the function it supposedly implements is not. Possible confusion? certainly sloppy and needs fixing, but I can’t fix it *now* because I need to know *exactly* what causes this, rather than changing stuff and hoping I found it.

Step 3:
Realisation that the negative width may be an infinite high width wrapping round, which implies width has never been set. Maybe this is why I never see the crash in debug? A check shows that window widths are always set to zero, but that would still trigger it…

Step 4:
Reading up on related bugs suggests something to do with the race changing, combined with the ship editor. Decide to test in release mode deploying, then changing race then going to design mode. W00T! It crashes, although release mode debugging is far from trivial. It looks like a null pointer though, meaning it should reproduce in debug

Step 5:
Reproduced it in debug, which normally means home and dry. A module type pointer is set to 0xcdcdcdcd. This means uninitialised, and this seems to be the case. I’m assuming it is null without setting it to NULL. If it had been set to NULL, then a module would have been selected.

Step 6:
Temptation to fix an obivous unintialised pointer error here, but that would be BAD. The task is to really understand the bug before fixing it. For example, why does this not *always* crash when launching ship design? Lets test… It seems to always crash for me in ship design. That cannot be right…Aha, it’s handily crashing in some code inside the STL library, but only in debug build. A quick check of the shipped release build shows I can’t now replicate the bug there. Even stranger. Could I possibly have shipped a debug executable in a patch, this explaining why not everyone has the issue? No, the file size difference is 3MB.

Step 7:
Tests shows that the same exe does not crash taking the same steps if outside the IDE. The IDE is clearly setting those debug values and trapping an error. Is this actually related to the titlebar error crash and change race crash everyone has? If the module pointer is invalid, all hell could theoretically break loose. Getting tempted now to just fix the obvious errors, at least to see what happens next.

Step 8:
There is just no way that this pointer is correctly set to null. Unless it’s null by happy co-incidence, the game should crash whenever the ship builder is viewed. (if null, the game assigns it a valid value). Adding an assert for this, which still triggers in my release builds. It doesn’t trigger. How the hell is that pointer being set to NULL?

Step 9:
I suspect I am being lucky in release build with this. The pointer is uninitialised and being set to NULL most of the time as a side effect of something else, but this is not guaranteed, hence the randomness of the crash. It’s clear this pointer should be initialised, so I’ll just do that, and move onto new stuff.

Visible work

I was at a restaurant recently and mused on the topic of why we tip waiters in restaurants. You might think it’s because their salary is low, but I suspect not. The salary of the people in Malaysia who made the clothes you bought in the high street is likely lower, and yet nobody tips them. I notice actors at the end of plays take a bow, to much applause, yet the set designer, director and the sound engineer never does. I notice that you tip the taxi driver, but you never tip the train driver. You applaud the band, but never applaud the bands manager or sound engineer…
Why?

Because it’s a matter of visible work. Out of sight, out of mind. This is one of the phenomena that has helped justify widespread on-line piracy. You don’t see any work being done, so you feel no need to reward anyone. Intuitively we know a lot of work went into a movie, but we didn’t see it happen. Intuitively we know that 90% of the experience of Keira Knightley in a movie is down to casting, directors, lighting, sound, make-up, costume design, scriptwriters and marketing. Yet she is worth millions, and most of the people doing the invisible work probably earn the average wage.

It is all too easy to be vastly removed from the people doing the work that we take for granted and don’t see. I’d like to take a minute to remember that the tea i’ll drink today was probably picked and packed in india by people earning a pitiful wage. It was sent by sea to the UK on a ship built by people I’m oblivious to, steered by others, crewed by others, and unloaded at a port by others. There are probably thousands of people who work to ensure it gets to my cup, and I have physical contact with almost none of them. These days the shops themselves even want me to scan and pack my own tea, so the last vestige of contact with anyone associated with the product has been removed.

We live in an age where we are remote from the people involved in the production of what we consume. Over time, hopefully we will learn that just because you don’t see work being done, doesn’t mean work did not happen. And increasingly, people reading blogs like this will be in that same position. People often complain that everyone else doesn’t appreciate the work they do. It’s worth remembering that we can all be guilty of that ourselves.

In other news, I did code for the message handling today. It involved hundreds and hundreds of lines of hopefully stable bug-free code, testing and checking. You didn’t see me type it and test it and design it and check it, but I aasure you I did it anyway :D

Online integration fun

You know what’s missing in GSB?

Yes, yes I know you want a big 4x style campaign game built around it. ONE DAY maybe, but certainly not by the end of the week. One thing that is not quite so huge and unwieldy for a short term project is the area of online community.

Player A reads a forum post by player B, and decides to issue them with a challenge that proves their point that tribe frigates kick ass. Player B is oblivious, unless they happen to be browsing the challenges and spot they have a new one, from that player. Wouldn’t it be much cooler if every time someone issued a challenge to you, beat your challenge, or played (and presumably lost) your challenge, the game knew about it, and collected those messages for you to review at your leisure?

So rather than having to go to challenges, filter by personal and check if anything looks new, you could have a little spangly message popup saying “you have new messages“, on the main menu, and clicking there would tell you what’s new in your world of GSB.

This sort of stuff isn’t *that* evil to code, even though it involves server-side stuff. I already have it all up and running, UI and all, and the server is currently processing messages as I speak (although nobody has  a game version that lets them see them yet. But I can tell that a bit earlier, superneals sent a new challenge to knightsofni, for example.)

This will go into version 1.28. At the moment it’s system generated messages, so you just get pre-defined text messages notifying you of events. If people liek it, I think it would be awesome to be able to win a challenge, then type a message for the person you just beat saying “Ha!, i beat that fleet without even using plasma. I’ve responded with my winning fleet.” of course, you need to be able to block abusive / spam messages, but I’m working on that now. Besides, anyone spamming or being abusive will get the ban hammer :D