Fill out your e-mail address and click submit to join the positech games newsletter!

Pay attention to trigonometry

Filed under: programming cliffski 10:27 pm February 27, 2009

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

Filed under: business cliffski 7:03 pm February 25, 2009

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

Filed under: game design,gratuitous space battles cliffski 4:13 pm February 24, 2009

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

Cats and windows and German

Filed under: Uncategorized cliffski 8:35 pm February 21, 2009

Jack (my youngest cat) was in fine form today. I opened a bedroom window and he was looking out of it, then decided to leap out and grab the top of the open window with both paws. I don’t think he had planned ahead as he now dangled by both front paws from an open window with no easy escape route. Almost immediately he lost it and fell.

Thankfully he fell maybe 5 feet onto the conservatory roof. and he seemed fine, albeit slightly baffled. I’m sure it’s all in a days work for him. He should concentrate his energy on defending the kitchen from the black and white cat that comes in at night to eat his food (caught him twice). That cat can sniff food through TWO catflaps in an airlock-style setup, so he must be hungry.

Today I’ve tried the worringly slow-loading Empire:Total War demo, and started work on making those fiddly German language characters show up for a potential German-language copy of Democracy 2.

Scaling up ok

Filed under: gratuitous space battles cliffski 10:42 am February 20, 2009

At princecs insistence, I stuck a metric ton of ships into the game and ran it with fraps to see how it managed. Still 70-80fps in release mode before Ive gone optimize happy, so not bad:

Better Shields

Filed under: game design,gratuitous space battles,programming cliffski 1:24 pm February 17, 2009

I spent part of yesterday and today working on the shield effects for Gratuitous Space Battles. The old effect was shit, but it was only placeholder. It was just a simple alpha blended sprite that draws over the ship, fading in and out as the ships hit like this:

There was a lot wrong with it. firstly lasers seemed to shine through it, secondly there was no feeling that the ship got hit from a certain angle, and there was generally not much pizzaz. The newer version is better but still needs work:

Now I have the incoming laser fire stopped at the right place, plus the shield itself has 2 layers, a feint all over effect, and an angled blast front image which faces the point of impact. I think it looks lots better. What I don’t have yet is any sparks or particles rippling out from the impact point. A simple particle shower is easy, but ideally the particles would ripple around the shield in a realistic spherical sense. I’m not sure how easily doable that si without doing it all in 3D, which is overkill.

Right now I’m working on spaceship breakups on explosions so I’m taking a break from the shields stuff.

Excellent iphone game

Filed under: game design cliffski 8:00 pm February 15, 2009

I don’t even HAVE an iphone, but I’m lucky enough to have played this:

http://www.ancient-workshop.com/

On someone else’s. It’s excellent. If you are one of those hip trendy kids with an iphone, you owe it to yourself to get it immediately. It’s probably the best new puzzle / thinking game mechanic I’ve seen in ages, and the polish and presentation is just superb.

It’s a puzzle game where you have to get a frog from point A to point B by moving his legs from one water droplet to the next. If you think it sounds straightforward it isn’t.

The guy who made it taught me how to code properly, and he really knows his stuff. Given the quality of this game and the amount of drivel currently on iphone, it’s CRIMINAL that this isn’t yet the #1 selling game on there.
Seriously, give it a go.

Gratuitous Space Battles

Filed under: Uncategorized cliffski 5:48 pm February 13, 2009

That’s the name of the new game, as officially announced here:

http://www.rockpapershotgun.com/2009/02/13/gratuitous-space-battles/

I’ll have lots more to say about it in the next month or two :D

Re-jigging the ship modules

Filed under: game design cliffski 9:42 pm February 12, 2009

Tomorrow I’ll be stroking my chin a lot and rethinking how the modules that make up each ship are put together. I’ve got quite a long way into the game with the current system, but I have a few thoughts I need to elaborate on.

Firstly, I think I’ll add a crew requirement, and maybe a heat one too. Ship modules currently have a financial cost, a weight, a hitpoint value (strength) and a power requirement. I think it needs a little more complexity so there are some interesting choices in module loadout for each ship. I don’t want it too complex, but it can’t be too simple and a no-brainer either.

Secondly, I need to think about the number of modules per ship again. Currently they come in three sizes, for the three ship sizes. The downside of this is that I can’t currently have big cruisers with one huge fuck-off mega-gun and ten small anti-fighter lasers. I’m considering a hybrid system where you can stick a few fighter or frigate sized modules in extra slots on each cruiser. I’m not sure about that.

I’m also talking to some artists about doing spaceship sprites. I don’t think my coder art is good enough. I also finally got the GUI and code for escort orders done, so fighters can be set to stick close to bigger ships and defend them from enemy bombers.

Optimising the mayhem

Filed under: game design cliffski 5:30 pm February 10, 2009

The last few days have been spent on optimising the space battle code. Basically I mad a dcision that the battles were not vaguely big enough, and needed to support a bunch more ships, especially now given that you can zoom in and out. That meant there would probably be some bottlenecks as I scaled up the number of ships, and it’s been a few days of identifying them and sorting them out.

Everything now runs way faster than it used to. I had a lot of really inefficient texture-setting code that was setting textures for objects and trying to render them offscreen. Now I’ve bunched lots of the particle stuff into a single texture atlas and optimised away all the offscreen stuff, it works much better.

What I haven’t got done yet is any LOD stuff, which is ironic seeing as though my first AAA industry job was on the ‘infinite polygon engine’ of lore. I really need to get some higher detail particle effects for close-ups, and I think I might massively ramp up the number of damage textures and similar stuff for when you zoom in. As always, the problem will be fading it all in nicely so you don’t get ‘popup’ whilst retaining the performance benefit when you are zoomed out.

Plus I’ve started the very early work on the screen where you deploy your ships pre-battle.

Next Page »