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

Programming Gratuitous Rocket Trails

I was watching District 9 ( I liked it, except the more yucky violent bits), and there were some cool rapid rocket trail effects in it, and it suddenly reminded me that the rocket trails in Gratuitous Space Battles aren’t good enough at high speed. Take a look at this rocket trial, from a rocket cruiser missile at 4x speed:

Crap isn’t it :D. At normal speed it’s fine, but at super high speed, the missile actually moves too fast per frame of rendering for me to actually space out the particles. So I just knocked up some code that instead of doing this: (pseudocode)

HowFarHaveWeTravelled?
IsItTimeForAnotherParticle?
IfSoPlaceAParticleHere

does this:

for(distance_accounted_for = 0; distance_accounted_for < actual distance, distance += particle spacing)
{
  Position = LastMissilePosition
  Position += (distance_accounted for)
  Place a particle at Position;
}

Which is more work :D But it’s worth it, because even at 4x speed it now looks like this:

I know it’s a bit late to be worrying about all this months after the game came out and got reviews, but I am just completely drawn towards tweaking the game to look better. Also this means I can experiment with superfast rocket trails which will still look good. Also today I’ve done all of the debris and turret gfx for the new race in the new DLC/expansion pack thing. Now I have to actually design their ship configurations, and allocate their bonuses. Then I need to do their mission deployments, and then it’s pretty much done (and I then need to balance and playtest it). Yay!

Xbox? No, not for now anyway.

Over the last few days I’ve been seriously considering making an effort to get Gratuitous Space Battles onto XBLA (Xbox Live Arcade). I have decided not to do so (I must send that email…) and here is my thinking:

  • According to wikipedia, the Xbox has sold 34 million units. I suspect that less than half are used by people who are happy to buy and play downloadable games. Most will be used purely for Madden and for Call Of Duty. So that’s 16 million, vs 25 million people with an account on steam. Lets round up the other digital dist sites and say there are 35 million people able and willing to buy PC games online?
  • Games on XBLA are cheap. people gnash their teeth about $15. As someone who sells a $22.95 game and a $19.95 game, this does not bode well.
  • On PC, I can sell direct, taking > 90% of the price. Through portals such as steam, it’s less, but still quite good. On XBLA There would be a Microsoft cut, then probably a publisher cut, and then I’d get the crumbs. All out of a smaller price.
  • The Xbox has a long list of requirements about how games should play. Obviously it must be played with a gamepad, which is awkward enough, but platform holders have a funny habit of insisting you use their latest feature, even if it makes zero sense in context of the game. I hate that.
  • On PC, there is no publisher involvement, and no approval process. I know 100% that at some point, someone somewhere at Microsoft would say that the game would be better if you could control the ships. They are wrong, and I’d have to waste precious hours of my life arguing the point. This would not be fun. I’ve heard numerous horror stories from fellow indies about this sort of thing.
  • There are up front costs, for ESRB, getting a dev kit and so on. I already have a dev kit for PC games development, it’s called a PC. This is a big chunk of cash I need to find on the off-chance that I’m ‘allowed’ to publish a game for less money, at a lower royalty, that I had to redesign to fit at a low resolution using a controller designed for beatemup games. hmmmm
  • Xbox gamers are not known for their love of slow paced heavy thinking text-based strategy games. GSB is not Halo, or COD. They may hate it.

So combine all that and I have no urgent need to get involved with the Xbox. Maybe this is a mistake and it would have sold 100,000 copies on there, but I suspect not. Maybe if you didn’t need the ESRB stuff, and the dev kits were the same price as an xbox, and they automatically approved any game that passed a basic ‘not offensive’ check, I’d be more tempted, but as things stand, PC beats XBox for me, and it beats every other console out there.

BTW I worked around the vertex buffer thing, patching both games to not use vertex buffers at all. This is slower, and infuriating, but it works. Grrrr.

Vertex Buffer Driver Hell

Some days as a programemr suck. Today is one such day.
All my old games use directx7, with my own engine,. Gratuitous Space Battles uses a new engine, directx9, and all is well.

In January this year, Kudos and Democracy stopped working for lots of people with the new nvidia drivers. They got crashes in the vertex buffer lock code. Obviously I hadn’t changed a thing. the games had worked fine on thousands of PC’s for years. Suddenly nvidia must have changed the way they handle vertex buffers under directx7. Thanks guys!

The old code was very old school and simple. I locked a vertex buffer, then copied in memory, then unlocked, and rendered from them. Big deal. I didn’t use any cleverness with the buffers gradually filling up and then discarding them. (I do that in GSB) I always locked the whole buffer and the lock flags always looked like this:

HRESULT hr = VertexBuffer->Lock(DDLOCK_WRITEONLY | DDLOCK_DISCARDCONTENTS | DDLOCK_SURFACEMEMORYPTR,
(VOID**)&BufferMem,&bufsize);

For every VB lock. I did a few of these each frame, mainly for rendering text. This may not be optimum, but it worked fine, all return codes checked ok on all cards and all drivers.

Suddenly, on my nvidia 8800 GTS, and for everyone else with new drivers (except the 9800 GT), this crashed, and would only work if changed to this:

HRESULT hr = VertexBuffer->Lock(DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
(VOID**)&BufferMem,&bufsize);

In theory this is less efficient. But suddenly it works. Hurrah. Except not for 9088GT owners. I tried this:

HRESULT hr = VertexBuffer->Lock(DDLOCK_WAIT | DDLOCK_WRITEONLY | DDLOCK_SURFACEMEMORYPTR,
(VOID**)&BufferMem,&bufsize);

This also works on my 8800GTS, but even this does not work on the 9800GT. I can’t get a reply from nvidia, and the developer forums there hurl abuse and sarcasm at anyone who dares to ask about why a directx7 program won’t run (I’ve read a fair few threads there). Apparently we should all just STFU and re-code everything in DX10. Err right….
Anyway, I have nothing to say on this topic other than it depresses me. I don’t want to be fixing games I finished a few years ago, I want to work on new stuff…but obviously I need to support all my customers. I just wish someone at nvidia would tell me what they changed, and how to work around it for all their video cards. I emailed them a few days ago but got no reply…

If you work an nvidia, or know everything about directx7 VB usage with modern drivers, please shower me with your wisdom. And if you have an nvidia card, feel free to try the demo to Kudos 2 or Democracy 2. Both should now work, but I’d love to know if they don’t, what video card and driver you have…

bah :(

Best cruiser explosion ever

is at 2 minutes 32.

http://www.youtube.com/watch?v=_ZIPsXY7_fc

Thats what I’m aiming for. Obviously without ILM’s budget, but hey.

I’m tweaking  explosion effects right now. I’m waiting for one more expansion pack ship, then the turrets, and then I can start balancing them and doing the new missions. I’ll show some screenshots of the new stuff before I release it.

The format of this expansion/ DLC is very similar to the tribe. New race, with new weapons. Plus asteroid belts will look 3D in the new mission. yay.

Movie review? Enigma

Here is a film you may like if you are a bit geeky and haven’t seen it:

Enigma (2001)

http://www.imdb.com/title/tt0157583/

What is it?
A low key drama / love story about code breakers fighting to break the German enigma code during World War II

Who is in it?
Kate Winslet, Jeremy Northam, Tom Hollander, Matthew McFadyen, other people.

Quick Plot:
Tom Jericho is a code breaker based at Bletchley park, recalled to help break enigma again after the Germans mysteriously change the code mid-war. Interleaved with the code breakers attempts to break the code, is a love story between him and fellow Bletchley park worker Claire Rommelly, and a spy story based around a ‘mole’  feeding information to the Germans. There is little to zero action or spectacle. Only one bullet is fired as I recall. And the car chase may disappoint smokey and the bandit fans.

What’s Bad about it:
Some fairly cringeworthy romantic scenes and dialog. An annoyingly repetitive musical theme. A few fairly contrived and convenient plot devices. Some general purpose stereotyping of maths geeks.

What’s good about it:
It’s about the birth of computing AND fighting WW2. What’s not to like? Plus a great supporting cast, and a good script in places. Surprisingly historically accurate (glosses over alan turing though, presumably because they wanted a heterosexual love story). Also, it treats you like you are paying attention, and doesn’t break down the complexity of the core topic (encryption) to sub kindergarten levels like many Hollywood movies would.
The plot is complex enough to keep you guessing.

Best Scene:
Tom Jerichos explanation on how enigma works to the American General. This is the way all programmer should speak to their boss when asked that irritating question “How long will it take?”

Best Character:
Jeremy Northam was born to be the slimey, suspicious and sarcastic British Intelligence chief.

Best Quote:
“Given the circumstances, Miss Wallace, I think we might risk first names.”

Buy it or Rent it. It’s good :D

I’m working on both an expansion, and some UI improvements for Gratuitous Space Battles. I’ll blog on them when they are ready.