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

The Humble Positech Sale

So today is exciting because it’s the start of the HUMBLE POSITECH SALE. You can go grab the games and donate to charity (and the developer!) over at the site here (or click the image below)

humble

It’s especially cool to have been involved with picking the charities for the bundle, which are the red cross and barefoot college. Who? well I first heard about barefoot college after watching as really cool documentary on them in the UK, where they followed the path of a woman who was taken to the college to learn how to manufacture and maintain solar lights. The idea is that they take those skills, and that independence and spread it to other villages and other people. This is quite a tough struggle against poverty, indifference, and quite a bit of sexism too. The documentary is great and it’s a worthy cause. And of course it supports renewable energy, which I’m really into.

But hey, also, there are some cool games of mine there. And they are at a good price. Go grab em. or tell your friends!  or both! And there are videos of me talking about stuff too…

The Democracy 3 Compass

So here is a half-finished feature I’ve added to the main menu for Democracy 3. It’s a chart showing the last 50 election wins you had in the game, with the icons representing the countries you were playing at the time, and they are printed onto a left/right liberal/conservative axis so you can see what the state of the nation was at the time. In a way, this is a clue to your own political opinions and prejudices, as presumably you will gently be nudging all the countries in a similar direction.

compass

Next up: finding a way to populate the chart with the average positions of any of your steam friends who are also playing the game…

Some optimization tips for game programmers

I’m enjoying myself with some optimizing today (yeah I’m weird like that). So I thought I’d jot down some of my tips for making your game faster. These are general, not language-specific tips.

Never run code you don’t have to run

Seems obvious but few people actually do this. For example, in democracy 3, the simulation calculates the popularity of each policy by asking every voter if they benefit from it. That question is complex, and there are a few hundred policies and 2,000 voters. This takes time. Solution: I only ask them about a policy if I need the answer right now. Some policies can go a dozen turns without the player ever checking their popularity, so why keep calculating it?

Batch Stuff

If you have a dozen icons that are always drawn one after another on the same screen, stick them in a texture atlas. If you are 100% they will never overlap, then draw them in a single draw call. the less texture swaps and draw calls, the faster your code. This is trivial to do in 3D, an absolute nightmare to do properly in 2D, but it’s worth it.

Cache Stuff

If you have a variable that is complex to evaluate, evaluate it once, then cache it until it changes (we tend to call that setting it ‘dirty’). If there is some data that is going to be accessed a LOT, then make a local copy of it. And if you have a lot of stuff to write to disk, to the same file, buffer it. Writing to or reading from a file is slow, especially if you are going to do it a lot. Reading in a single file is much quicker than opening 200 of them one after another.

Don’t use sqrt()

Do you ever use sqrt()? never realised how scarily slow it was? Most of the time you can keep the squared result and use some clever tricks to not actually need the sqrt() result. If you were going to get the sqrt() and compare it against a value, just multiply the comparison value by itself and check it that way instead. it’s amazingly faster.

Use the right container class

Sometimes you will use a list where a vector will do. The vector is MUCH faster. And you know what is faster still. I mean REALLY fast? An array. If you really need speed, and the array size won’t change that often, allocating an array of items is much faster and is worth the overhead.

Re-use objects

If you have a collection of objects that keep getting created and destroyed, you want to wrap that up. Stick a factory object around them to handle their construction and destruction. That way, you can just set them inactive on destruction, and save yourself the hassle of the creation and destruction when it comes time to re-use them. Setting a single flag to say an object is ‘dead’ is way faster than calling a destructor, and resetting is way faster than a constructor.

Obviously there are lots more tips, and you should get a decent commercial profiler. That PC you develop on is a super-computing beast. if your game takes more than a few seconds to load, you are being sloppy.

 

Redshirt developers log…

First gameplay footage, as I recall. here is mitu explaining how to suck up to the boss…

Redshirt alpha screenshots

Ok…so today marks the day when we send out press releases to a bunch of journalists about Redshirt. (If you have somehow been missed email me). For those who haven’t been following progress on the game, Redshirt is a sci-fi social-networking life-sim comedy game by The Tiniest Shark, which is being published by me. It’s the first time I’ve published another developer’s game. yes I have become THE MAN.

redshirt_Logo_transparent_500

As well as sending out press builds, we have a bunch of shiny new screenshots to share with the world, and obviously news on the game will speed up now we are in alpha, heading towards beta and pre-orders. Without further ado…click to enlarge…

Don’t forget to check out (and please LIKE!) the game’s facebook page at https://www.facebook.com/redshirtgame