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

Anatomy of a gratuitous bug

I think I’ve fixed a bug in the gratuitous space battles campaign game. I’ll know ‘officially’ soon, but it fixed it on my machine :D Here’s what was involved.

A player complained of a random crash bug at the end of some campaign battles. I could not ever reproduce it, and back-and-forth emails began. Eventually, this awesome customer provided me with exact steps to reproduce, and all their save game data to let me replicate it. First run through and….. nothing. It was fine. Roughly every third run-through, in release mode it crashed…

Step 1! Hurrah! it actually crashes for me. This is 50% of the battle because then I *KNOW* that it is the games fault, and not the gamers system, or software. This is good, although frustrating news.

Step 2! It crashes in debug mode. This is another 25% of the battle because I can actually see what data is corrupt. As it turned out, the ‘firstfleet’ pointer in the code that assigns captured ships to the players winning fleet is clearly trashed. How did this happen?

Step 3… debugging. It transpires that the firstfleet pointer is accessed multiple times before this point, and after being initialised, confirming that it *must* have been valid, and becomes invalid between initialisation and access when adding captured ships to the fleet. This means we  can step through and watch what happens, if I break on initialisation..

Step 4 discovery! Stepping through the code confirms my suspicions. Once the battle ends, the code updates all the players fleets and removes ships that died in battle. Then, other code innocently picks the first of the players fleets in the battle, and initialises a dialog box listing the enemy captured ships that will be assigned to the fleet. Later…. *drum roll* it deletes any fleets that are now empty. Can you see the bug yet?

Step 5: fix! Changing the code that naievely picked the ‘first fleet’ to pick the first player fleet that still has some intact ships ensures that the later deletion of an empty fleet, and invalidation of the pointer is harmless, because the captured ships are now getting added to a surviving fleet. Bug probably fixed, pending the player confirming that a new exe fixes it.

Why did I not spot this bug six months ago? Well here is what has to happen.

  1. The player has to fight a battle with multiple fleets at once (common).
  2. He has to win (fairly common)
  3. The ai has to lose by the right margin to leave some captured ships (fairly rare).
  4. The winning player has to have enough ships removed from the *first* fleet in the list to have that fleet entirely deleted, despite winning overall. (pretty darned rare).

Simply put, This didn’t happen to me once in testing. It hasn’t happened to many players either, as I understand it. And if it has happened to you… I may have good news :D

Regimental colors

Today I got a decent chunk of work done for the regimental colors editor for GTB. GSB only had your user name, which didn’t really add a feeling of connection to the other player, so GTB will have your regimental logo (like a cap-badge insignia) associated with your maps and armies, so hopefully players will feel more like they are really fighting against proper opponents.

I plan to support user-designed, uploaded logos too, but because 95% of players won’t be arsed to do that, there is a simple editor that arranges a logo out of 3 layers and renders it to disk as your profile logo. The rendering isn’t done yet, but the rest is:

You can choose between a bunch of graphics and the three layers get combined, with a choice of some colors, plus you can move elements up and down and scale them. It’s the bare minimum that will give me an assurance that you will generally see fairly unique logos for all your opponents when playing other players armies. Plus it was fun to do :D

The problem with code like this is you can get *too* into it. I could happily spend a week doing a fully featured military insignia designer with a ton of features, but you can’t have that attitude with a game as huge as GTB if it’s ever going to ship :D I really hope the game does well enough for people to get into designing really cool logos. GSB has a great modding community and I’d love to see them go to town with stuff like this.

 

Patch and games sizes, onlive, bandwidth…

So OnLive is out in the UK. I noticed quite a few people on the interwebs pointing out that they won’t sign up because, like me, they are on limited bandwidth internet plans.

I live out in the country, where there isn’t as much choice of ISP as the cities, and because my business needs the net, I need a rock solid connection with reliability and really good telephone support, so I end up paying over the odds. As a result, I have very reliable broadband, pretty fast, but bandwidth capped to 45 gig /month. I generally never hit the limit, but then when I see a game demo thats 2 gigs, I normally just skip it.

Something that made me think about this was Heroes of Stalingrad, Red Orchestra. This game is a tech-support trainwreck, with numerous bugs, random crashes, occasional dissapearing sound effects, rubber-banding, blah blah. Underneath it all is a great game.

The good news is they keep patching the game (although often introduce more bugs than they fix). The bad news is the patches are normally 400MB+. Apparently the developers claim this is the unreal engines fault in some way, although I find that hard to believe. Almost all bugs in a game are in the .exe and the exe is rarely >20MB.  Regular 400MB patches are crazy.

I definitely think that big games studios totally forget about the ‘bandwidth-challenged’. It’s one thing to release big patches. It’s another thing to release such patches several times a month, and require the patch for online play. If everyone MUST have the latest version, don’t insist on chewing up over a gig or two a month of peoples bandwidth limit just to play a game.

 

 

Starting on the challenge stuff…

GTB is such a huge game that I seem to veer into certain areas of it for weeks at a time, then veer back into other bits of it and think “did I write all this code?”

One of the features from Gratuitous Space Battles that I was very happy with, was the online challenge system. It was very popular. About 226 trillion billion zillion challenge games have been played (roughly). Obviously I want a similar system incorporated into GTB, and naturally I want to fix the things that were not perfect, which I identify as:

  • The challenge browser was not as good as it could be. You couldn’t filter out played/downloaded challenges.
  • Any challenge that had content, be it DLC or a mod that you did not have, could crash the game, and not be pre-filtered
  • The emotional connection between you and the challenger was limited. (Rarely used messaging, and rating, but not leaving comments etc).

I plan to fix all of this, but the middle one is the current one of interest.

GSB had a binary .gsb format for a challenge, which basically packed in binary data for the fleets designs, deployments and orders, and a little bit of data about the challenge (custom settings etc) and that was it.

GTB will use a new .pak format I’ve written that will behave a lot like a zip file. (no compression yet, sadly). It will be a folder full of stuff for each battle, all the enemies unit designs, the deployment timings for their attacking units (or initial deployments of defending units), and all of the data from the scenario file, down to the location of every tree, crate, barrel, barbed wire etc…

That makes a GTB challenge file slightly larger than before, but I can live with that. They are under 100k. How many custom maps in games are under 100k now? It also means you could move a few trees or change the texture of a single tile, and upload an existing scenario trivially without any inconvenience.

Anyway…. The upshot of this new file format is that theoretically, if I write the code for it, the format could include custom sounds, graphics etc. That means you could do a mod for GTB which included different textures for the terrain, and custom units, issue it as a challenge, and EVERYONE could play it, because the required content gets downloaded with it.

Sadly, there is no way to prevent dupes there, so if you have a custom tank texture, and upload 10 challenges, someone downloading all 10 gets the texture 10 times, but I think that’s not so bad. Only a minority of players are likely to issue or play modded challenges anyway.

The main thing is, my pak file format pakker and unpakker all works fine, so it’s another step along the path to having online play working. Now I need to replicate a lot of the GSB functionality (and improve on it).

Edit: I swapped out my code to use some zip code instead , after finding a zip wrapper that was extremely lightweight.

More is not better. (Why I’m frustrated by hearts of Iron 3)

Having been kicked from a game of red orchestra, for no explicable reason (I presume another of many bugs), I fired up Hearts Of Iron 3, to give it another go. I lasted less than 1 hour of game time (5 minutes of real time), and quit in frustration. The game is, in my humble opinion, a design train-wreck of epic proportions, despite being a game production miracle of awe inspiring proportions.

The older and more experienced I get, the more I understand Peter Molyneux. That probably amuses some people…

I remember people giving him a lot of stick about wanting to simplify combat to just one button. I agree, that’s a bit extreme, but the direction is possibly the right one. game designers, especially very insular ones with no hobbies or interests outside games, tend to go way too far in the direction of over-complexity and over features. The result is a game like HOI 3, a game which absolutely bludgeons you with exceptional levels of micro-management and geekery. In my view, Men of War does the same thing. If I can control what ammo is used, what target engaged, what stance is adopted, and what hat is worn by my troops, and even take direct control of them, do NOT give me 150 of them in one mission. That just INSISTS that I will spend most of the battle frustrated, panicked and annoyed. The same is true with HOI3. If you must add diplomacy to the game, please ignore Costa Rica, Guatemala, Andorra, and other countries whose impact on world War 2 was at best marginal. Do you really want to spend world war 2 micromanaging the rate at which you sell electricity to Nicaragua? Really?

Buying production rights from Bhutan, is not something spielberg will make a movie about any time soon.

The usual game-designers excuse for this behavior, to people who complain (like me) is that there are ‘AI-managers’ that you can switch on to handle the tedious stuff. That is a horrible sticking plaster over a gaping wound. Do not tell me that people who enjoy complex turn-based strategy games are happy to turn over some decisions to an AI manager. We are not. We are tyrants and megalomaniacs who want TOTAL control over our universe. We don’t want to admit to anyone, even ourselves, that we are overwhelmed and giving control over something to someone else. I would rather not play HOI3 at all, than play with most of the game being played by the AI. I don’t boot up my PC so the AI can enjoy itself. Ship me a simpler game, that uses less than 800MB of RAM before the menu screen, please…

This, in essence, is part of the rationale behind GSB. GSB does not pretend you can control 300 starships in a complex battle. it admits you can’t, and thus doesn’t make it an option. Some people hate it. Over 100,000 enjoyed it enough to buy it, so I can’t be the only person with this point of view.

Controlling all the lasers would be frustrating and hard work, so GSB doesn't make it an option

A company that really *gets* this, is popcap. In game design terms, their products are absolutely awesome. I may not like the styling, or the subject matter, but they know how to boil things down to the bare minimum required to capture a particular feeling. I *want* to feel like I am Winston Churchill, leading the British empire to ultimate victory over the Nazis. The key is, I want to FEEL like I am doing it, not actually do it. I don’t want to give over my life to worrying about the diplomatic situation in pakistan and whether or not the armor plating on the decks of the 23rd oil-transport flotilla that goes from Cuba to Portsmouth is sufficient. Churchill did that because it was his full time job, a matter of life or death, and a neccesity ( and he farmed stuff like that out to underlings, anyway). This isn’t the case when you sit down to play a PC game. You don’t have to find a quiet spot in combat during call of duty to go take a crap. Sometimes, it’s a good idea to leave out the boring stuff.

You might think there are not enough complex strategy games for the PC, and maybe you are right. The problem I have is that we have Popcaps games, and then Hearts Of Iron 3. There isn’t enough stuff in between. I’m trying to fill that gap.