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

Multi-texturing

Part of today was spent on the fleet design screen adding pilots as a requirement. This is something I’ve got from the old travller game. Basically some missions will have a limited number of trained pilots for your ships, thus limiting the number of small fighters that are viable for your fleet.

I also finalised which space backgrounds would go with each mission. Then it was on to some graphical stuff…

I’ve added a new weapon, which is an ECM blaster that knocks out the targeting systems of a ship for a few seconds. Ideally you would have a ship that acted as ECM cruiser to knock out the weapons of the enemy cruisers before you sent in your fighters and bombers to blast them to bits :D. As a result, I need a graphical effect on the target ship to show its been zapped.

The existing shield effect isn’t the same sort of thing, because it’s a seperate sprite drawn on top which surrounds the ship in a sphere. I needed something that ‘hugged’ the outline of the target ship. In a 3D game, you would maybe have an animated texture which you applied to the ships mesh, but these ships are sprites so that won’t work. The solution has been to layer two textures together and render them in one pass. Basically, I have a generic ‘lightning effect’ texture which is drawn on top of the ship, but I tell directx to use the alpha channel from the ships sprite as the alpha, and the color data from the lightning to draw the effect.

That bit was a pain to get right, but once done, I then needed to animate it. That is being done by having two lots of texture coordinates for the effect sprite. I leave the first set (for the ship, used as the alpha mask) at their defaults, and the effect color layer uses the second set. That lets me ‘ripple’, scroll or shake the effect texture, and still have it ‘wrap’ closely around the outline of the ship. It works, but I need to program a decent movement effect, and do a proper effect texture. Then I’ll post screens :D.

Gratuitous Tank Driving

I’m sure some people have seen a picture of me with a klingon knife or a jem h’adar gun or my bow and arrows and think I’m some weapon obsessed maniac. This isn’t true.  It’s just con-incidence that I spent yesterday driving Chieftain tanks, self propelled guns and APCs. It was a Christmas present…

Here’s me checking out my new vehicle. It has worse mileage than my peugeot, but I suspect parking is easier, or at least more flexible.It was the most comfortable vehicle to drive, you actually have room to move your legs. Its also the the only one where you had to do gear changes as you drove.

This is me driving an APC. It was a total bitch to drive. The tank was way easier. I almost sent the thing tipping on one side during some particularly excitable cornering.

And here was my fave drive of the day. An abbot Self-propelled gun. It was much easier than the APC, and it actually shifted pretty fast. It’s weird driving something that has a big huge fuck off gun barrel clearly in your line of vision.

So tank driving is another thing I can now cross off my mental list of silly things I need to try.

Pay attention to trigonometry

Do you want to program computer games?

Do you understand trigonometry?

If not, you need to. I (rather famously) do 2D rather than 3D games. But that doesn’t mean I don’t use maths. I use a lot of maths, every day. The one area I use all the time, is trigonometry. A sine wave is a beuatiful thing. A curve that simple (in maths terms) is just incredibly elegant and finds its way into everything. It’s amazing how often you need to express something in a game in terms of a nice smooth curve. Knowing the (very simple) maths behind a sine wave, and similar functions is just vital if you want to code games.

Geometry and trig is taught really badly at school. Do you know the ‘real world’ examples used to illustrate the usefulness of this stuff at my school? I remember it to this day, “imagine you work in a factory where you need to calculate the volume of a can of baked beans”. How about this: “imagine you have the most tedious job in human history”.

Now imagine how games coders use it.

“Imagine you are making a smooth oscillation of a spaceship laser beam as it sweeps across space attempting to lock onto an enemy fighter”

“Imagine a spaceship has exploded and you need a smooth way to fade in and out the brightness of a shockwave which occurs as the ship blasts into pieces.”

If you are still at school, pay attention during maths. Trig used to be pretty useless (although I even used it as a boatbuilder) for most jobs. For the really cool jobs involving things exploding, it can be bloody useful.

Don’t underestimate how well you need to know this stuff. I got an A in my maths O level a year early, I got an A in stats a year later. I was top of the whole year in maths. I got 100% on my maths O level mock. And in programming terms, I SUCK at maths. I used to ask other coders for help with maths stuff. Being the absolute best at maths might not get you the girls when you are sixteen, but it really matters big time later on. Study the maths.

Fun website facts

I love google analytics. You get stats for EVERYTHING.

  • Visitors to my site using firefox spend 7.95% less (estimated from buy page views) than visitors using internet explorer.
  • last week I got more visits from china than I did from France
  • Canadians like Democracy more than any other game. Brazilians prefer Kudos
  • I actually get more visits from firefox browsers than IE
  • Only 2% of the visits are from dialup users
  • The top 5 countries supplying visitors are US,UK,Canada,Germany and Poland

Deployment Interface

I’ve been redoing the deployment screen for the game today. I’m a bit unsure of how this bit should work. basically the flow of the game is this:

  1. Select Scenario
  2. Select ships to form a fleet for this battle (with limits)
  3. Deploy ships in formations and issue basic orders
  4. Run battle

The deployment screen is basically where you say “The Enterprise should get no closer than 5,000 meters to the enemy cruisers and blast away, while fighter wing 3 protects it, meanwhile bomber squad 2 will charge in and attack the enemy frigates”

So you need to do lots of fiddling. The current interface is shown below (click to enlarge)

The fleet is on the right, you drag them onto the map to position them within your deployment zone (light rectangle). eventually, approx enemy deployments will be shown on the map too. The sliders on the left is where you adjust the rules of engagement for each ship. This is all very fiddly because do I allow you to set multiple waypoints? And do I make the maps bigger so positions are more tactical? if I do, the ship icons will get horribly small on minimum res (1024×768). Do I abandon support for 1024×768? or allow this screen to zoom or scroll?

hmmmmmmmmmm